diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index fea1759fef1b..4b5ba426ed45 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -919,6 +919,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "networksecurity" }, + "NetworkServices": { + "language": "php", + "distribution_name": "google/cloud-networkservices", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-networkservices/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "networkservices" + }, "Notebooks": { "language": "php", "distribution_name": "google/cloud-notebooks", diff --git a/NetworkServices/.OwlBot.yaml b/NetworkServices/.OwlBot.yaml new file mode 100644 index 000000000000..76f29e1e1115 --- /dev/null +++ b/NetworkServices/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/networkservices/(v1)/.*-php/(.*) + dest: /owl-bot-staging/NetworkServices/$1/$2 +api-name: NetworkServices diff --git a/NetworkServices/.gitattributes b/NetworkServices/.gitattributes new file mode 100644 index 000000000000..4bf0fe6f415b --- /dev/null +++ b/NetworkServices/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/NetworkServices/.github/pull_request_template.md b/NetworkServices/.github/pull_request_template.md new file mode 100644 index 000000000000..edf73190827a --- /dev/null +++ b/NetworkServices/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `NetworkServices/src`, and tests in `NetworkServices/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/NetworkServices/CONTRIBUTING.md b/NetworkServices/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/NetworkServices/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/NetworkServices/LICENSE b/NetworkServices/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/NetworkServices/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/NetworkServices/README.md b/NetworkServices/README.md new file mode 100644 index 000000000000..688292532f5f --- /dev/null +++ b/NetworkServices/README.md @@ -0,0 +1,45 @@ +# Google Cloud Network Services for PHP + +> Idiomatic PHP client for [Google Cloud Network Services](https://cloud.google.com/products/networking). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-networkservices/v/stable)](https://packagist.org/packages/google/cloud-networkservices) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-networkservices.svg)](https://packagist.org/packages/google/cloud-networkservices) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-networkservices/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-networkservices +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/google-cloud-php-networkservices/tree/main/samples) for a canonical list of samples. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/products/networking). diff --git a/NetworkServices/VERSION b/NetworkServices/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/NetworkServices/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/NetworkServices/composer.json b/NetworkServices/composer.json new file mode 100644 index 000000000000..ff83c0717b40 --- /dev/null +++ b/NetworkServices/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-networkservices", + "description": "Google Cloud Network Services Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\NetworkServices\\": "src", + "GPBMetadata\\Google\\Cloud\\Networkservices\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-networkservices", + "path": "NetworkServices", + "target": "googleapis/google-cloud-php-networkservices" + } + }, + "require": { + "php": "^8.0", + "google/gax": "^1.34.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/NetworkServices/metadata/V1/Common.php b/NetworkServices/metadata/V1/Common.php new file mode 100644 index 000000000000..ced22555a28e Binary files /dev/null and b/NetworkServices/metadata/V1/Common.php differ diff --git a/NetworkServices/metadata/V1/Dep.php b/NetworkServices/metadata/V1/Dep.php new file mode 100644 index 000000000000..42c11411c28f Binary files /dev/null and b/NetworkServices/metadata/V1/Dep.php differ diff --git a/NetworkServices/metadata/V1/EndpointPolicy.php b/NetworkServices/metadata/V1/EndpointPolicy.php new file mode 100644 index 000000000000..6d16490baf65 Binary files /dev/null and b/NetworkServices/metadata/V1/EndpointPolicy.php differ diff --git a/NetworkServices/metadata/V1/Gateway.php b/NetworkServices/metadata/V1/Gateway.php new file mode 100644 index 000000000000..47966104bb94 Binary files /dev/null and b/NetworkServices/metadata/V1/Gateway.php differ diff --git a/NetworkServices/metadata/V1/GrpcRoute.php b/NetworkServices/metadata/V1/GrpcRoute.php new file mode 100644 index 000000000000..5b588ba12303 Binary files /dev/null and b/NetworkServices/metadata/V1/GrpcRoute.php differ diff --git a/NetworkServices/metadata/V1/HttpRoute.php b/NetworkServices/metadata/V1/HttpRoute.php new file mode 100644 index 000000000000..0953f461d643 Binary files /dev/null and b/NetworkServices/metadata/V1/HttpRoute.php differ diff --git a/NetworkServices/metadata/V1/Mesh.php b/NetworkServices/metadata/V1/Mesh.php new file mode 100644 index 000000000000..bb05c510d0df --- /dev/null +++ b/NetworkServices/metadata/V1/Mesh.php @@ -0,0 +1,64 @@ +internalAddGeneratedFile( + ' +÷ +*google/cloud/networkservices/v1/mesh.protogoogle.cloud.networkservices.v1google/api/resource.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"¯ +Mesh +name ( BàA + self_link ( BàA4 + create_time ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàAF +labels ( 21.google.cloud.networkservices.v1.Mesh.LabelsEntryBàA + description ( BàA +interception_port (BàA- + LabelsEntry +key (  +value ( :8:_êA\\ +#networkservices.googleapis.com/Mesh5projects/{project}/locations/{location}/meshes/{mesh}"w +ListMeshesRequest; +parent ( B+àAúA%#networkservices.googleapis.com/Mesh + page_size ( + +page_token ( "d +ListMeshesResponse5 +meshes ( 2%.google.cloud.networkservices.v1.Mesh +next_page_token ( "K +GetMeshRequest9 +name ( B+àAúA% +#networkservices.googleapis.com/Mesh"  +CreateMeshRequest; +parent ( B+àAúA%#networkservices.googleapis.com/Mesh +mesh_id ( BàA8 +mesh ( 2%.google.cloud.networkservices.v1.MeshBàA"ƒ +UpdateMeshRequest4 + update_mask ( 2.google.protobuf.FieldMaskBàA8 +mesh ( 2%.google.cloud.networkservices.v1.MeshBàA"N +DeleteMeshRequest9 +name ( B+àAúA% +#networkservices.googleapis.com/MeshBê +#com.google.cloud.networkservices.v1B MeshProtoPZMcloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespbªGoogle.Cloud.NetworkServices.V1ÊGoogle\\Cloud\\NetworkServices\\V1ê"Google::Cloud::NetworkServices::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/NetworkServices/metadata/V1/NetworkServices.php b/NetworkServices/metadata/V1/NetworkServices.php new file mode 100644 index 000000000000..40934b680b86 --- /dev/null +++ b/NetworkServices/metadata/V1/NetworkServices.php @@ -0,0 +1,110 @@ +internalAddGeneratedFile( + ' +¬N +6google/cloud/networkservices/v1/network_services.protogoogle.cloud.networkservices.v1google/api/client.proto5google/cloud/networkservices/v1/endpoint_policy.proto-google/cloud/networkservices/v1/gateway.proto0google/cloud/networkservices/v1/grpc_route.proto0google/cloud/networkservices/v1/http_route.proto*google/cloud/networkservices/v1/mesh.proto5google/cloud/networkservices/v1/service_binding.proto/google/cloud/networkservices/v1/tcp_route.proto/google/cloud/networkservices/v1/tls_route.proto#google/longrunning/operations.proto2™H +NetworkServicesÚ +ListEndpointPolicies<.google.cloud.networkservices.v1.ListEndpointPoliciesRequest=.google.cloud.networkservices.v1.ListEndpointPoliciesResponse"EÚAparent‚Óä“64/v1/{parent=projects/*/locations/*}/endpointPoliciesÄ +GetEndpointPolicy9.google.cloud.networkservices.v1.GetEndpointPolicyRequest/.google.cloud.networkservices.v1.EndpointPolicy"CÚAname‚Óä“64/v1/{name=projects/*/locations/*/endpointPolicies/*}µ +CreateEndpointPolicy<.google.cloud.networkservices.v1.CreateEndpointPolicyRequest.google.longrunning.Operation"¿ÊAC +EndpointPolicy1google.cloud.networkservices.v1.OperationMetadataÚA)parent,endpoint_policy,endpoint_policy_id‚Óä“G"4/v1/{parent=projects/*/locations/*}/endpointPolicies:endpoint_policy· +UpdateEndpointPolicy<.google.cloud.networkservices.v1.UpdateEndpointPolicyRequest.google.longrunning.Operation"ÁÊAC +EndpointPolicy1google.cloud.networkservices.v1.OperationMetadataÚAendpoint_policy,update_mask‚Óä“W2D/v1/{endpoint_policy.name=projects/*/locations/*/endpointPolicies/*}:endpoint_policy† +DeleteEndpointPolicy<.google.cloud.networkservices.v1.DeleteEndpointPolicyRequest.google.longrunning.Operation"ÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“6*4/v1/{name=projects/*/locations/*/endpointPolicies/*}º + ListGateways4.google.cloud.networkservices.v1.ListGatewaysRequest5.google.cloud.networkservices.v1.ListGatewaysResponse"=ÚAparent‚Óä“.,/v1/{parent=projects/*/locations/*}/gateways§ + +GetGateway2.google.cloud.networkservices.v1.GetGatewayRequest(.google.cloud.networkservices.v1.Gateway";ÚAname‚Óä“.,/v1/{name=projects/*/locations/*/gateways/*}€ + CreateGateway5.google.cloud.networkservices.v1.CreateGatewayRequest.google.longrunning.Operation"˜ÊA< +Gateway1google.cloud.networkservices.v1.OperationMetadataÚAparent,gateway,gateway_id‚Óä“7",/v1/{parent=projects/*/locations/*}/gateways:gateway‚ + UpdateGateway5.google.cloud.networkservices.v1.UpdateGatewayRequest.google.longrunning.Operation"šÊA< +Gateway1google.cloud.networkservices.v1.OperationMetadataÚAgateway,update_mask‚Óä“?24/v1/{gateway.name=projects/*/locations/*/gateways/*}:gatewayð + DeleteGateway5.google.cloud.networkservices.v1.DeleteGatewayRequest.google.longrunning.Operation"ˆÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“.*,/v1/{name=projects/*/locations/*/gateways/*} +ListGrpcRoutes6.google.cloud.networkservices.v1.ListGrpcRoutesRequest7.google.cloud.networkservices.v1.ListGrpcRoutesResponse"?ÚAparent‚Óä“0./v1/{parent=projects/*/locations/*}/grpcRoutes¯ + GetGrpcRoute4.google.cloud.networkservices.v1.GetGrpcRouteRequest*.google.cloud.networkservices.v1.GrpcRoute"=ÚAname‚Óä“0./v1/{name=projects/*/locations/*/grpcRoutes/*}‘ +CreateGrpcRoute7.google.cloud.networkservices.v1.CreateGrpcRouteRequest.google.longrunning.Operation"¥ÊA> + GrpcRoute1google.cloud.networkservices.v1.OperationMetadataÚAparent,grpc_route,grpc_route_id‚Óä“<"./v1/{parent=projects/*/locations/*}/grpcRoutes: +grpc_route“ +UpdateGrpcRoute7.google.cloud.networkservices.v1.UpdateGrpcRouteRequest.google.longrunning.Operation"§ÊA> + GrpcRoute1google.cloud.networkservices.v1.OperationMetadataÚAgrpc_route,update_mask‚Óä“G29/v1/{grpc_route.name=projects/*/locations/*/grpcRoutes/*}: +grpc_routeö +DeleteGrpcRoute7.google.cloud.networkservices.v1.DeleteGrpcRouteRequest.google.longrunning.Operation"ŠÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“0*./v1/{name=projects/*/locations/*/grpcRoutes/*} +ListHttpRoutes6.google.cloud.networkservices.v1.ListHttpRoutesRequest7.google.cloud.networkservices.v1.ListHttpRoutesResponse"?ÚAparent‚Óä“0./v1/{parent=projects/*/locations/*}/httpRoutes¯ + GetHttpRoute4.google.cloud.networkservices.v1.GetHttpRouteRequest*.google.cloud.networkservices.v1.HttpRoute"=ÚAname‚Óä“0./v1/{name=projects/*/locations/*/httpRoutes/*}‘ +CreateHttpRoute7.google.cloud.networkservices.v1.CreateHttpRouteRequest.google.longrunning.Operation"¥ÊA> + HttpRoute1google.cloud.networkservices.v1.OperationMetadataÚAparent,http_route,http_route_id‚Óä“<"./v1/{parent=projects/*/locations/*}/httpRoutes: +http_route“ +UpdateHttpRoute7.google.cloud.networkservices.v1.UpdateHttpRouteRequest.google.longrunning.Operation"§ÊA> + HttpRoute1google.cloud.networkservices.v1.OperationMetadataÚAhttp_route,update_mask‚Óä“G29/v1/{http_route.name=projects/*/locations/*/httpRoutes/*}: +http_routeö +DeleteHttpRoute7.google.cloud.networkservices.v1.DeleteHttpRouteRequest.google.longrunning.Operation"ŠÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“0*./v1/{name=projects/*/locations/*/httpRoutes/*}¾ + ListTcpRoutes5.google.cloud.networkservices.v1.ListTcpRoutesRequest6.google.cloud.networkservices.v1.ListTcpRoutesResponse">ÚAparent‚Óä“/-/v1/{parent=projects/*/locations/*}/tcpRoutes« + GetTcpRoute3.google.cloud.networkservices.v1.GetTcpRouteRequest).google.cloud.networkservices.v1.TcpRoute"<ÚAname‚Óä“/-/v1/{name=projects/*/locations/*/tcpRoutes/*}Š +CreateTcpRoute6.google.cloud.networkservices.v1.CreateTcpRouteRequest.google.longrunning.Operation" ÊA= +TcpRoute1google.cloud.networkservices.v1.OperationMetadataÚAparent,tcp_route,tcp_route_id‚Óä“:"-/v1/{parent=projects/*/locations/*}/tcpRoutes: tcp_routeŒ +UpdateTcpRoute6.google.cloud.networkservices.v1.UpdateTcpRouteRequest.google.longrunning.Operation"¢ÊA= +TcpRoute1google.cloud.networkservices.v1.OperationMetadataÚAtcp_route,update_mask‚Óä“D27/v1/{tcp_route.name=projects/*/locations/*/tcpRoutes/*}: tcp_routeó +DeleteTcpRoute6.google.cloud.networkservices.v1.DeleteTcpRouteRequest.google.longrunning.Operation"‰ÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“/*-/v1/{name=projects/*/locations/*/tcpRoutes/*}¾ + ListTlsRoutes5.google.cloud.networkservices.v1.ListTlsRoutesRequest6.google.cloud.networkservices.v1.ListTlsRoutesResponse">ÚAparent‚Óä“/-/v1/{parent=projects/*/locations/*}/tlsRoutes« + GetTlsRoute3.google.cloud.networkservices.v1.GetTlsRouteRequest).google.cloud.networkservices.v1.TlsRoute"<ÚAname‚Óä“/-/v1/{name=projects/*/locations/*/tlsRoutes/*}Š +CreateTlsRoute6.google.cloud.networkservices.v1.CreateTlsRouteRequest.google.longrunning.Operation" ÊA= +TlsRoute1google.cloud.networkservices.v1.OperationMetadataÚAparent,tls_route,tls_route_id‚Óä“:"-/v1/{parent=projects/*/locations/*}/tlsRoutes: tls_routeŒ +UpdateTlsRoute6.google.cloud.networkservices.v1.UpdateTlsRouteRequest.google.longrunning.Operation"¢ÊA= +TlsRoute1google.cloud.networkservices.v1.OperationMetadataÚAtls_route,update_mask‚Óä“D27/v1/{tls_route.name=projects/*/locations/*/tlsRoutes/*}: tls_routeó +DeleteTlsRoute6.google.cloud.networkservices.v1.DeleteTlsRouteRequest.google.longrunning.Operation"‰ÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“/*-/v1/{name=projects/*/locations/*/tlsRoutes/*}Ö +ListServiceBindings;.google.cloud.networkservices.v1.ListServiceBindingsRequest<.google.cloud.networkservices.v1.ListServiceBindingsResponse"DÚAparent‚Óä“53/v1/{parent=projects/*/locations/*}/serviceBindingsà +GetServiceBinding9.google.cloud.networkservices.v1.GetServiceBindingRequest/.google.cloud.networkservices.v1.ServiceBinding"BÚAname‚Óä“53/v1/{name=projects/*/locations/*/serviceBindings/*}´ +CreateServiceBinding<.google.cloud.networkservices.v1.CreateServiceBindingRequest.google.longrunning.Operation"¾ÊAC +ServiceBinding1google.cloud.networkservices.v1.OperationMetadataÚA)parent,service_binding,service_binding_id‚Óä“F"3/v1/{parent=projects/*/locations/*}/serviceBindings:service_binding… +DeleteServiceBinding<.google.cloud.networkservices.v1.DeleteServiceBindingRequest.google.longrunning.Operation"ÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“5*3/v1/{name=projects/*/locations/*/serviceBindings/*}² + +ListMeshes2.google.cloud.networkservices.v1.ListMeshesRequest3.google.cloud.networkservices.v1.ListMeshesResponse";ÚAparent‚Óä“,*/v1/{parent=projects/*/locations/*}/meshesœ +GetMesh/.google.cloud.networkservices.v1.GetMeshRequest%.google.cloud.networkservices.v1.Mesh"9ÚAname‚Óä“,*/v1/{name=projects/*/locations/*/meshes/*}ì + +CreateMesh2.google.cloud.networkservices.v1.CreateMeshRequest.google.longrunning.Operation"ŠÊA9 +Mesh1google.cloud.networkservices.v1.OperationMetadataÚAparent,mesh,mesh_id‚Óä“2"*/v1/{parent=projects/*/locations/*}/meshes:meshî + +UpdateMesh2.google.cloud.networkservices.v1.UpdateMeshRequest.google.longrunning.Operation"ŒÊA9 +Mesh1google.cloud.networkservices.v1.OperationMetadataÚAmesh,update_mask‚Óä“72//v1/{mesh.name=projects/*/locations/*/meshes/*}:meshè + +DeleteMesh2.google.cloud.networkservices.v1.DeleteMeshRequest.google.longrunning.Operation"†ÊAJ +google.protobuf.Empty1google.cloud.networkservices.v1.OperationMetadataÚAname‚Óä“,**/v1/{name=projects/*/locations/*/meshes/*}RÊAnetworkservices.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBß +#com.google.cloud.networkservices.v1PZMcloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespbªGoogle.Cloud.NetworkServices.V1ÊGoogle\\Cloud\\NetworkServices\\V1ê"Google::Cloud::NetworkServices::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/NetworkServices/metadata/V1/ServiceBinding.php b/NetworkServices/metadata/V1/ServiceBinding.php new file mode 100644 index 000000000000..23a6be8c3ca8 --- /dev/null +++ b/NetworkServices/metadata/V1/ServiceBinding.php @@ -0,0 +1,59 @@ +internalAddGeneratedFile( + ' +‚ +5google/cloud/networkservices/v1/service_binding.protogoogle.cloud.networkservices.v1google/api/resource.protogoogle/protobuf/timestamp.proto"¿ +ServiceBinding +name ( BàA + description ( BàA4 + create_time ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàA +service ( BàAP +labels ( 2;.google.cloud.networkservices.v1.ServiceBinding.LabelsEntryBàA- + LabelsEntry +key (  +value ( :8:}êAz +-networkservices.googleapis.com/ServiceBindingIprojects/{project}/locations/{location}/serviceBindings/{service_binding}"Š +ListServiceBindingsRequestE +parent ( B5àAúA/-networkservices.googleapis.com/ServiceBinding + page_size ( + +page_token ( " +ListServiceBindingsResponseI +service_bindings ( 2/.google.cloud.networkservices.v1.ServiceBinding +next_page_token ( "_ +GetServiceBindingRequestC +name ( B5àAúA/ +-networkservices.googleapis.com/ServiceBinding"Ô +CreateServiceBindingRequestE +parent ( B5àAúA/-networkservices.googleapis.com/ServiceBinding +service_binding_id ( BàAM +service_binding ( 2/.google.cloud.networkservices.v1.ServiceBindingBàA"b +DeleteServiceBindingRequestC +name ( B5àAúA/ +-networkservices.googleapis.com/ServiceBindingBô +#com.google.cloud.networkservices.v1BServiceBindingProtoPZMcloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespbªGoogle.Cloud.NetworkServices.V1ÊGoogle\\Cloud\\NetworkServices\\V1ê"Google::Cloud::NetworkServices::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/NetworkServices/metadata/V1/TcpRoute.php b/NetworkServices/metadata/V1/TcpRoute.php new file mode 100644 index 000000000000..35505dfd4a1c --- /dev/null +++ b/NetworkServices/metadata/V1/TcpRoute.php @@ -0,0 +1,85 @@ +internalAddGeneratedFile( + ' +Ë +/google/cloud/networkservices/v1/tcp_route.protogoogle.cloud.networkservices.v1google/api/resource.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"À +TcpRoute +name ( BàA + self_link ( BàA4 + create_time ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàA + description ( BàAG +rules ( 23.google.cloud.networkservices.v1.TcpRoute.RouteRuleBàA; +meshes ( B+àAúA% +#networkservices.googleapis.com/Mesh@ +gateways ( B.àAúA( +&networkservices.googleapis.com/GatewayJ +labels + ( 25.google.cloud.networkservices.v1.TcpRoute.LabelsEntryBàA£ + RouteRuleJ +matches ( 24.google.cloud.networkservices.v1.TcpRoute.RouteMatchBàAJ +action ( 25.google.cloud.networkservices.v1.TcpRoute.RouteActionBàA5 + +RouteMatch +address ( BàA +port ( BàA‡ + RouteActionU + destinations ( 2:.google.cloud.networkservices.v1.TcpRoute.RouteDestinationBàA! +original_destination (BàAl +RouteDestinationC + service_name ( B-àAúA\' +%compute.googleapis.com/BackendService +weight (BàA- + LabelsEntry +key (  +value ( :8:kêAh +\'networkservices.googleapis.com/TcpRoute=projects/{project}/locations/{location}/tcpRoutes/{tcp_route}"~ +ListTcpRoutesRequest? +parent ( B/àAúA)\'networkservices.googleapis.com/TcpRoute + page_size ( + +page_token ( "o +ListTcpRoutesResponse= + +tcp_routes ( 2).google.cloud.networkservices.v1.TcpRoute +next_page_token ( "S +GetTcpRouteRequest= +name ( B/àAúA) +\'networkservices.googleapis.com/TcpRoute"¶ +CreateTcpRouteRequest? +parent ( B/àAúA)\'networkservices.googleapis.com/TcpRoute + tcp_route_id ( BàAA + tcp_route ( 2).google.cloud.networkservices.v1.TcpRouteBàA" +UpdateTcpRouteRequest4 + update_mask ( 2.google.protobuf.FieldMaskBàAA + tcp_route ( 2).google.cloud.networkservices.v1.TcpRouteBàA"V +DeleteTcpRouteRequest= +name ( B/àAúA) +\'networkservices.googleapis.com/TcpRouteBã +#com.google.cloud.networkservices.v1B TcpRouteProtoPZMcloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespbªGoogle.Cloud.NetworkServices.V1ÊGoogle\\Cloud\\NetworkServices\\V1ê"Google::Cloud::NetworkServices::V1êAr +%compute.googleapis.com/BackendServiceIprojects/{project}/locations/{location}/backendServices/{backend_service}bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/NetworkServices/metadata/V1/TlsRoute.php b/NetworkServices/metadata/V1/TlsRoute.php new file mode 100644 index 000000000000..1687a1119d3c --- /dev/null +++ b/NetworkServices/metadata/V1/TlsRoute.php @@ -0,0 +1,78 @@ +internalAddGeneratedFile( + ' +¸ +/google/cloud/networkservices/v1/tls_route.protogoogle.cloud.networkservices.v1google/api/resource.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"¢ +TlsRoute +name ( BàA + self_link ( BàA4 + create_time ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàA + description ( BàAG +rules ( 23.google.cloud.networkservices.v1.TlsRoute.RouteRuleBàA; +meshes ( B+àAúA% +#networkservices.googleapis.com/Mesh@ +gateways ( B.àAúA( +&networkservices.googleapis.com/Gateway£ + RouteRuleJ +matches ( 24.google.cloud.networkservices.v1.TlsRoute.RouteMatchBàAJ +action ( 25.google.cloud.networkservices.v1.TlsRoute.RouteActionBàA6 + +RouteMatch +sni_host ( BàA +alpn ( BàAd + RouteActionU + destinations ( 2:.google.cloud.networkservices.v1.TlsRoute.RouteDestinationBàAl +RouteDestinationC + service_name ( B-àAúA\' +%compute.googleapis.com/BackendService +weight (BàA:kêAh +\'networkservices.googleapis.com/TlsRoute=projects/{project}/locations/{location}/tlsRoutes/{tls_route}"~ +ListTlsRoutesRequest? +parent ( B/àAúA)\'networkservices.googleapis.com/TlsRoute + page_size ( + +page_token ( "o +ListTlsRoutesResponse= + +tls_routes ( 2).google.cloud.networkservices.v1.TlsRoute +next_page_token ( "S +GetTlsRouteRequest= +name ( B/àAúA) +\'networkservices.googleapis.com/TlsRoute"¶ +CreateTlsRouteRequest? +parent ( B/àAúA)\'networkservices.googleapis.com/TlsRoute + tls_route_id ( BàAA + tls_route ( 2).google.cloud.networkservices.v1.TlsRouteBàA" +UpdateTlsRouteRequest4 + update_mask ( 2.google.protobuf.FieldMaskBàAA + tls_route ( 2).google.cloud.networkservices.v1.TlsRouteBàA"V +DeleteTlsRouteRequest= +name ( B/àAúA) +\'networkservices.googleapis.com/TlsRouteBî +#com.google.cloud.networkservices.v1B TlsRouteProtoPZMcloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespbªGoogle.Cloud.NetworkServices.V1ÊGoogle\\Cloud\\NetworkServices\\V1ê"Google::Cloud::NetworkServices::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/NetworkServices/owlbot.py b/NetworkServices/owlbot.py new file mode 100644 index 000000000000..349da58a252d --- /dev/null +++ b/NetworkServices/owlbot.py @@ -0,0 +1,62 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/NetworkServices").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main( + src=src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ] +) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# 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/NetworkServices/phpunit.xml.dist b/NetworkServices/phpunit.xml.dist new file mode 100644 index 000000000000..3b8df2f6f57f --- /dev/null +++ b/NetworkServices/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/NetworkServices/samples/V1/DepServiceClient/create_lb_route_extension.php b/NetworkServices/samples/V1/DepServiceClient/create_lb_route_extension.php new file mode 100644 index 000000000000..598214c9eed5 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/create_lb_route_extension.php @@ -0,0 +1,175 @@ +setCelExpression($lbRouteExtensionExtensionChainsMatchConditionCelExpression); + $extension = (new Extension()) + ->setName($lbRouteExtensionExtensionChainsExtensionsName) + ->setService($lbRouteExtensionExtensionChainsExtensionsService); + $lbRouteExtensionExtensionChainsExtensions = [$extension,]; + $extensionChain = (new ExtensionChain()) + ->setName($lbRouteExtensionExtensionChainsName) + ->setMatchCondition($lbRouteExtensionExtensionChainsMatchCondition) + ->setExtensions($lbRouteExtensionExtensionChainsExtensions); + $lbRouteExtensionExtensionChains = [$extensionChain,]; + $lbRouteExtension = (new LbRouteExtension()) + ->setName($lbRouteExtensionName) + ->setForwardingRules($lbRouteExtensionForwardingRules) + ->setExtensionChains($lbRouteExtensionExtensionChains) + ->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $depServiceClient->createLbRouteExtension( + $formattedParent, + $lbRouteExtensionId, + $lbRouteExtension + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LbRouteExtension $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DepServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $lbRouteExtensionId = '[LB_ROUTE_EXTENSION_ID]'; + $lbRouteExtensionName = '[NAME]'; + $lbRouteExtensionForwardingRulesElement = '[FORWARDING_RULES]'; + $lbRouteExtensionExtensionChainsName = '[NAME]'; + $lbRouteExtensionExtensionChainsMatchConditionCelExpression = '[CEL_EXPRESSION]'; + $lbRouteExtensionExtensionChainsExtensionsName = '[NAME]'; + $lbRouteExtensionExtensionChainsExtensionsService = '[SERVICE]'; + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + + create_lb_route_extension_sample( + $formattedParent, + $lbRouteExtensionId, + $lbRouteExtensionName, + $lbRouteExtensionForwardingRulesElement, + $lbRouteExtensionExtensionChainsName, + $lbRouteExtensionExtensionChainsMatchConditionCelExpression, + $lbRouteExtensionExtensionChainsExtensionsName, + $lbRouteExtensionExtensionChainsExtensionsService, + $lbRouteExtensionLoadBalancingScheme + ); +} +// [END networkservices_v1_generated_DepService_CreateLbRouteExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/create_lb_traffic_extension.php b/NetworkServices/samples/V1/DepServiceClient/create_lb_traffic_extension.php new file mode 100644 index 000000000000..2e9a47c1e5ba --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/create_lb_traffic_extension.php @@ -0,0 +1,176 @@ +setCelExpression($lbTrafficExtensionExtensionChainsMatchConditionCelExpression); + $extension = (new Extension()) + ->setName($lbTrafficExtensionExtensionChainsExtensionsName) + ->setService($lbTrafficExtensionExtensionChainsExtensionsService); + $lbTrafficExtensionExtensionChainsExtensions = [$extension,]; + $extensionChain = (new ExtensionChain()) + ->setName($lbTrafficExtensionExtensionChainsName) + ->setMatchCondition($lbTrafficExtensionExtensionChainsMatchCondition) + ->setExtensions($lbTrafficExtensionExtensionChainsExtensions); + $lbTrafficExtensionExtensionChains = [$extensionChain,]; + $lbTrafficExtension = (new LbTrafficExtension()) + ->setName($lbTrafficExtensionName) + ->setForwardingRules($lbTrafficExtensionForwardingRules) + ->setExtensionChains($lbTrafficExtensionExtensionChains) + ->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $depServiceClient->createLbTrafficExtension( + $formattedParent, + $lbTrafficExtensionId, + $lbTrafficExtension + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LbTrafficExtension $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DepServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $lbTrafficExtensionId = '[LB_TRAFFIC_EXTENSION_ID]'; + $lbTrafficExtensionName = '[NAME]'; + $lbTrafficExtensionForwardingRulesElement = '[FORWARDING_RULES]'; + $lbTrafficExtensionExtensionChainsName = '[NAME]'; + $lbTrafficExtensionExtensionChainsMatchConditionCelExpression = '[CEL_EXPRESSION]'; + $lbTrafficExtensionExtensionChainsExtensionsName = '[NAME]'; + $lbTrafficExtensionExtensionChainsExtensionsService = '[SERVICE]'; + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + + create_lb_traffic_extension_sample( + $formattedParent, + $lbTrafficExtensionId, + $lbTrafficExtensionName, + $lbTrafficExtensionForwardingRulesElement, + $lbTrafficExtensionExtensionChainsName, + $lbTrafficExtensionExtensionChainsMatchConditionCelExpression, + $lbTrafficExtensionExtensionChainsExtensionsName, + $lbTrafficExtensionExtensionChainsExtensionsService, + $lbTrafficExtensionLoadBalancingScheme + ); +} +// [END networkservices_v1_generated_DepService_CreateLbTrafficExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/delete_lb_route_extension.php b/NetworkServices/samples/V1/DepServiceClient/delete_lb_route_extension.php new file mode 100644 index 000000000000..2df81768f9af --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/delete_lb_route_extension.php @@ -0,0 +1,81 @@ +deleteLbRouteExtension($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DepServiceClient::lbRouteExtensionName( + '[PROJECT]', + '[LOCATION]', + '[LB_ROUTE_EXTENSION]' + ); + + delete_lb_route_extension_sample($formattedName); +} +// [END networkservices_v1_generated_DepService_DeleteLbRouteExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/delete_lb_traffic_extension.php b/NetworkServices/samples/V1/DepServiceClient/delete_lb_traffic_extension.php new file mode 100644 index 000000000000..fc42b3518345 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/delete_lb_traffic_extension.php @@ -0,0 +1,81 @@ +deleteLbTrafficExtension($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DepServiceClient::lbTrafficExtensionName( + '[PROJECT]', + '[LOCATION]', + '[LB_TRAFFIC_EXTENSION]' + ); + + delete_lb_traffic_extension_sample($formattedName); +} +// [END networkservices_v1_generated_DepService_DeleteLbTrafficExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/get_iam_policy.php b/NetworkServices/samples/V1/DepServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..832b15c7c359 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END networkservices_v1_generated_DepService_GetIamPolicy_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/get_lb_route_extension.php b/NetworkServices/samples/V1/DepServiceClient/get_lb_route_extension.php new file mode 100644 index 000000000000..ef31fa9b961f --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/get_lb_route_extension.php @@ -0,0 +1,72 @@ +getLbRouteExtension($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DepServiceClient::lbRouteExtensionName( + '[PROJECT]', + '[LOCATION]', + '[LB_ROUTE_EXTENSION]' + ); + + get_lb_route_extension_sample($formattedName); +} +// [END networkservices_v1_generated_DepService_GetLbRouteExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/get_lb_traffic_extension.php b/NetworkServices/samples/V1/DepServiceClient/get_lb_traffic_extension.php new file mode 100644 index 000000000000..cb36945c2eba --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/get_lb_traffic_extension.php @@ -0,0 +1,72 @@ +getLbTrafficExtension($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DepServiceClient::lbTrafficExtensionName( + '[PROJECT]', + '[LOCATION]', + '[LB_TRAFFIC_EXTENSION]' + ); + + get_lb_traffic_extension_sample($formattedName); +} +// [END networkservices_v1_generated_DepService_GetLbTrafficExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/get_location.php b/NetworkServices/samples/V1/DepServiceClient/get_location.php new file mode 100644 index 000000000000..bbff9dad5472 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END networkservices_v1_generated_DepService_GetLocation_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/list_lb_route_extensions.php b/NetworkServices/samples/V1/DepServiceClient/list_lb_route_extensions.php new file mode 100644 index 000000000000..c137b56d4588 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/list_lb_route_extensions.php @@ -0,0 +1,73 @@ +listLbRouteExtensions($formattedParent); + + /** @var LbRouteExtension $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DepServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_lb_route_extensions_sample($formattedParent); +} +// [END networkservices_v1_generated_DepService_ListLbRouteExtensions_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/list_lb_traffic_extensions.php b/NetworkServices/samples/V1/DepServiceClient/list_lb_traffic_extensions.php new file mode 100644 index 000000000000..634a564a0e49 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/list_lb_traffic_extensions.php @@ -0,0 +1,73 @@ +listLbTrafficExtensions($formattedParent); + + /** @var LbTrafficExtension $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DepServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_lb_traffic_extensions_sample($formattedParent); +} +// [END networkservices_v1_generated_DepService_ListLbTrafficExtensions_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/list_locations.php b/NetworkServices/samples/V1/DepServiceClient/list_locations.php new file mode 100644 index 000000000000..4801d3cb82a2 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END networkservices_v1_generated_DepService_ListLocations_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/set_iam_policy.php b/NetworkServices/samples/V1/DepServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..c38ed7f06c3c --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END networkservices_v1_generated_DepService_SetIamPolicy_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/test_iam_permissions.php b/NetworkServices/samples/V1/DepServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..6274d58218e6 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END networkservices_v1_generated_DepService_TestIamPermissions_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/update_lb_route_extension.php b/NetworkServices/samples/V1/DepServiceClient/update_lb_route_extension.php new file mode 100644 index 000000000000..6a6c037a79c6 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/update_lb_route_extension.php @@ -0,0 +1,160 @@ +setCelExpression($lbRouteExtensionExtensionChainsMatchConditionCelExpression); + $extension = (new Extension()) + ->setName($lbRouteExtensionExtensionChainsExtensionsName) + ->setService($lbRouteExtensionExtensionChainsExtensionsService); + $lbRouteExtensionExtensionChainsExtensions = [$extension,]; + $extensionChain = (new ExtensionChain()) + ->setName($lbRouteExtensionExtensionChainsName) + ->setMatchCondition($lbRouteExtensionExtensionChainsMatchCondition) + ->setExtensions($lbRouteExtensionExtensionChainsExtensions); + $lbRouteExtensionExtensionChains = [$extensionChain,]; + $lbRouteExtension = (new LbRouteExtension()) + ->setName($lbRouteExtensionName) + ->setForwardingRules($lbRouteExtensionForwardingRules) + ->setExtensionChains($lbRouteExtensionExtensionChains) + ->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $depServiceClient->updateLbRouteExtension($lbRouteExtension); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LbRouteExtension $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $lbRouteExtensionName = '[NAME]'; + $lbRouteExtensionForwardingRulesElement = '[FORWARDING_RULES]'; + $lbRouteExtensionExtensionChainsName = '[NAME]'; + $lbRouteExtensionExtensionChainsMatchConditionCelExpression = '[CEL_EXPRESSION]'; + $lbRouteExtensionExtensionChainsExtensionsName = '[NAME]'; + $lbRouteExtensionExtensionChainsExtensionsService = '[SERVICE]'; + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + + update_lb_route_extension_sample( + $lbRouteExtensionName, + $lbRouteExtensionForwardingRulesElement, + $lbRouteExtensionExtensionChainsName, + $lbRouteExtensionExtensionChainsMatchConditionCelExpression, + $lbRouteExtensionExtensionChainsExtensionsName, + $lbRouteExtensionExtensionChainsExtensionsService, + $lbRouteExtensionLoadBalancingScheme + ); +} +// [END networkservices_v1_generated_DepService_UpdateLbRouteExtension_sync] diff --git a/NetworkServices/samples/V1/DepServiceClient/update_lb_traffic_extension.php b/NetworkServices/samples/V1/DepServiceClient/update_lb_traffic_extension.php new file mode 100644 index 000000000000..3480f1d17892 --- /dev/null +++ b/NetworkServices/samples/V1/DepServiceClient/update_lb_traffic_extension.php @@ -0,0 +1,160 @@ +setCelExpression($lbTrafficExtensionExtensionChainsMatchConditionCelExpression); + $extension = (new Extension()) + ->setName($lbTrafficExtensionExtensionChainsExtensionsName) + ->setService($lbTrafficExtensionExtensionChainsExtensionsService); + $lbTrafficExtensionExtensionChainsExtensions = [$extension,]; + $extensionChain = (new ExtensionChain()) + ->setName($lbTrafficExtensionExtensionChainsName) + ->setMatchCondition($lbTrafficExtensionExtensionChainsMatchCondition) + ->setExtensions($lbTrafficExtensionExtensionChainsExtensions); + $lbTrafficExtensionExtensionChains = [$extensionChain,]; + $lbTrafficExtension = (new LbTrafficExtension()) + ->setName($lbTrafficExtensionName) + ->setForwardingRules($lbTrafficExtensionForwardingRules) + ->setExtensionChains($lbTrafficExtensionExtensionChains) + ->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $depServiceClient->updateLbTrafficExtension($lbTrafficExtension); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LbTrafficExtension $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $lbTrafficExtensionName = '[NAME]'; + $lbTrafficExtensionForwardingRulesElement = '[FORWARDING_RULES]'; + $lbTrafficExtensionExtensionChainsName = '[NAME]'; + $lbTrafficExtensionExtensionChainsMatchConditionCelExpression = '[CEL_EXPRESSION]'; + $lbTrafficExtensionExtensionChainsExtensionsName = '[NAME]'; + $lbTrafficExtensionExtensionChainsExtensionsService = '[SERVICE]'; + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + + update_lb_traffic_extension_sample( + $lbTrafficExtensionName, + $lbTrafficExtensionForwardingRulesElement, + $lbTrafficExtensionExtensionChainsName, + $lbTrafficExtensionExtensionChainsMatchConditionCelExpression, + $lbTrafficExtensionExtensionChainsExtensionsName, + $lbTrafficExtensionExtensionChainsExtensionsService, + $lbTrafficExtensionLoadBalancingScheme + ); +} +// [END networkservices_v1_generated_DepService_UpdateLbTrafficExtension_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_endpoint_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/create_endpoint_policy.php new file mode 100644 index 000000000000..2aa8f48da9de --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_endpoint_policy.php @@ -0,0 +1,110 @@ +setName($endpointPolicyName) + ->setType($endpointPolicyType) + ->setEndpointMatcher($endpointPolicyEndpointMatcher); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createEndpointPolicy( + $formattedParent, + $endpointPolicyId, + $endpointPolicy + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var EndpointPolicy $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $endpointPolicyId = '[ENDPOINT_POLICY_ID]'; + $endpointPolicyName = '[NAME]'; + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + + create_endpoint_policy_sample( + $formattedParent, + $endpointPolicyId, + $endpointPolicyName, + $endpointPolicyType + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateEndpointPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_gateway.php b/NetworkServices/samples/V1/NetworkServicesClient/create_gateway.php new file mode 100644 index 000000000000..126f873f0749 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_gateway.php @@ -0,0 +1,115 @@ +`. + * @param int $gatewayPortsElement One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * @param string $gatewayScope Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + */ +function create_gateway_sample( + string $formattedParent, + string $gatewayId, + string $gatewayName, + int $gatewayPortsElement, + string $gatewayScope +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $gatewayPorts = [$gatewayPortsElement,]; + $gateway = (new Gateway()) + ->setName($gatewayName) + ->setPorts($gatewayPorts) + ->setScope($gatewayScope); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createGateway($formattedParent, $gatewayId, $gateway); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Gateway $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $gatewayId = '[GATEWAY_ID]'; + $gatewayName = '[NAME]'; + $gatewayPortsElement = 0; + $gatewayScope = '[SCOPE]'; + + create_gateway_sample( + $formattedParent, + $gatewayId, + $gatewayName, + $gatewayPortsElement, + $gatewayScope + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateGateway_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_grpc_route.php b/NetworkServices/samples/V1/NetworkServicesClient/create_grpc_route.php new file mode 100644 index 000000000000..dc9aa621c9bd --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_grpc_route.php @@ -0,0 +1,138 @@ +` + * @param string $grpcRouteHostnamesElement Service hostnames with an optional port for which this route + * describes traffic. + * + * Format: [:] + * + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + */ +function create_grpc_route_sample( + string $formattedParent, + string $grpcRouteId, + string $grpcRouteName, + string $grpcRouteHostnamesElement +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $grpcRouteHostnames = [$grpcRouteHostnamesElement,]; + $grpcRouteRulesAction = new RouteAction(); + $routeRule = (new RouteRule()) + ->setAction($grpcRouteRulesAction); + $grpcRouteRules = [$routeRule,]; + $grpcRoute = (new GrpcRoute()) + ->setName($grpcRouteName) + ->setHostnames($grpcRouteHostnames) + ->setRules($grpcRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createGrpcRoute($formattedParent, $grpcRouteId, $grpcRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var GrpcRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $grpcRouteId = '[GRPC_ROUTE_ID]'; + $grpcRouteName = '[NAME]'; + $grpcRouteHostnamesElement = '[HOSTNAMES]'; + + create_grpc_route_sample( + $formattedParent, + $grpcRouteId, + $grpcRouteName, + $grpcRouteHostnamesElement + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateGrpcRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_http_route.php b/NetworkServices/samples/V1/NetworkServicesClient/create_http_route.php new file mode 100644 index 000000000000..5fd253d5b741 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_http_route.php @@ -0,0 +1,127 @@ +`. + * @param string $httpRouteHostnamesElement Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + */ +function create_http_route_sample( + string $formattedParent, + string $httpRouteId, + string $httpRouteName, + string $httpRouteHostnamesElement +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $httpRouteHostnames = [$httpRouteHostnamesElement,]; + $httpRouteRules = [new RouteRule()]; + $httpRoute = (new HttpRoute()) + ->setName($httpRouteName) + ->setHostnames($httpRouteHostnames) + ->setRules($httpRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createHttpRoute($formattedParent, $httpRouteId, $httpRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var HttpRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $httpRouteId = '[HTTP_ROUTE_ID]'; + $httpRouteName = '[NAME]'; + $httpRouteHostnamesElement = '[HOSTNAMES]'; + + create_http_route_sample( + $formattedParent, + $httpRouteId, + $httpRouteName, + $httpRouteHostnamesElement + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateHttpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_mesh.php b/NetworkServices/samples/V1/NetworkServicesClient/create_mesh.php new file mode 100644 index 000000000000..9f1b6b794526 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_mesh.php @@ -0,0 +1,88 @@ +`. + */ +function create_mesh_sample(string $formattedParent, string $meshId, string $meshName): void +{ + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $mesh = (new Mesh()) + ->setName($meshName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createMesh($formattedParent, $meshId, $mesh); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Mesh $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $meshId = '[MESH_ID]'; + $meshName = '[NAME]'; + + create_mesh_sample($formattedParent, $meshId, $meshName); +} +// [END networkservices_v1_generated_NetworkServices_CreateMesh_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_service_binding.php b/NetworkServices/samples/V1/NetworkServicesClient/create_service_binding.php new file mode 100644 index 000000000000..406278babd24 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_service_binding.php @@ -0,0 +1,105 @@ +setName($serviceBindingName) + ->setService($serviceBindingService); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createServiceBinding( + $formattedParent, + $serviceBindingId, + $serviceBinding + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ServiceBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $serviceBindingId = '[SERVICE_BINDING_ID]'; + $serviceBindingName = '[NAME]'; + $serviceBindingService = '[SERVICE]'; + + create_service_binding_sample( + $formattedParent, + $serviceBindingId, + $serviceBindingName, + $serviceBindingService + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateServiceBinding_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_tcp_route.php b/NetworkServices/samples/V1/NetworkServicesClient/create_tcp_route.php new file mode 100644 index 000000000000..c9fa3555fcde --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_tcp_route.php @@ -0,0 +1,98 @@ +`. + */ +function create_tcp_route_sample( + string $formattedParent, + string $tcpRouteId, + string $tcpRouteName +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $tcpRouteRulesAction = new RouteAction(); + $routeRule = (new RouteRule()) + ->setAction($tcpRouteRulesAction); + $tcpRouteRules = [$routeRule,]; + $tcpRoute = (new TcpRoute()) + ->setName($tcpRouteName) + ->setRules($tcpRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createTcpRoute($formattedParent, $tcpRouteId, $tcpRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TcpRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $tcpRouteId = '[TCP_ROUTE_ID]'; + $tcpRouteName = '[NAME]'; + + create_tcp_route_sample($formattedParent, $tcpRouteId, $tcpRouteName); +} +// [END networkservices_v1_generated_NetworkServices_CreateTcpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/create_tls_route.php b/NetworkServices/samples/V1/NetworkServicesClient/create_tls_route.php new file mode 100644 index 000000000000..bb6ebbf6a796 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/create_tls_route.php @@ -0,0 +1,119 @@ +`. + * @param string $formattedTlsRouteRulesActionDestinationsServiceName The URL of a BackendService to route traffic to. Please see + * {@see NetworkServicesClient::backendServiceName()} for help formatting this field. + */ +function create_tls_route_sample( + string $formattedParent, + string $tlsRouteId, + string $tlsRouteName, + string $formattedTlsRouteRulesActionDestinationsServiceName +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $tlsRouteRulesMatches = [new RouteMatch()]; + $routeDestination = (new RouteDestination()) + ->setServiceName($formattedTlsRouteRulesActionDestinationsServiceName); + $tlsRouteRulesActionDestinations = [$routeDestination,]; + $tlsRouteRulesAction = (new RouteAction()) + ->setDestinations($tlsRouteRulesActionDestinations); + $routeRule = (new RouteRule()) + ->setMatches($tlsRouteRulesMatches) + ->setAction($tlsRouteRulesAction); + $tlsRouteRules = [$routeRule,]; + $tlsRoute = (new TlsRoute()) + ->setName($tlsRouteName) + ->setRules($tlsRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->createTlsRoute($formattedParent, $tlsRouteId, $tlsRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TlsRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + $tlsRouteId = '[TLS_ROUTE_ID]'; + $tlsRouteName = '[NAME]'; + $formattedTlsRouteRulesActionDestinationsServiceName = NetworkServicesClient::backendServiceName( + '[PROJECT]', + '[LOCATION]', + '[BACKEND_SERVICE]' + ); + + create_tls_route_sample( + $formattedParent, + $tlsRouteId, + $tlsRouteName, + $formattedTlsRouteRulesActionDestinationsServiceName + ); +} +// [END networkservices_v1_generated_NetworkServices_CreateTlsRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_endpoint_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_endpoint_policy.php new file mode 100644 index 000000000000..75a1d8ec33ca --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_endpoint_policy.php @@ -0,0 +1,80 @@ +deleteEndpointPolicy($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::endpointPolicyName( + '[PROJECT]', + '[LOCATION]', + '[ENDPOINT_POLICY]' + ); + + delete_endpoint_policy_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteEndpointPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_gateway.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_gateway.php new file mode 100644 index 000000000000..004b9523e533 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_gateway.php @@ -0,0 +1,76 @@ +deleteGateway($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + + delete_gateway_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteGateway_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_grpc_route.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_grpc_route.php new file mode 100644 index 000000000000..7c932c859d5e --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_grpc_route.php @@ -0,0 +1,76 @@ +deleteGrpcRoute($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + + delete_grpc_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteGrpcRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_http_route.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_http_route.php new file mode 100644 index 000000000000..c634d8c2e8d2 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_http_route.php @@ -0,0 +1,76 @@ +deleteHttpRoute($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + + delete_http_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteHttpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_mesh.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_mesh.php new file mode 100644 index 000000000000..b633a303aff2 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_mesh.php @@ -0,0 +1,76 @@ +deleteMesh($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + + delete_mesh_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteMesh_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_service_binding.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_service_binding.php new file mode 100644 index 000000000000..e6cfea124f1c --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_service_binding.php @@ -0,0 +1,80 @@ +deleteServiceBinding($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::serviceBindingName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE_BINDING]' + ); + + delete_service_binding_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteServiceBinding_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_tcp_route.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_tcp_route.php new file mode 100644 index 000000000000..cc696c7296e8 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_tcp_route.php @@ -0,0 +1,76 @@ +deleteTcpRoute($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + + delete_tcp_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteTcpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/delete_tls_route.php b/NetworkServices/samples/V1/NetworkServicesClient/delete_tls_route.php new file mode 100644 index 000000000000..f4ffb3b17d07 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/delete_tls_route.php @@ -0,0 +1,76 @@ +deleteTlsRoute($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + + delete_tls_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_DeleteTlsRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_endpoint_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/get_endpoint_policy.php new file mode 100644 index 000000000000..ecbec1690753 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_endpoint_policy.php @@ -0,0 +1,71 @@ +getEndpointPolicy($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::endpointPolicyName( + '[PROJECT]', + '[LOCATION]', + '[ENDPOINT_POLICY]' + ); + + get_endpoint_policy_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetEndpointPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_gateway.php b/NetworkServices/samples/V1/NetworkServicesClient/get_gateway.php new file mode 100644 index 000000000000..ca4a9a0f1d35 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_gateway.php @@ -0,0 +1,67 @@ +getGateway($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + + get_gateway_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetGateway_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_grpc_route.php b/NetworkServices/samples/V1/NetworkServicesClient/get_grpc_route.php new file mode 100644 index 000000000000..70376169c80d --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_grpc_route.php @@ -0,0 +1,67 @@ +getGrpcRoute($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + + get_grpc_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetGrpcRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_http_route.php b/NetworkServices/samples/V1/NetworkServicesClient/get_http_route.php new file mode 100644 index 000000000000..30236bfaa045 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_http_route.php @@ -0,0 +1,67 @@ +getHttpRoute($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + + get_http_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetHttpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_iam_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/get_iam_policy.php new file mode 100644 index 000000000000..940b4c0f3e6e --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_iam_policy.php @@ -0,0 +1,67 @@ +getIamPolicy($resource); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END networkservices_v1_generated_NetworkServices_GetIamPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_location.php b/NetworkServices/samples/V1/NetworkServicesClient/get_location.php new file mode 100644 index 000000000000..67e709f726c7 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END networkservices_v1_generated_NetworkServices_GetLocation_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_mesh.php b/NetworkServices/samples/V1/NetworkServicesClient/get_mesh.php new file mode 100644 index 000000000000..f41d60ac2c17 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_mesh.php @@ -0,0 +1,67 @@ +getMesh($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + + get_mesh_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetMesh_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_service_binding.php b/NetworkServices/samples/V1/NetworkServicesClient/get_service_binding.php new file mode 100644 index 000000000000..0c579cf3ba9c --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_service_binding.php @@ -0,0 +1,71 @@ +getServiceBinding($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::serviceBindingName( + '[PROJECT]', + '[LOCATION]', + '[SERVICE_BINDING]' + ); + + get_service_binding_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetServiceBinding_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_tcp_route.php b/NetworkServices/samples/V1/NetworkServicesClient/get_tcp_route.php new file mode 100644 index 000000000000..e552e73f0cfc --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_tcp_route.php @@ -0,0 +1,67 @@ +getTcpRoute($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + + get_tcp_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetTcpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/get_tls_route.php b/NetworkServices/samples/V1/NetworkServicesClient/get_tls_route.php new file mode 100644 index 000000000000..c7b20170cc5c --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/get_tls_route.php @@ -0,0 +1,67 @@ +getTlsRoute($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NetworkServicesClient::tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + + get_tls_route_sample($formattedName); +} +// [END networkservices_v1_generated_NetworkServices_GetTlsRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_endpoint_policies.php b/NetworkServices/samples/V1/NetworkServicesClient/list_endpoint_policies.php new file mode 100644 index 000000000000..8147e92ba408 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_endpoint_policies.php @@ -0,0 +1,72 @@ +listEndpointPolicies($formattedParent); + + /** @var EndpointPolicy $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_endpoint_policies_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListEndpointPolicies_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_gateways.php b/NetworkServices/samples/V1/NetworkServicesClient/list_gateways.php new file mode 100644 index 000000000000..04442a8d900b --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_gateways.php @@ -0,0 +1,72 @@ +listGateways($formattedParent); + + /** @var Gateway $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_gateways_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListGateways_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_grpc_routes.php b/NetworkServices/samples/V1/NetworkServicesClient/list_grpc_routes.php new file mode 100644 index 000000000000..e1801bbe87a9 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_grpc_routes.php @@ -0,0 +1,72 @@ +listGrpcRoutes($formattedParent); + + /** @var GrpcRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_grpc_routes_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListGrpcRoutes_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_http_routes.php b/NetworkServices/samples/V1/NetworkServicesClient/list_http_routes.php new file mode 100644 index 000000000000..a127eacc570b --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_http_routes.php @@ -0,0 +1,72 @@ +listHttpRoutes($formattedParent); + + /** @var HttpRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_http_routes_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListHttpRoutes_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_locations.php b/NetworkServices/samples/V1/NetworkServicesClient/list_locations.php new file mode 100644 index 000000000000..269d1269bf55 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END networkservices_v1_generated_NetworkServices_ListLocations_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_meshes.php b/NetworkServices/samples/V1/NetworkServicesClient/list_meshes.php new file mode 100644 index 000000000000..35dfeecd85b3 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_meshes.php @@ -0,0 +1,72 @@ +listMeshes($formattedParent); + + /** @var Mesh $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_meshes_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListMeshes_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_service_bindings.php b/NetworkServices/samples/V1/NetworkServicesClient/list_service_bindings.php new file mode 100644 index 000000000000..28e98b073bee --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_service_bindings.php @@ -0,0 +1,72 @@ +listServiceBindings($formattedParent); + + /** @var ServiceBinding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_service_bindings_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListServiceBindings_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_tcp_routes.php b/NetworkServices/samples/V1/NetworkServicesClient/list_tcp_routes.php new file mode 100644 index 000000000000..fdf7e2714912 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_tcp_routes.php @@ -0,0 +1,72 @@ +listTcpRoutes($formattedParent); + + /** @var TcpRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_tcp_routes_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListTcpRoutes_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/list_tls_routes.php b/NetworkServices/samples/V1/NetworkServicesClient/list_tls_routes.php new file mode 100644 index 000000000000..209d60ded156 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/list_tls_routes.php @@ -0,0 +1,72 @@ +listTlsRoutes($formattedParent); + + /** @var TlsRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NetworkServicesClient::locationName('[PROJECT]', '[LOCATION]'); + + list_tls_routes_sample($formattedParent); +} +// [END networkservices_v1_generated_NetworkServices_ListTlsRoutes_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/set_iam_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/set_iam_policy.php new file mode 100644 index 000000000000..9650d9511d36 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/set_iam_policy.php @@ -0,0 +1,73 @@ +setIamPolicy($resource, $policy); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END networkservices_v1_generated_NetworkServices_SetIamPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/test_iam_permissions.php b/NetworkServices/samples/V1/NetworkServicesClient/test_iam_permissions.php new file mode 100644 index 000000000000..d5cbc0435ed6 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/test_iam_permissions.php @@ -0,0 +1,80 @@ +testIamPermissions($resource, $permissions); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END networkservices_v1_generated_NetworkServices_TestIamPermissions_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_endpoint_policy.php b/NetworkServices/samples/V1/NetworkServicesClient/update_endpoint_policy.php new file mode 100644 index 000000000000..c8af2b89d13d --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_endpoint_policy.php @@ -0,0 +1,90 @@ +setName($endpointPolicyName) + ->setType($endpointPolicyType) + ->setEndpointMatcher($endpointPolicyEndpointMatcher); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateEndpointPolicy($endpointPolicy); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var EndpointPolicy $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $endpointPolicyName = '[NAME]'; + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + + update_endpoint_policy_sample($endpointPolicyName, $endpointPolicyType); +} +// [END networkservices_v1_generated_NetworkServices_UpdateEndpointPolicy_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_gateway.php b/NetworkServices/samples/V1/NetworkServicesClient/update_gateway.php new file mode 100644 index 000000000000..a14c29803888 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_gateway.php @@ -0,0 +1,101 @@ +`. + * @param int $gatewayPortsElement One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * @param string $gatewayScope Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + */ +function update_gateway_sample( + string $gatewayName, + int $gatewayPortsElement, + string $gatewayScope +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $gatewayPorts = [$gatewayPortsElement,]; + $gateway = (new Gateway()) + ->setName($gatewayName) + ->setPorts($gatewayPorts) + ->setScope($gatewayScope); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateGateway($gateway); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Gateway $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $gatewayName = '[NAME]'; + $gatewayPortsElement = 0; + $gatewayScope = '[SCOPE]'; + + update_gateway_sample($gatewayName, $gatewayPortsElement, $gatewayScope); +} +// [END networkservices_v1_generated_NetworkServices_UpdateGateway_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_grpc_route.php b/NetworkServices/samples/V1/NetworkServicesClient/update_grpc_route.php new file mode 100644 index 000000000000..7f46e6d62d3e --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_grpc_route.php @@ -0,0 +1,123 @@ +` + * @param string $grpcRouteHostnamesElement Service hostnames with an optional port for which this route + * describes traffic. + * + * Format: [:] + * + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + */ +function update_grpc_route_sample(string $grpcRouteName, string $grpcRouteHostnamesElement): void +{ + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $grpcRouteHostnames = [$grpcRouteHostnamesElement,]; + $grpcRouteRulesAction = new RouteAction(); + $routeRule = (new RouteRule()) + ->setAction($grpcRouteRulesAction); + $grpcRouteRules = [$routeRule,]; + $grpcRoute = (new GrpcRoute()) + ->setName($grpcRouteName) + ->setHostnames($grpcRouteHostnames) + ->setRules($grpcRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateGrpcRoute($grpcRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var GrpcRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $grpcRouteName = '[NAME]'; + $grpcRouteHostnamesElement = '[HOSTNAMES]'; + + update_grpc_route_sample($grpcRouteName, $grpcRouteHostnamesElement); +} +// [END networkservices_v1_generated_NetworkServices_UpdateGrpcRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_http_route.php b/NetworkServices/samples/V1/NetworkServicesClient/update_http_route.php new file mode 100644 index 000000000000..3608abfb0134 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_http_route.php @@ -0,0 +1,112 @@ +`. + * @param string $httpRouteHostnamesElement Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + */ +function update_http_route_sample(string $httpRouteName, string $httpRouteHostnamesElement): void +{ + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $httpRouteHostnames = [$httpRouteHostnamesElement,]; + $httpRouteRules = [new RouteRule()]; + $httpRoute = (new HttpRoute()) + ->setName($httpRouteName) + ->setHostnames($httpRouteHostnames) + ->setRules($httpRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateHttpRoute($httpRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var HttpRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $httpRouteName = '[NAME]'; + $httpRouteHostnamesElement = '[HOSTNAMES]'; + + update_http_route_sample($httpRouteName, $httpRouteHostnamesElement); +} +// [END networkservices_v1_generated_NetworkServices_UpdateHttpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_mesh.php b/NetworkServices/samples/V1/NetworkServicesClient/update_mesh.php new file mode 100644 index 000000000000..faea526d27ad --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_mesh.php @@ -0,0 +1,82 @@ +`. + */ +function update_mesh_sample(string $meshName): void +{ + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $mesh = (new Mesh()) + ->setName($meshName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateMesh($mesh); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Mesh $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $meshName = '[NAME]'; + + update_mesh_sample($meshName); +} +// [END networkservices_v1_generated_NetworkServices_UpdateMesh_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_tcp_route.php b/NetworkServices/samples/V1/NetworkServicesClient/update_tcp_route.php new file mode 100644 index 000000000000..a68a27818f9e --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_tcp_route.php @@ -0,0 +1,89 @@ +`. + */ +function update_tcp_route_sample(string $tcpRouteName): void +{ + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $tcpRouteRulesAction = new RouteAction(); + $routeRule = (new RouteRule()) + ->setAction($tcpRouteRulesAction); + $tcpRouteRules = [$routeRule,]; + $tcpRoute = (new TcpRoute()) + ->setName($tcpRouteName) + ->setRules($tcpRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateTcpRoute($tcpRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TcpRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $tcpRouteName = '[NAME]'; + + update_tcp_route_sample($tcpRouteName); +} +// [END networkservices_v1_generated_NetworkServices_UpdateTcpRoute_sync] diff --git a/NetworkServices/samples/V1/NetworkServicesClient/update_tls_route.php b/NetworkServices/samples/V1/NetworkServicesClient/update_tls_route.php new file mode 100644 index 000000000000..563f4a423ea7 --- /dev/null +++ b/NetworkServices/samples/V1/NetworkServicesClient/update_tls_route.php @@ -0,0 +1,106 @@ +`. + * @param string $formattedTlsRouteRulesActionDestinationsServiceName The URL of a BackendService to route traffic to. Please see + * {@see NetworkServicesClient::backendServiceName()} for help formatting this field. + */ +function update_tls_route_sample( + string $tlsRouteName, + string $formattedTlsRouteRulesActionDestinationsServiceName +): void { + // Create a client. + $networkServicesClient = new NetworkServicesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $tlsRouteRulesMatches = [new RouteMatch()]; + $routeDestination = (new RouteDestination()) + ->setServiceName($formattedTlsRouteRulesActionDestinationsServiceName); + $tlsRouteRulesActionDestinations = [$routeDestination,]; + $tlsRouteRulesAction = (new RouteAction()) + ->setDestinations($tlsRouteRulesActionDestinations); + $routeRule = (new RouteRule()) + ->setMatches($tlsRouteRulesMatches) + ->setAction($tlsRouteRulesAction); + $tlsRouteRules = [$routeRule,]; + $tlsRoute = (new TlsRoute()) + ->setName($tlsRouteName) + ->setRules($tlsRouteRules); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $networkServicesClient->updateTlsRoute($tlsRoute); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TlsRoute $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $tlsRouteName = '[NAME]'; + $formattedTlsRouteRulesActionDestinationsServiceName = NetworkServicesClient::backendServiceName( + '[PROJECT]', + '[LOCATION]', + '[BACKEND_SERVICE]' + ); + + update_tls_route_sample($tlsRouteName, $formattedTlsRouteRulesActionDestinationsServiceName); +} +// [END networkservices_v1_generated_NetworkServices_UpdateTlsRoute_sync] diff --git a/NetworkServices/src/V1/CreateEndpointPolicyRequest.php b/NetworkServices/src/V1/CreateEndpointPolicyRequest.php new file mode 100644 index 000000000000..c6dfd22a5f8c --- /dev/null +++ b/NetworkServices/src/V1/CreateEndpointPolicyRequest.php @@ -0,0 +1,153 @@ +google.cloud.networkservices.v1.CreateEndpointPolicyRequest + */ +class CreateEndpointPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the EndpointPolicy. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the EndpointPolicy resource to be created. + * E.g. "CustomECS". + * + * Generated from protobuf field string endpoint_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint_policy_id = ''; + /** + * Required. EndpointPolicy resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the EndpointPolicy. Must be in the + * format `projects/*/locations/global`. + * @type string $endpoint_policy_id + * Required. Short name of the EndpointPolicy resource to be created. + * E.g. "CustomECS". + * @type \Google\Cloud\NetworkServices\V1\EndpointPolicy $endpoint_policy + * Required. EndpointPolicy resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the EndpointPolicy. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the EndpointPolicy. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the EndpointPolicy resource to be created. + * E.g. "CustomECS". + * + * Generated from protobuf field string endpoint_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEndpointPolicyId() + { + return $this->endpoint_policy_id; + } + + /** + * Required. Short name of the EndpointPolicy resource to be created. + * E.g. "CustomECS". + * + * Generated from protobuf field string endpoint_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEndpointPolicyId($var) + { + GPBUtil::checkString($var, True); + $this->endpoint_policy_id = $var; + + return $this; + } + + /** + * Required. EndpointPolicy resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\EndpointPolicy|null + */ + public function getEndpointPolicy() + { + return $this->endpoint_policy; + } + + public function hasEndpointPolicy() + { + return isset($this->endpoint_policy); + } + + public function clearEndpointPolicy() + { + unset($this->endpoint_policy); + } + + /** + * Required. EndpointPolicy resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\EndpointPolicy $var + * @return $this + */ + public function setEndpointPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\EndpointPolicy::class); + $this->endpoint_policy = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateGatewayRequest.php b/NetworkServices/src/V1/CreateGatewayRequest.php new file mode 100644 index 000000000000..6f322da461a6 --- /dev/null +++ b/NetworkServices/src/V1/CreateGatewayRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateGatewayRequest + */ +class CreateGatewayRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the Gateway. Must be in the + * format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the Gateway resource to be created. + * + * Generated from protobuf field string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $gateway_id = ''; + /** + * Required. Gateway resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $gateway = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the Gateway. Must be in the + * format `projects/*/locations/*`. + * @type string $gateway_id + * Required. Short name of the Gateway resource to be created. + * @type \Google\Cloud\NetworkServices\V1\Gateway $gateway + * Required. Gateway resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the Gateway. Must be in the + * format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the Gateway. Must be in the + * format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the Gateway resource to be created. + * + * Generated from protobuf field string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGatewayId() + { + return $this->gateway_id; + } + + /** + * Required. Short name of the Gateway resource to be created. + * + * Generated from protobuf field string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGatewayId($var) + { + GPBUtil::checkString($var, True); + $this->gateway_id = $var; + + return $this; + } + + /** + * Required. Gateway resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\Gateway|null + */ + public function getGateway() + { + return $this->gateway; + } + + public function hasGateway() + { + return isset($this->gateway); + } + + public function clearGateway() + { + unset($this->gateway); + } + + /** + * Required. Gateway resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\Gateway $var + * @return $this + */ + public function setGateway($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\Gateway::class); + $this->gateway = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateGrpcRouteRequest.php b/NetworkServices/src/V1/CreateGrpcRouteRequest.php new file mode 100644 index 000000000000..cf754379ca47 --- /dev/null +++ b/NetworkServices/src/V1/CreateGrpcRouteRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateGrpcRouteRequest + */ +class CreateGrpcRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the GrpcRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the GrpcRoute resource to be created. + * + * Generated from protobuf field string grpc_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $grpc_route_id = ''; + /** + * Required. GrpcRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $grpc_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the GrpcRoute. Must be in the + * format `projects/*/locations/global`. + * @type string $grpc_route_id + * Required. Short name of the GrpcRoute resource to be created. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute $grpc_route + * Required. GrpcRoute resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the GrpcRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the GrpcRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the GrpcRoute resource to be created. + * + * Generated from protobuf field string grpc_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGrpcRouteId() + { + return $this->grpc_route_id; + } + + /** + * Required. Short name of the GrpcRoute resource to be created. + * + * Generated from protobuf field string grpc_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGrpcRouteId($var) + { + GPBUtil::checkString($var, True); + $this->grpc_route_id = $var; + + return $this; + } + + /** + * Required. GrpcRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute|null + */ + public function getGrpcRoute() + { + return $this->grpc_route; + } + + public function hasGrpcRoute() + { + return isset($this->grpc_route); + } + + public function clearGrpcRoute() + { + unset($this->grpc_route); + } + + /** + * Required. GrpcRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute $var + * @return $this + */ + public function setGrpcRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute::class); + $this->grpc_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateHttpRouteRequest.php b/NetworkServices/src/V1/CreateHttpRouteRequest.php new file mode 100644 index 000000000000..a14312ab5e4a --- /dev/null +++ b/NetworkServices/src/V1/CreateHttpRouteRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateHttpRouteRequest + */ +class CreateHttpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the HttpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the HttpRoute resource to be created. + * + * Generated from protobuf field string http_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $http_route_id = ''; + /** + * Required. HttpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $http_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the HttpRoute. Must be in the + * format `projects/*/locations/global`. + * @type string $http_route_id + * Required. Short name of the HttpRoute resource to be created. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute $http_route + * Required. HttpRoute resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the HttpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the HttpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the HttpRoute resource to be created. + * + * Generated from protobuf field string http_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getHttpRouteId() + { + return $this->http_route_id; + } + + /** + * Required. Short name of the HttpRoute resource to be created. + * + * Generated from protobuf field string http_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setHttpRouteId($var) + { + GPBUtil::checkString($var, True); + $this->http_route_id = $var; + + return $this; + } + + /** + * Required. HttpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute|null + */ + public function getHttpRoute() + { + return $this->http_route; + } + + public function hasHttpRoute() + { + return isset($this->http_route); + } + + public function clearHttpRoute() + { + unset($this->http_route); + } + + /** + * Required. HttpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute $var + * @return $this + */ + public function setHttpRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute::class); + $this->http_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateLbRouteExtensionRequest.php b/NetworkServices/src/V1/CreateLbRouteExtensionRequest.php new file mode 100644 index 000000000000..b4d77055dfb2 --- /dev/null +++ b/NetworkServices/src/V1/CreateLbRouteExtensionRequest.php @@ -0,0 +1,227 @@ +google.cloud.networkservices.v1.CreateLbRouteExtensionRequest + */ +class CreateLbRouteExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the `LbRouteExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. User-provided ID of the `LbRouteExtension` resource to be + * created. + * + * Generated from protobuf field string lb_route_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_route_extension_id = ''; + /** + * Required. `LbRouteExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_route_extension = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the `LbRouteExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * @type string $lb_route_extension_id + * Required. User-provided ID of the `LbRouteExtension` resource to be + * created. + * @type \Google\Cloud\NetworkServices\V1\LbRouteExtension $lb_route_extension + * Required. `LbRouteExtension` resource to be created. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the `LbRouteExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the `LbRouteExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. User-provided ID of the `LbRouteExtension` resource to be + * created. + * + * Generated from protobuf field string lb_route_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLbRouteExtensionId() + { + return $this->lb_route_extension_id; + } + + /** + * Required. User-provided ID of the `LbRouteExtension` resource to be + * created. + * + * Generated from protobuf field string lb_route_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLbRouteExtensionId($var) + { + GPBUtil::checkString($var, True); + $this->lb_route_extension_id = $var; + + return $this; + } + + /** + * Required. `LbRouteExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\LbRouteExtension|null + */ + public function getLbRouteExtension() + { + return $this->lb_route_extension; + } + + public function hasLbRouteExtension() + { + return isset($this->lb_route_extension); + } + + public function clearLbRouteExtension() + { + unset($this->lb_route_extension); + } + + /** + * Required. `LbRouteExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\LbRouteExtension $var + * @return $this + */ + public function setLbRouteExtension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\LbRouteExtension::class); + $this->lb_route_extension = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateLbTrafficExtensionRequest.php b/NetworkServices/src/V1/CreateLbTrafficExtensionRequest.php new file mode 100644 index 000000000000..d22d3c89205c --- /dev/null +++ b/NetworkServices/src/V1/CreateLbTrafficExtensionRequest.php @@ -0,0 +1,227 @@ +google.cloud.networkservices.v1.CreateLbTrafficExtensionRequest + */ +class CreateLbTrafficExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the `LbTrafficExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. User-provided ID of the `LbTrafficExtension` resource to be + * created. + * + * Generated from protobuf field string lb_traffic_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_traffic_extension_id = ''; + /** + * Required. `LbTrafficExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_traffic_extension = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the `LbTrafficExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * @type string $lb_traffic_extension_id + * Required. User-provided ID of the `LbTrafficExtension` resource to be + * created. + * @type \Google\Cloud\NetworkServices\V1\LbTrafficExtension $lb_traffic_extension + * Required. `LbTrafficExtension` resource to be created. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the `LbTrafficExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the `LbTrafficExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. User-provided ID of the `LbTrafficExtension` resource to be + * created. + * + * Generated from protobuf field string lb_traffic_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLbTrafficExtensionId() + { + return $this->lb_traffic_extension_id; + } + + /** + * Required. User-provided ID of the `LbTrafficExtension` resource to be + * created. + * + * Generated from protobuf field string lb_traffic_extension_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLbTrafficExtensionId($var) + { + GPBUtil::checkString($var, True); + $this->lb_traffic_extension_id = $var; + + return $this; + } + + /** + * Required. `LbTrafficExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\LbTrafficExtension|null + */ + public function getLbTrafficExtension() + { + return $this->lb_traffic_extension; + } + + public function hasLbTrafficExtension() + { + return isset($this->lb_traffic_extension); + } + + public function clearLbTrafficExtension() + { + unset($this->lb_traffic_extension); + } + + /** + * Required. `LbTrafficExtension` resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\LbTrafficExtension $var + * @return $this + */ + public function setLbTrafficExtension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\LbTrafficExtension::class); + $this->lb_traffic_extension = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateMeshRequest.php b/NetworkServices/src/V1/CreateMeshRequest.php new file mode 100644 index 000000000000..b563e82b165d --- /dev/null +++ b/NetworkServices/src/V1/CreateMeshRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateMeshRequest + */ +class CreateMeshRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the Mesh. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the Mesh resource to be created. + * + * Generated from protobuf field string mesh_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $mesh_id = ''; + /** + * Required. Mesh resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $mesh = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the Mesh. Must be in the + * format `projects/*/locations/global`. + * @type string $mesh_id + * Required. Short name of the Mesh resource to be created. + * @type \Google\Cloud\NetworkServices\V1\Mesh $mesh + * Required. Mesh resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the Mesh. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the Mesh. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the Mesh resource to be created. + * + * Generated from protobuf field string mesh_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMeshId() + { + return $this->mesh_id; + } + + /** + * Required. Short name of the Mesh resource to be created. + * + * Generated from protobuf field string mesh_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMeshId($var) + { + GPBUtil::checkString($var, True); + $this->mesh_id = $var; + + return $this; + } + + /** + * Required. Mesh resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\Mesh|null + */ + public function getMesh() + { + return $this->mesh; + } + + public function hasMesh() + { + return isset($this->mesh); + } + + public function clearMesh() + { + unset($this->mesh); + } + + /** + * Required. Mesh resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\Mesh $var + * @return $this + */ + public function setMesh($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\Mesh::class); + $this->mesh = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateServiceBindingRequest.php b/NetworkServices/src/V1/CreateServiceBindingRequest.php new file mode 100644 index 000000000000..1f35c7a500e5 --- /dev/null +++ b/NetworkServices/src/V1/CreateServiceBindingRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateServiceBindingRequest + */ +class CreateServiceBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the ServiceBinding. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the ServiceBinding resource to be created. + * + * Generated from protobuf field string service_binding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_binding_id = ''; + /** + * Required. ServiceBinding resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ServiceBinding service_binding = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_binding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the ServiceBinding. Must be in the + * format `projects/*/locations/global`. + * @type string $service_binding_id + * Required. Short name of the ServiceBinding resource to be created. + * @type \Google\Cloud\NetworkServices\V1\ServiceBinding $service_binding + * Required. ServiceBinding resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the ServiceBinding. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the ServiceBinding. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the ServiceBinding resource to be created. + * + * Generated from protobuf field string service_binding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceBindingId() + { + return $this->service_binding_id; + } + + /** + * Required. Short name of the ServiceBinding resource to be created. + * + * Generated from protobuf field string service_binding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceBindingId($var) + { + GPBUtil::checkString($var, True); + $this->service_binding_id = $var; + + return $this; + } + + /** + * Required. ServiceBinding resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ServiceBinding service_binding = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\ServiceBinding|null + */ + public function getServiceBinding() + { + return $this->service_binding; + } + + public function hasServiceBinding() + { + return isset($this->service_binding); + } + + public function clearServiceBinding() + { + unset($this->service_binding); + } + + /** + * Required. ServiceBinding resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ServiceBinding service_binding = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\ServiceBinding $var + * @return $this + */ + public function setServiceBinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\ServiceBinding::class); + $this->service_binding = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateTcpRouteRequest.php b/NetworkServices/src/V1/CreateTcpRouteRequest.php new file mode 100644 index 000000000000..77daad17011e --- /dev/null +++ b/NetworkServices/src/V1/CreateTcpRouteRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateTcpRouteRequest + */ +class CreateTcpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the TcpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the TcpRoute resource to be created. + * + * Generated from protobuf field string tcp_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tcp_route_id = ''; + /** + * Required. TcpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tcp_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the TcpRoute. Must be in the + * format `projects/*/locations/global`. + * @type string $tcp_route_id + * Required. Short name of the TcpRoute resource to be created. + * @type \Google\Cloud\NetworkServices\V1\TcpRoute $tcp_route + * Required. TcpRoute resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the TcpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the TcpRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the TcpRoute resource to be created. + * + * Generated from protobuf field string tcp_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTcpRouteId() + { + return $this->tcp_route_id; + } + + /** + * Required. Short name of the TcpRoute resource to be created. + * + * Generated from protobuf field string tcp_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTcpRouteId($var) + { + GPBUtil::checkString($var, True); + $this->tcp_route_id = $var; + + return $this; + } + + /** + * Required. TcpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TcpRoute|null + */ + public function getTcpRoute() + { + return $this->tcp_route; + } + + public function hasTcpRoute() + { + return isset($this->tcp_route); + } + + public function clearTcpRoute() + { + unset($this->tcp_route); + } + + /** + * Required. TcpRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TcpRoute $var + * @return $this + */ + public function setTcpRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TcpRoute::class); + $this->tcp_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/CreateTlsRouteRequest.php b/NetworkServices/src/V1/CreateTlsRouteRequest.php new file mode 100644 index 000000000000..3b8efdfc7adb --- /dev/null +++ b/NetworkServices/src/V1/CreateTlsRouteRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.CreateTlsRouteRequest + */ +class CreateTlsRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource of the TlsRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Short name of the TlsRoute resource to be created. + * + * Generated from protobuf field string tls_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tls_route_id = ''; + /** + * Required. TlsRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tls_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource of the TlsRoute. Must be in the + * format `projects/*/locations/global`. + * @type string $tls_route_id + * Required. Short name of the TlsRoute resource to be created. + * @type \Google\Cloud\NetworkServices\V1\TlsRoute $tls_route + * Required. TlsRoute resource to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource of the TlsRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource of the TlsRoute. Must be in the + * format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Short name of the TlsRoute resource to be created. + * + * Generated from protobuf field string tls_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTlsRouteId() + { + return $this->tls_route_id; + } + + /** + * Required. Short name of the TlsRoute resource to be created. + * + * Generated from protobuf field string tls_route_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTlsRouteId($var) + { + GPBUtil::checkString($var, True); + $this->tls_route_id = $var; + + return $this; + } + + /** + * Required. TlsRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TlsRoute|null + */ + public function getTlsRoute() + { + return $this->tls_route; + } + + public function hasTlsRoute() + { + return isset($this->tls_route); + } + + public function clearTlsRoute() + { + unset($this->tls_route); + } + + /** + * Required. TlsRoute resource to be created. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TlsRoute $var + * @return $this + */ + public function setTlsRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TlsRoute::class); + $this->tls_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteEndpointPolicyRequest.php b/NetworkServices/src/V1/DeleteEndpointPolicyRequest.php new file mode 100644 index 000000000000..67da0d66c369 --- /dev/null +++ b/NetworkServices/src/V1/DeleteEndpointPolicyRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteEndpointPolicyRequest + */ +class DeleteEndpointPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the EndpointPolicy to delete. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the EndpointPolicy to delete. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the EndpointPolicy to delete. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the EndpointPolicy to delete. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteGatewayRequest.php b/NetworkServices/src/V1/DeleteGatewayRequest.php new file mode 100644 index 000000000000..a476f6e4aada --- /dev/null +++ b/NetworkServices/src/V1/DeleteGatewayRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteGatewayRequest + */ +class DeleteGatewayRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the Gateway to delete. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the Gateway to delete. Must be in the format + * `projects/*/locations/*/gateways/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the Gateway to delete. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the Gateway to delete. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteGrpcRouteRequest.php b/NetworkServices/src/V1/DeleteGrpcRouteRequest.php new file mode 100644 index 000000000000..b39a2e36f98b --- /dev/null +++ b/NetworkServices/src/V1/DeleteGrpcRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteGrpcRouteRequest + */ +class DeleteGrpcRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the GrpcRoute to delete. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the GrpcRoute to delete. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the GrpcRoute to delete. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the GrpcRoute to delete. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteHttpRouteRequest.php b/NetworkServices/src/V1/DeleteHttpRouteRequest.php new file mode 100644 index 000000000000..ece4a3988fdd --- /dev/null +++ b/NetworkServices/src/V1/DeleteHttpRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteHttpRouteRequest + */ +class DeleteHttpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the HttpRoute to delete. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the HttpRoute to delete. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the HttpRoute to delete. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the HttpRoute to delete. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteLbRouteExtensionRequest.php b/NetworkServices/src/V1/DeleteLbRouteExtensionRequest.php new file mode 100644 index 000000000000..c85d32350f47 --- /dev/null +++ b/NetworkServices/src/V1/DeleteLbRouteExtensionRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.DeleteLbRouteExtensionRequest + */ +class DeleteLbRouteExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the `LbRouteExtension` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the `LbRouteExtension` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the `LbRouteExtension` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the `LbRouteExtension` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteLbTrafficExtensionRequest.php b/NetworkServices/src/V1/DeleteLbTrafficExtensionRequest.php new file mode 100644 index 000000000000..37b363179f7f --- /dev/null +++ b/NetworkServices/src/V1/DeleteLbTrafficExtensionRequest.php @@ -0,0 +1,149 @@ +google.cloud.networkservices.v1.DeleteLbTrafficExtensionRequest + */ +class DeleteLbTrafficExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the `LbTrafficExtension` resource to delete. Must be + * in the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the `LbTrafficExtension` resource to delete. Must be + * in the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the `LbTrafficExtension` resource to delete. Must be + * in the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the `LbTrafficExtension` resource to delete. Must be + * in the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteMeshRequest.php b/NetworkServices/src/V1/DeleteMeshRequest.php new file mode 100644 index 000000000000..04581c6f16d5 --- /dev/null +++ b/NetworkServices/src/V1/DeleteMeshRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteMeshRequest + */ +class DeleteMeshRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the Mesh to delete. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the Mesh to delete. Must be in the format + * `projects/*/locations/global/meshes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the Mesh to delete. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the Mesh to delete. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteServiceBindingRequest.php b/NetworkServices/src/V1/DeleteServiceBindingRequest.php new file mode 100644 index 000000000000..b7c9e7b99b11 --- /dev/null +++ b/NetworkServices/src/V1/DeleteServiceBindingRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteServiceBindingRequest + */ +class DeleteServiceBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the ServiceBinding to delete. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the ServiceBinding to delete. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the ServiceBinding to delete. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the ServiceBinding to delete. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteTcpRouteRequest.php b/NetworkServices/src/V1/DeleteTcpRouteRequest.php new file mode 100644 index 000000000000..c22688511054 --- /dev/null +++ b/NetworkServices/src/V1/DeleteTcpRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteTcpRouteRequest + */ +class DeleteTcpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the TcpRoute to delete. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the TcpRoute to delete. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the TcpRoute to delete. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the TcpRoute to delete. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DeleteTlsRouteRequest.php b/NetworkServices/src/V1/DeleteTlsRouteRequest.php new file mode 100644 index 000000000000..2d3eaffd3ac1 --- /dev/null +++ b/NetworkServices/src/V1/DeleteTlsRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.DeleteTlsRouteRequest + */ +class DeleteTlsRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the TlsRoute to delete. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the TlsRoute to delete. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the TlsRoute to delete. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the TlsRoute to delete. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/DepServiceClient.php b/NetworkServices/src/V1/DepServiceClient.php new file mode 100644 index 000000000000..f0542ec40f33 --- /dev/null +++ b/NetworkServices/src/V1/DepServiceClient.php @@ -0,0 +1,34 @@ +google.cloud.networkservices.v1.EndpointMatcher + */ +class EndpointMatcher extends \Google\Protobuf\Internal\Message +{ + protected $matcher_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher $metadata_label_matcher + * The matcher is based on node metadata presented by xDS clients. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The matcher is based on node metadata presented by xDS clients. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher metadata_label_matcher = 1; + * @return \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher|null + */ + public function getMetadataLabelMatcher() + { + return $this->readOneof(1); + } + + public function hasMetadataLabelMatcher() + { + return $this->hasOneof(1); + } + + /** + * The matcher is based on node metadata presented by xDS clients. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher metadata_label_matcher = 1; + * @param \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher $var + * @return $this + */ + public function setMetadataLabelMatcher($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getMatcherType() + { + return $this->whichOneof("matcher_type"); + } + +} + diff --git a/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher.php b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher.php new file mode 100644 index 000000000000..d6ad89414ba5 --- /dev/null +++ b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher.php @@ -0,0 +1,194 @@ +google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher + */ +class MetadataLabelMatcher extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies how matching should be done. + * Supported values are: + * MATCH_ANY: At least one of the Labels specified in the + * matcher should match the metadata presented by xDS client. + * MATCH_ALL: The metadata presented by the xDS client should + * contain all of the labels specified here. + * The selection is determined based on the best match. For + * example, suppose there are three EndpointPolicy + * resources P1, P2 and P3 and if P1 has a the matcher as + * MATCH_ANY , P2 has MATCH_ALL , and P3 has + * MATCH_ALL . + * If a client with label connects, the config from P1 + * will be selected. + * If a client with label connects, the config from P2 + * will be selected. + * If a client with label connects, the config + * from P3 will be selected. + * If there is more than one best match, (for example, if a + * config P4 with selector exists and if a client with + * label connects), an error will be thrown. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria metadata_label_match_criteria = 1; + */ + protected $metadata_label_match_criteria = 0; + /** + * The list of label value pairs that must match labels in the + * provided metadata based on filterMatchCriteria This list can + * have at most 64 entries. The list can be empty if the match + * criteria is MATCH_ANY, to specify a wildcard match (i.e this + * matches any client). + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels metadata_labels = 2; + */ + private $metadata_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $metadata_label_match_criteria + * Specifies how matching should be done. + * Supported values are: + * MATCH_ANY: At least one of the Labels specified in the + * matcher should match the metadata presented by xDS client. + * MATCH_ALL: The metadata presented by the xDS client should + * contain all of the labels specified here. + * The selection is determined based on the best match. For + * example, suppose there are three EndpointPolicy + * resources P1, P2 and P3 and if P1 has a the matcher as + * MATCH_ANY , P2 has MATCH_ALL , and P3 has + * MATCH_ALL . + * If a client with label connects, the config from P1 + * will be selected. + * If a client with label connects, the config from P2 + * will be selected. + * If a client with label connects, the config + * from P3 will be selected. + * If there is more than one best match, (for example, if a + * config P4 with selector exists and if a client with + * label connects), an error will be thrown. + * @type array<\Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher\MetadataLabels>|\Google\Protobuf\Internal\RepeatedField $metadata_labels + * The list of label value pairs that must match labels in the + * provided metadata based on filterMatchCriteria This list can + * have at most 64 entries. The list can be empty if the match + * criteria is MATCH_ANY, to specify a wildcard match (i.e this + * matches any client). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Specifies how matching should be done. + * Supported values are: + * MATCH_ANY: At least one of the Labels specified in the + * matcher should match the metadata presented by xDS client. + * MATCH_ALL: The metadata presented by the xDS client should + * contain all of the labels specified here. + * The selection is determined based on the best match. For + * example, suppose there are three EndpointPolicy + * resources P1, P2 and P3 and if P1 has a the matcher as + * MATCH_ANY , P2 has MATCH_ALL , and P3 has + * MATCH_ALL . + * If a client with label connects, the config from P1 + * will be selected. + * If a client with label connects, the config from P2 + * will be selected. + * If a client with label connects, the config + * from P3 will be selected. + * If there is more than one best match, (for example, if a + * config P4 with selector exists and if a client with + * label connects), an error will be thrown. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria metadata_label_match_criteria = 1; + * @return int + */ + public function getMetadataLabelMatchCriteria() + { + return $this->metadata_label_match_criteria; + } + + /** + * Specifies how matching should be done. + * Supported values are: + * MATCH_ANY: At least one of the Labels specified in the + * matcher should match the metadata presented by xDS client. + * MATCH_ALL: The metadata presented by the xDS client should + * contain all of the labels specified here. + * The selection is determined based on the best match. For + * example, suppose there are three EndpointPolicy + * resources P1, P2 and P3 and if P1 has a the matcher as + * MATCH_ANY , P2 has MATCH_ALL , and P3 has + * MATCH_ALL . + * If a client with label connects, the config from P1 + * will be selected. + * If a client with label connects, the config from P2 + * will be selected. + * If a client with label connects, the config + * from P3 will be selected. + * If there is more than one best match, (for example, if a + * config P4 with selector exists and if a client with + * label connects), an error will be thrown. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria metadata_label_match_criteria = 1; + * @param int $var + * @return $this + */ + public function setMetadataLabelMatchCriteria($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher\MetadataLabelMatchCriteria::class); + $this->metadata_label_match_criteria = $var; + + return $this; + } + + /** + * The list of label value pairs that must match labels in the + * provided metadata based on filterMatchCriteria This list can + * have at most 64 entries. The list can be empty if the match + * criteria is MATCH_ANY, to specify a wildcard match (i.e this + * matches any client). + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels metadata_labels = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetadataLabels() + { + return $this->metadata_labels; + } + + /** + * The list of label value pairs that must match labels in the + * provided metadata based on filterMatchCriteria This list can + * have at most 64 entries. The list can be empty if the match + * criteria is MATCH_ANY, to specify a wildcard match (i.e this + * matches any client). + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels metadata_labels = 2; + * @param array<\Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher\MetadataLabels>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetadataLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher\MetadataLabels::class); + $this->metadata_labels = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabelMatchCriteria.php b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabelMatchCriteria.php new file mode 100644 index 000000000000..fef45bd409e1 --- /dev/null +++ b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabelMatchCriteria.php @@ -0,0 +1,64 @@ +google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria + */ +class MetadataLabelMatchCriteria +{ + /** + * Default value. Should not be used. + * + * Generated from protobuf enum METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED = 0; + */ + const METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED = 0; + /** + * At least one of the Labels specified in the matcher should match the + * metadata presented by xDS client. + * + * Generated from protobuf enum MATCH_ANY = 1; + */ + const MATCH_ANY = 1; + /** + * The metadata presented by the xDS client should contain all of the + * labels specified here. + * + * Generated from protobuf enum MATCH_ALL = 2; + */ + const MATCH_ALL = 2; + + private static $valueToName = [ + self::METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED => 'METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED', + self::MATCH_ANY => 'MATCH_ANY', + self::MATCH_ALL => 'MATCH_ALL', + ]; + + 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/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabels.php b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabels.php new file mode 100644 index 000000000000..3d690c287146 --- /dev/null +++ b/NetworkServices/src/V1/EndpointMatcher/MetadataLabelMatcher/MetadataLabels.php @@ -0,0 +1,106 @@ +google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels + */ +class MetadataLabels extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Label name presented as key in xDS Node Metadata. + * + * Generated from protobuf field string label_name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $label_name = ''; + /** + * Required. Label value presented as value corresponding to the above + * key, in xDS Node Metadata. + * + * Generated from protobuf field string label_value = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $label_value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $label_name + * Required. Label name presented as key in xDS Node Metadata. + * @type string $label_value + * Required. Label value presented as value corresponding to the above + * key, in xDS Node Metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. Label name presented as key in xDS Node Metadata. + * + * Generated from protobuf field string label_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLabelName() + { + return $this->label_name; + } + + /** + * Required. Label name presented as key in xDS Node Metadata. + * + * Generated from protobuf field string label_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLabelName($var) + { + GPBUtil::checkString($var, True); + $this->label_name = $var; + + return $this; + } + + /** + * Required. Label value presented as value corresponding to the above + * key, in xDS Node Metadata. + * + * Generated from protobuf field string label_value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLabelValue() + { + return $this->label_value; + } + + /** + * Required. Label value presented as value corresponding to the above + * key, in xDS Node Metadata. + * + * Generated from protobuf field string label_value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLabelValue($var) + { + GPBUtil::checkString($var, True); + $this->label_value = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/EndpointPolicy.php b/NetworkServices/src/V1/EndpointPolicy.php new file mode 100644 index 000000000000..1bde99da2ce8 --- /dev/null +++ b/NetworkServices/src/V1/EndpointPolicy.php @@ -0,0 +1,526 @@ +google.cloud.networkservices.v1.EndpointPolicy + */ +class EndpointPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the EndpointPolicy resource. It matches pattern + * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Set of label tags associated with the EndpointPolicy resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Required. The type of endpoint policy. This is primarily used to validate + * the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Optional. This field specifies the URL of AuthorizationPolicy resource that + * applies authorization policies to the inbound traffic at the + * matched endpoints. Refer to Authorization. If this field is not + * specified, authorization is disabled(no authz checks) for this + * endpoint. + * + * Generated from protobuf field string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $authorization_policy = ''; + /** + * Required. A matcher that selects endpoints to which the policies should be + * applied. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint_matcher = null; + /** + * Optional. Port selector for the (matched) endpoints. If no port selector is + * provided, the matched config is applied to all ports. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $traffic_port_selector = null; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is + * used to determine the authentication policy to be applied to terminate the + * inbound traffic at the identified backends. If this field is not set, + * authentication is disabled(open) for this endpoint. + * + * Generated from protobuf field string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $server_tls_policy = ''; + /** + * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy + * can be set to specify the authentication for traffic from the proxy to the + * actual endpoints. More specifically, it is applied to the outgoing traffic + * from the proxy to the endpoint. This is typically used for sidecar model + * where the proxy identifies itself as endpoint to the control plane, with + * the connection between sidecar and endpoint requiring authentication. If + * this field is not set, authentication is disabled(open). Applicable only + * when EndpointPolicyType is SIDECAR_PROXY. + * + * Generated from protobuf field string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $client_tls_policy = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the EndpointPolicy resource. It matches pattern + * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the EndpointPolicy resource. + * @type int $type + * Required. The type of endpoint policy. This is primarily used to validate + * the configuration. + * @type string $authorization_policy + * Optional. This field specifies the URL of AuthorizationPolicy resource that + * applies authorization policies to the inbound traffic at the + * matched endpoints. Refer to Authorization. If this field is not + * specified, authorization is disabled(no authz checks) for this + * endpoint. + * @type \Google\Cloud\NetworkServices\V1\EndpointMatcher $endpoint_matcher + * Required. A matcher that selects endpoints to which the policies should be + * applied. + * @type \Google\Cloud\NetworkServices\V1\TrafficPortSelector $traffic_port_selector + * Optional. Port selector for the (matched) endpoints. If no port selector is + * provided, the matched config is applied to all ports. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type string $server_tls_policy + * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is + * used to determine the authentication policy to be applied to terminate the + * inbound traffic at the identified backends. If this field is not set, + * authentication is disabled(open) for this endpoint. + * @type string $client_tls_policy + * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy + * can be set to specify the authentication for traffic from the proxy to the + * actual endpoints. More specifically, it is applied to the outgoing traffic + * from the proxy to the endpoint. This is typically used for sidecar model + * where the proxy identifies itself as endpoint to the control plane, with + * the connection between sidecar and endpoint requiring authentication. If + * this field is not set, authentication is disabled(open). Applicable only + * when EndpointPolicyType is SIDECAR_PROXY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the EndpointPolicy resource. It matches pattern + * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the EndpointPolicy resource. It matches pattern + * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Set of label tags associated with the EndpointPolicy resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the EndpointPolicy resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. The type of endpoint policy. This is primarily used to validate + * the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of endpoint policy. This is primarily used to validate + * the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\EndpointPolicy\EndpointPolicyType::class); + $this->type = $var; + + return $this; + } + + /** + * Optional. This field specifies the URL of AuthorizationPolicy resource that + * applies authorization policies to the inbound traffic at the + * matched endpoints. Refer to Authorization. If this field is not + * specified, authorization is disabled(no authz checks) for this + * endpoint. + * + * Generated from protobuf field string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizationPolicy() + { + return $this->authorization_policy; + } + + /** + * Optional. This field specifies the URL of AuthorizationPolicy resource that + * applies authorization policies to the inbound traffic at the + * matched endpoints. Refer to Authorization. If this field is not + * specified, authorization is disabled(no authz checks) for this + * endpoint. + * + * Generated from protobuf field string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizationPolicy($var) + { + GPBUtil::checkString($var, True); + $this->authorization_policy = $var; + + return $this; + } + + /** + * Required. A matcher that selects endpoints to which the policies should be + * applied. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\EndpointMatcher|null + */ + public function getEndpointMatcher() + { + return $this->endpoint_matcher; + } + + public function hasEndpointMatcher() + { + return isset($this->endpoint_matcher); + } + + public function clearEndpointMatcher() + { + unset($this->endpoint_matcher); + } + + /** + * Required. A matcher that selects endpoints to which the policies should be + * applied. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\EndpointMatcher $var + * @return $this + */ + public function setEndpointMatcher($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\EndpointMatcher::class); + $this->endpoint_matcher = $var; + + return $this; + } + + /** + * Optional. Port selector for the (matched) endpoints. If no port selector is + * provided, the matched config is applied to all ports. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\NetworkServices\V1\TrafficPortSelector|null + */ + public function getTrafficPortSelector() + { + return $this->traffic_port_selector; + } + + public function hasTrafficPortSelector() + { + return isset($this->traffic_port_selector); + } + + public function clearTrafficPortSelector() + { + unset($this->traffic_port_selector); + } + + /** + * Optional. Port selector for the (matched) endpoints. If no port selector is + * provided, the matched config is applied to all ports. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\NetworkServices\V1\TrafficPortSelector $var + * @return $this + */ + public function setTrafficPortSelector($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TrafficPortSelector::class); + $this->traffic_port_selector = $var; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is + * used to determine the authentication policy to be applied to terminate the + * inbound traffic at the identified backends. If this field is not set, + * authentication is disabled(open) for this endpoint. + * + * Generated from protobuf field string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getServerTlsPolicy() + { + return $this->server_tls_policy; + } + + /** + * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is + * used to determine the authentication policy to be applied to terminate the + * inbound traffic at the identified backends. If this field is not set, + * authentication is disabled(open) for this endpoint. + * + * Generated from protobuf field string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServerTlsPolicy($var) + { + GPBUtil::checkString($var, True); + $this->server_tls_policy = $var; + + return $this; + } + + /** + * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy + * can be set to specify the authentication for traffic from the proxy to the + * actual endpoints. More specifically, it is applied to the outgoing traffic + * from the proxy to the endpoint. This is typically used for sidecar model + * where the proxy identifies itself as endpoint to the control plane, with + * the connection between sidecar and endpoint requiring authentication. If + * this field is not set, authentication is disabled(open). Applicable only + * when EndpointPolicyType is SIDECAR_PROXY. + * + * Generated from protobuf field string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getClientTlsPolicy() + { + return $this->client_tls_policy; + } + + /** + * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy + * can be set to specify the authentication for traffic from the proxy to the + * actual endpoints. More specifically, it is applied to the outgoing traffic + * from the proxy to the endpoint. This is typically used for sidecar model + * where the proxy identifies itself as endpoint to the control plane, with + * the connection between sidecar and endpoint requiring authentication. If + * this field is not set, authentication is disabled(open). Applicable only + * when EndpointPolicyType is SIDECAR_PROXY. + * + * Generated from protobuf field string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setClientTlsPolicy($var) + { + GPBUtil::checkString($var, True); + $this->client_tls_policy = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/EndpointPolicy/EndpointPolicyType.php b/NetworkServices/src/V1/EndpointPolicy/EndpointPolicyType.php new file mode 100644 index 000000000000..9b5a5abc3ea8 --- /dev/null +++ b/NetworkServices/src/V1/EndpointPolicy/EndpointPolicyType.php @@ -0,0 +1,62 @@ +google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType + */ +class EndpointPolicyType +{ + /** + * Default value. Must not be used. + * + * Generated from protobuf enum ENDPOINT_POLICY_TYPE_UNSPECIFIED = 0; + */ + const ENDPOINT_POLICY_TYPE_UNSPECIFIED = 0; + /** + * Represents a proxy deployed as a sidecar. + * + * Generated from protobuf enum SIDECAR_PROXY = 1; + */ + const SIDECAR_PROXY = 1; + /** + * Represents a proxyless gRPC backend. + * + * Generated from protobuf enum GRPC_SERVER = 2; + */ + const GRPC_SERVER = 2; + + private static $valueToName = [ + self::ENDPOINT_POLICY_TYPE_UNSPECIFIED => 'ENDPOINT_POLICY_TYPE_UNSPECIFIED', + self::SIDECAR_PROXY => 'SIDECAR_PROXY', + self::GRPC_SERVER => 'GRPC_SERVER', + ]; + + 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/NetworkServices/src/V1/EventType.php b/NetworkServices/src/V1/EventType.php new file mode 100644 index 000000000000..fd2bd9ecfea8 --- /dev/null +++ b/NetworkServices/src/V1/EventType.php @@ -0,0 +1,95 @@ +google.cloud.networkservices.v1.EventType + */ +class EventType +{ + /** + * Unspecified value. Do not use. + * + * Generated from protobuf enum EVENT_TYPE_UNSPECIFIED = 0; + */ + const EVENT_TYPE_UNSPECIFIED = 0; + /** + * If included in `supported_events`, + * the extension is called when the HTTP request headers arrive. + * + * Generated from protobuf enum REQUEST_HEADERS = 1; + */ + const REQUEST_HEADERS = 1; + /** + * If included in `supported_events`, + * the extension is called when the HTTP request body arrives. + * + * Generated from protobuf enum REQUEST_BODY = 2; + */ + const REQUEST_BODY = 2; + /** + * If included in `supported_events`, + * the extension is called when the HTTP response headers arrive. + * + * Generated from protobuf enum RESPONSE_HEADERS = 3; + */ + const RESPONSE_HEADERS = 3; + /** + * If included in `supported_events`, + * the extension is called when the HTTP response body arrives. + * + * Generated from protobuf enum RESPONSE_BODY = 4; + */ + const RESPONSE_BODY = 4; + /** + * If included in `supported_events`, + * the extension is called when the HTTP request trailers arrives. + * + * Generated from protobuf enum REQUEST_TRAILERS = 5; + */ + const REQUEST_TRAILERS = 5; + /** + * If included in `supported_events`, + * the extension is called when the HTTP response trailers arrives. + * + * Generated from protobuf enum RESPONSE_TRAILERS = 6; + */ + const RESPONSE_TRAILERS = 6; + + private static $valueToName = [ + self::EVENT_TYPE_UNSPECIFIED => 'EVENT_TYPE_UNSPECIFIED', + self::REQUEST_HEADERS => 'REQUEST_HEADERS', + self::REQUEST_BODY => 'REQUEST_BODY', + self::RESPONSE_HEADERS => 'RESPONSE_HEADERS', + self::RESPONSE_BODY => 'RESPONSE_BODY', + self::REQUEST_TRAILERS => 'REQUEST_TRAILERS', + self::RESPONSE_TRAILERS => 'RESPONSE_TRAILERS', + ]; + + 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/NetworkServices/src/V1/ExtensionChain.php b/NetworkServices/src/V1/ExtensionChain.php new file mode 100644 index 000000000000..4da12b6f0838 --- /dev/null +++ b/NetworkServices/src/V1/ExtensionChain.php @@ -0,0 +1,182 @@ +google.cloud.networkservices.v1.ExtensionChain + */ +class ExtensionChain extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name for this extension chain. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased letters, + * numbers and hyphens, and can have a maximum length of 63 characters. + * Additionally, the first character must be a letter and the last a letter or + * a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. Conditions under which this chain is invoked for a request. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $match_condition = null; + /** + * Required. A set of extensions to execute for the matching request. + * At least one extension is required. + * Up to 3 extensions can be defined for each extension chain + * for `LbTrafficExtension` resource. + * `LbRouteExtension` chains are limited to 1 extension per extension chain. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $extensions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name for this extension chain. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased letters, + * numbers and hyphens, and can have a maximum length of 63 characters. + * Additionally, the first character must be a letter and the last a letter or + * a number. + * @type \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition $match_condition + * Required. Conditions under which this chain is invoked for a request. + * @type array<\Google\Cloud\NetworkServices\V1\ExtensionChain\Extension>|\Google\Protobuf\Internal\RepeatedField $extensions + * Required. A set of extensions to execute for the matching request. + * At least one extension is required. + * Up to 3 extensions can be defined for each extension chain + * for `LbTrafficExtension` resource. + * `LbRouteExtension` chains are limited to 1 extension per extension chain. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name for this extension chain. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased letters, + * numbers and hyphens, and can have a maximum length of 63 characters. + * Additionally, the first character must be a letter and the last a letter or + * a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name for this extension chain. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased letters, + * numbers and hyphens, and can have a maximum length of 63 characters. + * Additionally, the first character must be a letter and the last a letter or + * a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Conditions under which this chain is invoked for a request. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition|null + */ + public function getMatchCondition() + { + return $this->match_condition; + } + + public function hasMatchCondition() + { + return isset($this->match_condition); + } + + public function clearMatchCondition() + { + unset($this->match_condition); + } + + /** + * Required. Conditions under which this chain is invoked for a request. + * + * Generated from protobuf field .google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition $var + * @return $this + */ + public function setMatchCondition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition::class); + $this->match_condition = $var; + + return $this; + } + + /** + * Required. A set of extensions to execute for the matching request. + * At least one extension is required. + * Up to 3 extensions can be defined for each extension chain + * for `LbTrafficExtension` resource. + * `LbRouteExtension` chains are limited to 1 extension per extension chain. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Required. A set of extensions to execute for the matching request. + * At least one extension is required. + * Up to 3 extensions can be defined for each extension chain + * for `LbTrafficExtension` resource. + * `LbRouteExtension` chains are limited to 1 extension per extension chain. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\ExtensionChain\Extension>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtensions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ExtensionChain\Extension::class); + $this->extensions = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ExtensionChain/Extension.php b/NetworkServices/src/V1/ExtensionChain/Extension.php new file mode 100644 index 000000000000..7654813e8516 --- /dev/null +++ b/NetworkServices/src/V1/ExtensionChain/Extension.php @@ -0,0 +1,414 @@ +google.cloud.networkservices.v1.ExtensionChain.Extension + */ +class Extension extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name for this extension. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased + * letters, numbers and hyphens, and can have a maximum length of 63 + * characters. Additionally, the first character must be a letter and the + * last a letter or a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Optional. The `:authority` header in the gRPC request sent from Envoy + * to the extension service. + * Required for Callout extensions. + * + * Generated from protobuf field string authority = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $authority = ''; + /** + * Required. The reference to the service that runs the extension. + * Currently only callout extensions are supported here. + * To configure a callout extension, `service` must be a fully-qualified + * reference + * to a [backend + * service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices) + * in the format: + * `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}` + * or + * `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`. + * + * Generated from protobuf field string service = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = ''; + /** + * Optional. A set of events during request or response processing for which + * this extension is called. This field is required for the + * `LbTrafficExtension` resource. It must not be set for the + * `LbRouteExtension` resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EventType supported_events = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $supported_events; + /** + * Optional. Specifies the timeout for each individual message on the + * stream. The timeout must be between 10-1000 milliseconds. Required for + * Callout extensions. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $timeout = null; + /** + * Optional. Determines how the proxy behaves if the call to the extension + * fails or times out. + * When set to `TRUE`, request or response processing continues without + * error. Any subsequent extensions in the extension chain are also + * executed. When set to `FALSE` or the default setting of `FALSE` is used, + * one of the following happens: + * * If response headers have not been delivered to the downstream client, + * a generic 500 error is returned to the client. The error response can be + * tailored by configuring a custom error response in the load balancer. + * * If response headers have been delivered, then the HTTP stream to the + * downstream client is reset. + * + * Generated from protobuf field bool fail_open = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $fail_open = false; + /** + * Optional. List of the HTTP headers to forward to the extension + * (from the client or backend). If omitted, all headers are sent. + * Each element is a string indicating the header name. + * + * Generated from protobuf field repeated string forward_headers = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $forward_headers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name for this extension. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased + * letters, numbers and hyphens, and can have a maximum length of 63 + * characters. Additionally, the first character must be a letter and the + * last a letter or a number. + * @type string $authority + * Optional. The `:authority` header in the gRPC request sent from Envoy + * to the extension service. + * Required for Callout extensions. + * @type string $service + * Required. The reference to the service that runs the extension. + * Currently only callout extensions are supported here. + * To configure a callout extension, `service` must be a fully-qualified + * reference + * to a [backend + * service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices) + * in the format: + * `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}` + * or + * `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_events + * Optional. A set of events during request or response processing for which + * this extension is called. This field is required for the + * `LbTrafficExtension` resource. It must not be set for the + * `LbRouteExtension` resource. + * @type \Google\Protobuf\Duration $timeout + * Optional. Specifies the timeout for each individual message on the + * stream. The timeout must be between 10-1000 milliseconds. Required for + * Callout extensions. + * @type bool $fail_open + * Optional. Determines how the proxy behaves if the call to the extension + * fails or times out. + * When set to `TRUE`, request or response processing continues without + * error. Any subsequent extensions in the extension chain are also + * executed. When set to `FALSE` or the default setting of `FALSE` is used, + * one of the following happens: + * * If response headers have not been delivered to the downstream client, + * a generic 500 error is returned to the client. The error response can be + * tailored by configuring a custom error response in the load balancer. + * * If response headers have been delivered, then the HTTP stream to the + * downstream client is reset. + * @type array|\Google\Protobuf\Internal\RepeatedField $forward_headers + * Optional. List of the HTTP headers to forward to the extension + * (from the client or backend). If omitted, all headers are sent. + * Each element is a string indicating the header name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name for this extension. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased + * letters, numbers and hyphens, and can have a maximum length of 63 + * characters. Additionally, the first character must be a letter and the + * last a letter or a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name for this extension. + * The name is logged as part of the HTTP request logs. + * The name must conform with RFC-1034, is restricted to lower-cased + * letters, numbers and hyphens, and can have a maximum length of 63 + * characters. Additionally, the first character must be a letter and the + * last a letter or a number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The `:authority` header in the gRPC request sent from Envoy + * to the extension service. + * Required for Callout extensions. + * + * Generated from protobuf field string authority = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAuthority() + { + return $this->authority; + } + + /** + * Optional. The `:authority` header in the gRPC request sent from Envoy + * to the extension service. + * Required for Callout extensions. + * + * Generated from protobuf field string authority = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAuthority($var) + { + GPBUtil::checkString($var, True); + $this->authority = $var; + + return $this; + } + + /** + * Required. The reference to the service that runs the extension. + * Currently only callout extensions are supported here. + * To configure a callout extension, `service` must be a fully-qualified + * reference + * to a [backend + * service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices) + * in the format: + * `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}` + * or + * `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`. + * + * Generated from protobuf field string service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The reference to the service that runs the extension. + * Currently only callout extensions are supported here. + * To configure a callout extension, `service` must be a fully-qualified + * reference + * to a [backend + * service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices) + * in the format: + * `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}` + * or + * `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`. + * + * Generated from protobuf field string service = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. A set of events during request or response processing for which + * this extension is called. This field is required for the + * `LbTrafficExtension` resource. It must not be set for the + * `LbRouteExtension` resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EventType supported_events = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedEvents() + { + return $this->supported_events; + } + + /** + * Optional. A set of events during request or response processing for which + * this extension is called. This field is required for the + * `LbTrafficExtension` resource. It must not be set for the + * `LbRouteExtension` resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EventType supported_events = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\NetworkServices\V1\EventType::class); + $this->supported_events = $arr; + + return $this; + } + + /** + * Optional. Specifies the timeout for each individual message on the + * stream. The timeout must be between 10-1000 milliseconds. Required for + * Callout extensions. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * Optional. Specifies the timeout for each individual message on the + * stream. The timeout must be between 10-1000 milliseconds. Required for + * Callout extensions. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Optional. Determines how the proxy behaves if the call to the extension + * fails or times out. + * When set to `TRUE`, request or response processing continues without + * error. Any subsequent extensions in the extension chain are also + * executed. When set to `FALSE` or the default setting of `FALSE` is used, + * one of the following happens: + * * If response headers have not been delivered to the downstream client, + * a generic 500 error is returned to the client. The error response can be + * tailored by configuring a custom error response in the load balancer. + * * If response headers have been delivered, then the HTTP stream to the + * downstream client is reset. + * + * Generated from protobuf field bool fail_open = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getFailOpen() + { + return $this->fail_open; + } + + /** + * Optional. Determines how the proxy behaves if the call to the extension + * fails or times out. + * When set to `TRUE`, request or response processing continues without + * error. Any subsequent extensions in the extension chain are also + * executed. When set to `FALSE` or the default setting of `FALSE` is used, + * one of the following happens: + * * If response headers have not been delivered to the downstream client, + * a generic 500 error is returned to the client. The error response can be + * tailored by configuring a custom error response in the load balancer. + * * If response headers have been delivered, then the HTTP stream to the + * downstream client is reset. + * + * Generated from protobuf field bool fail_open = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setFailOpen($var) + { + GPBUtil::checkBool($var); + $this->fail_open = $var; + + return $this; + } + + /** + * Optional. List of the HTTP headers to forward to the extension + * (from the client or backend). If omitted, all headers are sent. + * Each element is a string indicating the header name. + * + * Generated from protobuf field repeated string forward_headers = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getForwardHeaders() + { + return $this->forward_headers; + } + + /** + * Optional. List of the HTTP headers to forward to the extension + * (from the client or backend). If omitted, all headers are sent. + * Each element is a string indicating the header name. + * + * Generated from protobuf field repeated string forward_headers = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setForwardHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->forward_headers = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/ExtensionChain/MatchCondition.php b/NetworkServices/src/V1/ExtensionChain/MatchCondition.php new file mode 100644 index 000000000000..37dd5419254f --- /dev/null +++ b/NetworkServices/src/V1/ExtensionChain/MatchCondition.php @@ -0,0 +1,80 @@ +google.cloud.networkservices.v1.ExtensionChain.MatchCondition + */ +class MatchCondition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A Common Expression Language (CEL) expression that is used to + * match requests for which the extension chain is executed. + * For more information, see [CEL matcher language + * reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference). + * + * Generated from protobuf field string cel_expression = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cel_expression = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cel_expression + * Required. A Common Expression Language (CEL) expression that is used to + * match requests for which the extension chain is executed. + * For more information, see [CEL matcher language + * reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. A Common Expression Language (CEL) expression that is used to + * match requests for which the extension chain is executed. + * For more information, see [CEL matcher language + * reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference). + * + * Generated from protobuf field string cel_expression = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCelExpression() + { + return $this->cel_expression; + } + + /** + * Required. A Common Expression Language (CEL) expression that is used to + * match requests for which the extension chain is executed. + * For more information, see [CEL matcher language + * reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference). + * + * Generated from protobuf field string cel_expression = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCelExpression($var) + { + GPBUtil::checkString($var, True); + $this->cel_expression = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/Gapic/DepServiceGapicClient.php b/NetworkServices/src/V1/Gapic/DepServiceGapicClient.php new file mode 100644 index 000000000000..79300bc735ba --- /dev/null +++ b/NetworkServices/src/V1/Gapic/DepServiceGapicClient.php @@ -0,0 +1,1454 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $lbRouteExtensionId = 'lb_route_extension_id'; + * $lbRouteExtension = new LbRouteExtension(); + * $operationResponse = $depServiceClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'createLbRouteExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated This class will be removed in the next major version update. + */ +class DepServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.networkservices.v1.DepService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'networkservices.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'networkservices.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $lbRouteExtensionNameTemplate; + + private static $lbTrafficExtensionNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dep_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dep_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dep_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dep_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getLbRouteExtensionNameTemplate() + { + if (self::$lbRouteExtensionNameTemplate == null) { + self::$lbRouteExtensionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}'); + } + + return self::$lbRouteExtensionNameTemplate; + } + + private static function getLbTrafficExtensionNameTemplate() + { + if (self::$lbTrafficExtensionNameTemplate == null) { + self::$lbTrafficExtensionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}'); + } + + return self::$lbTrafficExtensionNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'lbRouteExtension' => self::getLbRouteExtensionNameTemplate(), + 'lbTrafficExtension' => self::getLbTrafficExtensionNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * lb_route_extension resource. + * + * @param string $project + * @param string $location + * @param string $lbRouteExtension + * + * @return string The formatted lb_route_extension resource. + */ + public static function lbRouteExtensionName($project, $location, $lbRouteExtension) + { + return self::getLbRouteExtensionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'lb_route_extension' => $lbRouteExtension, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * lb_traffic_extension resource. + * + * @param string $project + * @param string $location + * @param string $lbTrafficExtension + * + * @return string The formatted lb_traffic_extension resource. + */ + public static function lbTrafficExtensionName($project, $location, $lbTrafficExtension) + { + return self::getLbTrafficExtensionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'lb_traffic_extension' => $lbTrafficExtension, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - lbRouteExtension: projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension} + * - lbTrafficExtension: projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'networkservices.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a new `LbRouteExtension` resource in a given project and location. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedParent = $depServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $lbRouteExtensionId = 'lb_route_extension_id'; + * $lbRouteExtension = new LbRouteExtension(); + * $operationResponse = $depServiceClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'createLbRouteExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the `LbRouteExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * @param string $lbRouteExtensionId Required. User-provided ID of the `LbRouteExtension` resource to be + * created. + * @param LbRouteExtension $lbRouteExtension Required. `LbRouteExtension` resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createLbRouteExtension($parent, $lbRouteExtensionId, $lbRouteExtension, array $optionalArgs = []) + { + $request = new CreateLbRouteExtensionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLbRouteExtensionId($lbRouteExtensionId); + $request->setLbRouteExtension($lbRouteExtension); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateLbRouteExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new `LbTrafficExtension` resource in a given project and + * location. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedParent = $depServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $lbTrafficExtensionId = 'lb_traffic_extension_id'; + * $lbTrafficExtension = new LbTrafficExtension(); + * $operationResponse = $depServiceClient->createLbTrafficExtension($formattedParent, $lbTrafficExtensionId, $lbTrafficExtension); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->createLbTrafficExtension($formattedParent, $lbTrafficExtensionId, $lbTrafficExtension); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'createLbTrafficExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the `LbTrafficExtension` resource. Must be + * in the format `projects/{project}/locations/{location}`. + * @param string $lbTrafficExtensionId Required. User-provided ID of the `LbTrafficExtension` resource to be + * created. + * @param LbTrafficExtension $lbTrafficExtension Required. `LbTrafficExtension` resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createLbTrafficExtension($parent, $lbTrafficExtensionId, $lbTrafficExtension, array $optionalArgs = []) + { + $request = new CreateLbTrafficExtensionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLbTrafficExtensionId($lbTrafficExtensionId); + $request->setLbTrafficExtension($lbTrafficExtension); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateLbTrafficExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified `LbRouteExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedName = $depServiceClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + * $operationResponse = $depServiceClient->deleteLbRouteExtension($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->deleteLbRouteExtension($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'deleteLbRouteExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the `LbRouteExtension` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteLbRouteExtension($name, array $optionalArgs = []) + { + $request = new DeleteLbRouteExtensionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteLbRouteExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified `LbTrafficExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedName = $depServiceClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + * $operationResponse = $depServiceClient->deleteLbTrafficExtension($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->deleteLbTrafficExtension($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'deleteLbTrafficExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the `LbTrafficExtension` resource to delete. Must be + * in the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteLbTrafficExtension($name, array $optionalArgs = []) + { + $request = new DeleteLbTrafficExtensionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteLbTrafficExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of the specified `LbRouteExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedName = $depServiceClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + * $response = $depServiceClient->getLbRouteExtension($formattedName); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the `LbRouteExtension` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\LbRouteExtension + * + * @throws ApiException if the remote call fails + */ + public function getLbRouteExtension($name, array $optionalArgs = []) + { + $request = new GetLbRouteExtensionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLbRouteExtension', LbRouteExtension::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of the specified `LbTrafficExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedName = $depServiceClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + * $response = $depServiceClient->getLbTrafficExtension($formattedName); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the `LbTrafficExtension` resource to get. Must be in + * the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\LbTrafficExtension + * + * @throws ApiException if the remote call fails + */ + public function getLbTrafficExtension($name, array $optionalArgs = []) + { + $request = new GetLbTrafficExtensionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLbTrafficExtension', LbTrafficExtension::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists `LbRouteExtension` resources in a given project and location. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedParent = $depServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $depServiceClient->listLbRouteExtensions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $depServiceClient->listLbRouteExtensions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the `LbRouteExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filtering results. + * @type string $orderBy + * Optional. Hint for how to order the results. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLbRouteExtensions($parent, array $optionalArgs = []) + { + $request = new ListLbRouteExtensionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLbRouteExtensions', $optionalArgs, ListLbRouteExtensionsResponse::class, $request); + } + + /** + * Lists `LbTrafficExtension` resources in a given project and location. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $formattedParent = $depServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $depServiceClient->listLbTrafficExtensions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $depServiceClient->listLbTrafficExtensions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the `LbTrafficExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filtering results. + * @type string $orderBy + * Optional. Hint for how to order the results. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLbTrafficExtensions($parent, array $optionalArgs = []) + { + $request = new ListLbTrafficExtensionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLbTrafficExtensions', $optionalArgs, ListLbTrafficExtensionsResponse::class, $request); + } + + /** + * Updates the parameters of the specified `LbRouteExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $lbRouteExtension = new LbRouteExtension(); + * $operationResponse = $depServiceClient->updateLbRouteExtension($lbRouteExtension); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->updateLbRouteExtension($lbRouteExtension); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'updateLbRouteExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param LbRouteExtension $lbRouteExtension Required. `LbRouteExtension` resource being updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Used to specify the fields to be overwritten in the + * `LbRouteExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateLbRouteExtension($lbRouteExtension, array $optionalArgs = []) + { + $request = new UpdateLbRouteExtensionRequest(); + $requestParamHeaders = []; + $request->setLbRouteExtension($lbRouteExtension); + $requestParamHeaders['lb_route_extension.name'] = $lbRouteExtension->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateLbRouteExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of the specified `LbTrafficExtension` resource. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $lbTrafficExtension = new LbTrafficExtension(); + * $operationResponse = $depServiceClient->updateLbTrafficExtension($lbTrafficExtension); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $depServiceClient->updateLbTrafficExtension($lbTrafficExtension); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $depServiceClient->resumeOperation($operationName, 'updateLbTrafficExtension'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param LbTrafficExtension $lbTrafficExtension Required. `LbTrafficExtension` resource being updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Used to specify the fields to be overwritten in the + * `LbTrafficExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateLbTrafficExtension($lbTrafficExtension, array $optionalArgs = []) + { + $request = new UpdateLbTrafficExtensionRequest(); + $requestParamHeaders = []; + $request->setLbTrafficExtension($lbTrafficExtension); + $requestParamHeaders['lb_traffic_extension.name'] = $lbTrafficExtension->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateLbTrafficExtension', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $response = $depServiceClient->getLocation(); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $depServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $depServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $resource = 'resource'; + * $response = $depServiceClient->getIamPolicy($resource); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $depServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $depServiceClient = new DepServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $depServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $depServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/NetworkServices/src/V1/Gapic/NetworkServicesGapicClient.php b/NetworkServices/src/V1/Gapic/NetworkServicesGapicClient.php new file mode 100644 index 000000000000..e83fc3cccad3 --- /dev/null +++ b/NetworkServices/src/V1/Gapic/NetworkServicesGapicClient.php @@ -0,0 +1,3503 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $endpointPolicyId = 'endpoint_policy_id'; + * $endpointPolicy = new EndpointPolicy(); + * $operationResponse = $networkServicesClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createEndpointPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated This class will be removed in the next major version update. + */ +class NetworkServicesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.networkservices.v1.NetworkServices'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'networkservices.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'networkservices.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $authorizationPolicyNameTemplate; + + private static $backendServiceNameTemplate; + + private static $clientTlsPolicyNameTemplate; + + private static $endpointPolicyNameTemplate; + + private static $gatewayNameTemplate; + + private static $grpcRouteNameTemplate; + + private static $httpRouteNameTemplate; + + private static $locationNameTemplate; + + private static $meshNameTemplate; + + private static $serverTlsPolicyNameTemplate; + + private static $serviceBindingNameTemplate; + + private static $tcpRouteNameTemplate; + + private static $tlsRouteNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/network_services_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/network_services_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/network_services_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/network_services_rest_client_config.php', + ], + ], + ]; + } + + private static function getAuthorizationPolicyNameTemplate() + { + if (self::$authorizationPolicyNameTemplate == null) { + self::$authorizationPolicyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}'); + } + + return self::$authorizationPolicyNameTemplate; + } + + private static function getBackendServiceNameTemplate() + { + if (self::$backendServiceNameTemplate == null) { + self::$backendServiceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/backendServices/{backend_service}'); + } + + return self::$backendServiceNameTemplate; + } + + private static function getClientTlsPolicyNameTemplate() + { + if (self::$clientTlsPolicyNameTemplate == null) { + self::$clientTlsPolicyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}'); + } + + return self::$clientTlsPolicyNameTemplate; + } + + private static function getEndpointPolicyNameTemplate() + { + if (self::$endpointPolicyNameTemplate == null) { + self::$endpointPolicyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/endpointPolicies/{endpoint_policy}'); + } + + return self::$endpointPolicyNameTemplate; + } + + private static function getGatewayNameTemplate() + { + if (self::$gatewayNameTemplate == null) { + self::$gatewayNameTemplate = new PathTemplate('projects/{project}/locations/{location}/gateways/{gateway}'); + } + + return self::$gatewayNameTemplate; + } + + private static function getGrpcRouteNameTemplate() + { + if (self::$grpcRouteNameTemplate == null) { + self::$grpcRouteNameTemplate = new PathTemplate('projects/{project}/locations/{location}/grpcRoutes/{grpc_route}'); + } + + return self::$grpcRouteNameTemplate; + } + + private static function getHttpRouteNameTemplate() + { + if (self::$httpRouteNameTemplate == null) { + self::$httpRouteNameTemplate = new PathTemplate('projects/{project}/locations/{location}/httpRoutes/{http_route}'); + } + + return self::$httpRouteNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMeshNameTemplate() + { + if (self::$meshNameTemplate == null) { + self::$meshNameTemplate = new PathTemplate('projects/{project}/locations/{location}/meshes/{mesh}'); + } + + return self::$meshNameTemplate; + } + + private static function getServerTlsPolicyNameTemplate() + { + if (self::$serverTlsPolicyNameTemplate == null) { + self::$serverTlsPolicyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}'); + } + + return self::$serverTlsPolicyNameTemplate; + } + + private static function getServiceBindingNameTemplate() + { + if (self::$serviceBindingNameTemplate == null) { + self::$serviceBindingNameTemplate = new PathTemplate('projects/{project}/locations/{location}/serviceBindings/{service_binding}'); + } + + return self::$serviceBindingNameTemplate; + } + + private static function getTcpRouteNameTemplate() + { + if (self::$tcpRouteNameTemplate == null) { + self::$tcpRouteNameTemplate = new PathTemplate('projects/{project}/locations/{location}/tcpRoutes/{tcp_route}'); + } + + return self::$tcpRouteNameTemplate; + } + + private static function getTlsRouteNameTemplate() + { + if (self::$tlsRouteNameTemplate == null) { + self::$tlsRouteNameTemplate = new PathTemplate('projects/{project}/locations/{location}/tlsRoutes/{tls_route}'); + } + + return self::$tlsRouteNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'authorizationPolicy' => self::getAuthorizationPolicyNameTemplate(), + 'backendService' => self::getBackendServiceNameTemplate(), + 'clientTlsPolicy' => self::getClientTlsPolicyNameTemplate(), + 'endpointPolicy' => self::getEndpointPolicyNameTemplate(), + 'gateway' => self::getGatewayNameTemplate(), + 'grpcRoute' => self::getGrpcRouteNameTemplate(), + 'httpRoute' => self::getHttpRouteNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'mesh' => self::getMeshNameTemplate(), + 'serverTlsPolicy' => self::getServerTlsPolicyNameTemplate(), + 'serviceBinding' => self::getServiceBindingNameTemplate(), + 'tcpRoute' => self::getTcpRouteNameTemplate(), + 'tlsRoute' => self::getTlsRouteNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * authorization_policy resource. + * + * @param string $project + * @param string $location + * @param string $authorizationPolicy + * + * @return string The formatted authorization_policy resource. + */ + public static function authorizationPolicyName($project, $location, $authorizationPolicy) + { + return self::getAuthorizationPolicyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'authorization_policy' => $authorizationPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * backend_service resource. + * + * @param string $project + * @param string $location + * @param string $backendService + * + * @return string The formatted backend_service resource. + */ + public static function backendServiceName($project, $location, $backendService) + { + return self::getBackendServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backend_service' => $backendService, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * client_tls_policy resource. + * + * @param string $project + * @param string $location + * @param string $clientTlsPolicy + * + * @return string The formatted client_tls_policy resource. + */ + public static function clientTlsPolicyName($project, $location, $clientTlsPolicy) + { + return self::getClientTlsPolicyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'client_tls_policy' => $clientTlsPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * endpoint_policy resource. + * + * @param string $project + * @param string $location + * @param string $endpointPolicy + * + * @return string The formatted endpoint_policy resource. + */ + public static function endpointPolicyName($project, $location, $endpointPolicy) + { + return self::getEndpointPolicyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'endpoint_policy' => $endpointPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a gateway + * resource. + * + * @param string $project + * @param string $location + * @param string $gateway + * + * @return string The formatted gateway resource. + */ + public static function gatewayName($project, $location, $gateway) + { + return self::getGatewayNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'gateway' => $gateway, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a grpc_route + * resource. + * + * @param string $project + * @param string $location + * @param string $grpcRoute + * + * @return string The formatted grpc_route resource. + */ + public static function grpcRouteName($project, $location, $grpcRoute) + { + return self::getGrpcRouteNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'grpc_route' => $grpcRoute, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a http_route + * resource. + * + * @param string $project + * @param string $location + * @param string $httpRoute + * + * @return string The formatted http_route resource. + */ + public static function httpRouteName($project, $location, $httpRoute) + { + return self::getHttpRouteNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'http_route' => $httpRoute, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a mesh + * resource. + * + * @param string $project + * @param string $location + * @param string $mesh + * + * @return string The formatted mesh resource. + */ + public static function meshName($project, $location, $mesh) + { + return self::getMeshNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'mesh' => $mesh, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * server_tls_policy resource. + * + * @param string $project + * @param string $location + * @param string $serverTlsPolicy + * + * @return string The formatted server_tls_policy resource. + */ + public static function serverTlsPolicyName($project, $location, $serverTlsPolicy) + { + return self::getServerTlsPolicyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'server_tls_policy' => $serverTlsPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * service_binding resource. + * + * @param string $project + * @param string $location + * @param string $serviceBinding + * + * @return string The formatted service_binding resource. + */ + public static function serviceBindingName($project, $location, $serviceBinding) + { + return self::getServiceBindingNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service_binding' => $serviceBinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tcp_route + * resource. + * + * @param string $project + * @param string $location + * @param string $tcpRoute + * + * @return string The formatted tcp_route resource. + */ + public static function tcpRouteName($project, $location, $tcpRoute) + { + return self::getTcpRouteNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'tcp_route' => $tcpRoute, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tls_route + * resource. + * + * @param string $project + * @param string $location + * @param string $tlsRoute + * + * @return string The formatted tls_route resource. + */ + public static function tlsRouteName($project, $location, $tlsRoute) + { + return self::getTlsRouteNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'tls_route' => $tlsRoute, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - authorizationPolicy: projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy} + * - backendService: projects/{project}/locations/{location}/backendServices/{backend_service} + * - clientTlsPolicy: projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy} + * - endpointPolicy: projects/{project}/locations/{location}/endpointPolicies/{endpoint_policy} + * - gateway: projects/{project}/locations/{location}/gateways/{gateway} + * - grpcRoute: projects/{project}/locations/{location}/grpcRoutes/{grpc_route} + * - httpRoute: projects/{project}/locations/{location}/httpRoutes/{http_route} + * - location: projects/{project}/locations/{location} + * - mesh: projects/{project}/locations/{location}/meshes/{mesh} + * - serverTlsPolicy: projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy} + * - serviceBinding: projects/{project}/locations/{location}/serviceBindings/{service_binding} + * - tcpRoute: projects/{project}/locations/{location}/tcpRoutes/{tcp_route} + * - tlsRoute: projects/{project}/locations/{location}/tlsRoutes/{tls_route} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'networkservices.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a new EndpointPolicy in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $endpointPolicyId = 'endpoint_policy_id'; + * $endpointPolicy = new EndpointPolicy(); + * $operationResponse = $networkServicesClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createEndpointPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the EndpointPolicy. Must be in the + * format `projects/*/locations/global`. + * @param string $endpointPolicyId Required. Short name of the EndpointPolicy resource to be created. + * E.g. "CustomECS". + * @param EndpointPolicy $endpointPolicy Required. EndpointPolicy resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createEndpointPolicy($parent, $endpointPolicyId, $endpointPolicy, array $optionalArgs = []) + { + $request = new CreateEndpointPolicyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setEndpointPolicyId($endpointPolicyId); + $request->setEndpointPolicy($endpointPolicy); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateEndpointPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Gateway in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $gatewayId = 'gateway_id'; + * $gateway = new Gateway(); + * $operationResponse = $networkServicesClient->createGateway($formattedParent, $gatewayId, $gateway); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createGateway($formattedParent, $gatewayId, $gateway); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createGateway'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the Gateway. Must be in the + * format `projects/*/locations/*`. + * @param string $gatewayId Required. Short name of the Gateway resource to be created. + * @param Gateway $gateway Required. Gateway resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createGateway($parent, $gatewayId, $gateway, array $optionalArgs = []) + { + $request = new CreateGatewayRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setGatewayId($gatewayId); + $request->setGateway($gateway); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateGateway', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new GrpcRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $grpcRouteId = 'grpc_route_id'; + * $grpcRoute = new GrpcRoute(); + * $operationResponse = $networkServicesClient->createGrpcRoute($formattedParent, $grpcRouteId, $grpcRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createGrpcRoute($formattedParent, $grpcRouteId, $grpcRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createGrpcRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the GrpcRoute. Must be in the + * format `projects/*/locations/global`. + * @param string $grpcRouteId Required. Short name of the GrpcRoute resource to be created. + * @param GrpcRoute $grpcRoute Required. GrpcRoute resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createGrpcRoute($parent, $grpcRouteId, $grpcRoute, array $optionalArgs = []) + { + $request = new CreateGrpcRouteRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setGrpcRouteId($grpcRouteId); + $request->setGrpcRoute($grpcRoute); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateGrpcRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new HttpRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $httpRouteId = 'http_route_id'; + * $httpRoute = new HttpRoute(); + * $operationResponse = $networkServicesClient->createHttpRoute($formattedParent, $httpRouteId, $httpRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createHttpRoute($formattedParent, $httpRouteId, $httpRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createHttpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the HttpRoute. Must be in the + * format `projects/*/locations/global`. + * @param string $httpRouteId Required. Short name of the HttpRoute resource to be created. + * @param HttpRoute $httpRoute Required. HttpRoute resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createHttpRoute($parent, $httpRouteId, $httpRoute, array $optionalArgs = []) + { + $request = new CreateHttpRouteRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setHttpRouteId($httpRouteId); + $request->setHttpRoute($httpRoute); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateHttpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Mesh in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $meshId = 'mesh_id'; + * $mesh = new Mesh(); + * $operationResponse = $networkServicesClient->createMesh($formattedParent, $meshId, $mesh); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createMesh($formattedParent, $meshId, $mesh); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createMesh'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the Mesh. Must be in the + * format `projects/*/locations/global`. + * @param string $meshId Required. Short name of the Mesh resource to be created. + * @param Mesh $mesh Required. Mesh resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createMesh($parent, $meshId, $mesh, array $optionalArgs = []) + { + $request = new CreateMeshRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setMeshId($meshId); + $request->setMesh($mesh); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateMesh', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new ServiceBinding in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $serviceBindingId = 'service_binding_id'; + * $serviceBinding = new ServiceBinding(); + * $operationResponse = $networkServicesClient->createServiceBinding($formattedParent, $serviceBindingId, $serviceBinding); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createServiceBinding($formattedParent, $serviceBindingId, $serviceBinding); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createServiceBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the ServiceBinding. Must be in the + * format `projects/*/locations/global`. + * @param string $serviceBindingId Required. Short name of the ServiceBinding resource to be created. + * @param ServiceBinding $serviceBinding Required. ServiceBinding resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createServiceBinding($parent, $serviceBindingId, $serviceBinding, array $optionalArgs = []) + { + $request = new CreateServiceBindingRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setServiceBindingId($serviceBindingId); + $request->setServiceBinding($serviceBinding); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateServiceBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new TcpRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $tcpRouteId = 'tcp_route_id'; + * $tcpRoute = new TcpRoute(); + * $operationResponse = $networkServicesClient->createTcpRoute($formattedParent, $tcpRouteId, $tcpRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createTcpRoute($formattedParent, $tcpRouteId, $tcpRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createTcpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the TcpRoute. Must be in the + * format `projects/*/locations/global`. + * @param string $tcpRouteId Required. Short name of the TcpRoute resource to be created. + * @param TcpRoute $tcpRoute Required. TcpRoute resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createTcpRoute($parent, $tcpRouteId, $tcpRoute, array $optionalArgs = []) + { + $request = new CreateTcpRouteRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTcpRouteId($tcpRouteId); + $request->setTcpRoute($tcpRoute); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateTcpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new TlsRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * $tlsRouteId = 'tls_route_id'; + * $tlsRoute = new TlsRoute(); + * $operationResponse = $networkServicesClient->createTlsRoute($formattedParent, $tlsRouteId, $tlsRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->createTlsRoute($formattedParent, $tlsRouteId, $tlsRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'createTlsRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource of the TlsRoute. Must be in the + * format `projects/*/locations/global`. + * @param string $tlsRouteId Required. Short name of the TlsRoute resource to be created. + * @param TlsRoute $tlsRoute Required. TlsRoute resource to be created. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createTlsRoute($parent, $tlsRouteId, $tlsRoute, array $optionalArgs = []) + { + $request = new CreateTlsRouteRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTlsRouteId($tlsRouteId); + $request->setTlsRoute($tlsRoute); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateTlsRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single EndpointPolicy. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + * $operationResponse = $networkServicesClient->deleteEndpointPolicy($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteEndpointPolicy($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteEndpointPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the EndpointPolicy to delete. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteEndpointPolicy($name, array $optionalArgs = []) + { + $request = new DeleteEndpointPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteEndpointPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Gateway. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + * $operationResponse = $networkServicesClient->deleteGateway($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteGateway($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteGateway'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the Gateway to delete. Must be in the format + * `projects/*/locations/*/gateways/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteGateway($name, array $optionalArgs = []) + { + $request = new DeleteGatewayRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteGateway', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single GrpcRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + * $operationResponse = $networkServicesClient->deleteGrpcRoute($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteGrpcRoute($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteGrpcRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the GrpcRoute to delete. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteGrpcRoute($name, array $optionalArgs = []) + { + $request = new DeleteGrpcRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteGrpcRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single HttpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + * $operationResponse = $networkServicesClient->deleteHttpRoute($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteHttpRoute($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteHttpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the HttpRoute to delete. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteHttpRoute($name, array $optionalArgs = []) + { + $request = new DeleteHttpRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteHttpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Mesh. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + * $operationResponse = $networkServicesClient->deleteMesh($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteMesh($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteMesh'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the Mesh to delete. Must be in the format + * `projects/*/locations/global/meshes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteMesh($name, array $optionalArgs = []) + { + $request = new DeleteMeshRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteMesh', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single ServiceBinding. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + * $operationResponse = $networkServicesClient->deleteServiceBinding($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteServiceBinding($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteServiceBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the ServiceBinding to delete. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteServiceBinding($name, array $optionalArgs = []) + { + $request = new DeleteServiceBindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteServiceBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single TcpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + * $operationResponse = $networkServicesClient->deleteTcpRoute($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteTcpRoute($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteTcpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the TcpRoute to delete. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteTcpRoute($name, array $optionalArgs = []) + { + $request = new DeleteTcpRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteTcpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single TlsRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + * $operationResponse = $networkServicesClient->deleteTlsRoute($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->deleteTlsRoute($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'deleteTlsRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the TlsRoute to delete. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteTlsRoute($name, array $optionalArgs = []) + { + $request = new DeleteTlsRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteTlsRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single EndpointPolicy. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + * $response = $networkServicesClient->getEndpointPolicy($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the EndpointPolicy to get. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\EndpointPolicy + * + * @throws ApiException if the remote call fails + */ + public function getEndpointPolicy($name, array $optionalArgs = []) + { + $request = new GetEndpointPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEndpointPolicy', EndpointPolicy::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Gateway. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + * $response = $networkServicesClient->getGateway($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the Gateway to get. Must be in the format + * `projects/*/locations/*/gateways/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\Gateway + * + * @throws ApiException if the remote call fails + */ + public function getGateway($name, array $optionalArgs = []) + { + $request = new GetGatewayRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGateway', Gateway::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single GrpcRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + * $response = $networkServicesClient->getGrpcRoute($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the GrpcRoute to get. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute + * + * @throws ApiException if the remote call fails + */ + public function getGrpcRoute($name, array $optionalArgs = []) + { + $request = new GetGrpcRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGrpcRoute', GrpcRoute::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single HttpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + * $response = $networkServicesClient->getHttpRoute($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the HttpRoute to get. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\HttpRoute + * + * @throws ApiException if the remote call fails + */ + public function getHttpRoute($name, array $optionalArgs = []) + { + $request = new GetHttpRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetHttpRoute', HttpRoute::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Mesh. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + * $response = $networkServicesClient->getMesh($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the Mesh to get. Must be in the format + * `projects/*/locations/global/meshes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\Mesh + * + * @throws ApiException if the remote call fails + */ + public function getMesh($name, array $optionalArgs = []) + { + $request = new GetMeshRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMesh', Mesh::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single ServiceBinding. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + * $response = $networkServicesClient->getServiceBinding($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the ServiceBinding to get. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\ServiceBinding + * + * @throws ApiException if the remote call fails + */ + public function getServiceBinding($name, array $optionalArgs = []) + { + $request = new GetServiceBindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetServiceBinding', ServiceBinding::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single TcpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + * $response = $networkServicesClient->getTcpRoute($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the TcpRoute to get. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\TcpRoute + * + * @throws ApiException if the remote call fails + */ + public function getTcpRoute($name, array $optionalArgs = []) + { + $request = new GetTcpRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTcpRoute', TcpRoute::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single TlsRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedName = $networkServicesClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + * $response = $networkServicesClient->getTlsRoute($formattedName); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the TlsRoute to get. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\NetworkServices\V1\TlsRoute + * + * @throws ApiException if the remote call fails + */ + public function getTlsRoute($name, array $optionalArgs = []) + { + $request = new GetTlsRouteRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTlsRoute', TlsRoute::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists EndpointPolicies in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listEndpointPolicies($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listEndpointPolicies($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the EndpointPolicies should + * be listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEndpointPolicies($parent, array $optionalArgs = []) + { + $request = new ListEndpointPoliciesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEndpointPolicies', $optionalArgs, ListEndpointPoliciesResponse::class, $request); + } + + /** + * Lists Gateways in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listGateways($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listGateways($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the Gateways should be + * listed, specified in the format `projects/*/locations/*`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGateways($parent, array $optionalArgs = []) + { + $request = new ListGatewaysRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGateways', $optionalArgs, ListGatewaysResponse::class, $request); + } + + /** + * Lists GrpcRoutes in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listGrpcRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listGrpcRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the GrpcRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGrpcRoutes($parent, array $optionalArgs = []) + { + $request = new ListGrpcRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGrpcRoutes', $optionalArgs, ListGrpcRoutesResponse::class, $request); + } + + /** + * Lists HttpRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listHttpRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listHttpRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the HttpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listHttpRoutes($parent, array $optionalArgs = []) + { + $request = new ListHttpRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListHttpRoutes', $optionalArgs, ListHttpRoutesResponse::class, $request); + } + + /** + * Lists Meshes in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listMeshes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listMeshes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the Meshes should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listMeshes($parent, array $optionalArgs = []) + { + $request = new ListMeshesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMeshes', $optionalArgs, ListMeshesResponse::class, $request); + } + + /** + * Lists ServiceBinding in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listServiceBindings($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listServiceBindings($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the ServiceBindings should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listServiceBindings($parent, array $optionalArgs = []) + { + $request = new ListServiceBindingsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServiceBindings', $optionalArgs, ListServiceBindingsResponse::class, $request); + } + + /** + * Lists TcpRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listTcpRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listTcpRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the TcpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTcpRoutes($parent, array $optionalArgs = []) + { + $request = new ListTcpRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTcpRoutes', $optionalArgs, ListTcpRoutesResponse::class, $request); + } + + /** + * Lists TlsRoute in a given project and location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $formattedParent = $networkServicesClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listTlsRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listTlsRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the TlsRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTlsRoutes($parent, array $optionalArgs = []) + { + $request = new ListTlsRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTlsRoutes', $optionalArgs, ListTlsRoutesResponse::class, $request); + } + + /** + * Updates the parameters of a single EndpointPolicy. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $endpointPolicy = new EndpointPolicy(); + * $operationResponse = $networkServicesClient->updateEndpointPolicy($endpointPolicy); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateEndpointPolicy($endpointPolicy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateEndpointPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param EndpointPolicy $endpointPolicy Required. Updated EndpointPolicy resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * EndpointPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateEndpointPolicy($endpointPolicy, array $optionalArgs = []) + { + $request = new UpdateEndpointPolicyRequest(); + $requestParamHeaders = []; + $request->setEndpointPolicy($endpointPolicy); + $requestParamHeaders['endpoint_policy.name'] = $endpointPolicy->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateEndpointPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single Gateway. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $gateway = new Gateway(); + * $operationResponse = $networkServicesClient->updateGateway($gateway); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateGateway($gateway); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateGateway'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param Gateway $gateway Required. Updated Gateway resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Gateway resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateGateway($gateway, array $optionalArgs = []) + { + $request = new UpdateGatewayRequest(); + $requestParamHeaders = []; + $request->setGateway($gateway); + $requestParamHeaders['gateway.name'] = $gateway->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateGateway', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single GrpcRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $grpcRoute = new GrpcRoute(); + * $operationResponse = $networkServicesClient->updateGrpcRoute($grpcRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateGrpcRoute($grpcRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateGrpcRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param GrpcRoute $grpcRoute Required. Updated GrpcRoute resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * GrpcRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateGrpcRoute($grpcRoute, array $optionalArgs = []) + { + $request = new UpdateGrpcRouteRequest(); + $requestParamHeaders = []; + $request->setGrpcRoute($grpcRoute); + $requestParamHeaders['grpc_route.name'] = $grpcRoute->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateGrpcRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single HttpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $httpRoute = new HttpRoute(); + * $operationResponse = $networkServicesClient->updateHttpRoute($httpRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateHttpRoute($httpRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateHttpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param HttpRoute $httpRoute Required. Updated HttpRoute resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * HttpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateHttpRoute($httpRoute, array $optionalArgs = []) + { + $request = new UpdateHttpRouteRequest(); + $requestParamHeaders = []; + $request->setHttpRoute($httpRoute); + $requestParamHeaders['http_route.name'] = $httpRoute->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateHttpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single Mesh. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $mesh = new Mesh(); + * $operationResponse = $networkServicesClient->updateMesh($mesh); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateMesh($mesh); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateMesh'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param Mesh $mesh Required. Updated Mesh resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Mesh resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateMesh($mesh, array $optionalArgs = []) + { + $request = new UpdateMeshRequest(); + $requestParamHeaders = []; + $request->setMesh($mesh); + $requestParamHeaders['mesh.name'] = $mesh->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateMesh', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single TcpRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $tcpRoute = new TcpRoute(); + * $operationResponse = $networkServicesClient->updateTcpRoute($tcpRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateTcpRoute($tcpRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateTcpRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param TcpRoute $tcpRoute Required. Updated TcpRoute resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * TcpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateTcpRoute($tcpRoute, array $optionalArgs = []) + { + $request = new UpdateTcpRouteRequest(); + $requestParamHeaders = []; + $request->setTcpRoute($tcpRoute); + $requestParamHeaders['tcp_route.name'] = $tcpRoute->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateTcpRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single TlsRoute. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $tlsRoute = new TlsRoute(); + * $operationResponse = $networkServicesClient->updateTlsRoute($tlsRoute); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $networkServicesClient->updateTlsRoute($tlsRoute); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $networkServicesClient->resumeOperation($operationName, 'updateTlsRoute'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param TlsRoute $tlsRoute Required. Updated TlsRoute resource. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateTlsRoute($tlsRoute, array $optionalArgs = []) + { + $request = new UpdateTlsRouteRequest(); + $requestParamHeaders = []; + $request->setTlsRoute($tlsRoute); + $requestParamHeaders['tls_route.name'] = $tlsRoute->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateTlsRoute', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $response = $networkServicesClient->getLocation(); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $networkServicesClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $networkServicesClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $resource = 'resource'; + * $response = $networkServicesClient->getIamPolicy($resource); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $networkServicesClient->setIamPolicy($resource, $policy); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $networkServicesClient = new NetworkServicesClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $networkServicesClient->testIamPermissions($resource, $permissions); + * } finally { + * $networkServicesClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/NetworkServices/src/V1/Gateway.php b/NetworkServices/src/V1/Gateway.php new file mode 100644 index 000000000000..234827599ae4 --- /dev/null +++ b/NetworkServices/src/V1/Gateway.php @@ -0,0 +1,444 @@ +google.cloud.networkservices.v1.Gateway + */ +class Gateway extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Gateway resource. It matches pattern + * `projects/*/locations/*/gateways/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Set of label tags associated with the Gateway resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Immutable. The type of the customer managed gateway. + * This field is required. If unspecified, an error is returned. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway.Type type = 6 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $type = 0; + /** + * Required. One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * + * Generated from protobuf field repeated int32 ports = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ports; + /** + * Required. Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + * + * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $scope = ''; + /** + * Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how + * TLS traffic is terminated. If empty, TLS termination is disabled. + * + * Generated from protobuf field string server_tls_policy = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $server_tls_policy = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the Gateway resource. It matches pattern + * `projects/*/locations/*/gateways/`. + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the Gateway resource. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type int $type + * Immutable. The type of the customer managed gateway. + * This field is required. If unspecified, an error is returned. + * @type array|\Google\Protobuf\Internal\RepeatedField $ports + * Required. One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * @type string $scope + * Required. Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + * @type string $server_tls_policy + * Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how + * TLS traffic is terminated. If empty, TLS termination is disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Gateway resource. It matches pattern + * `projects/*/locations/*/gateways/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the Gateway resource. It matches pattern + * `projects/*/locations/*/gateways/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Set of label tags associated with the Gateway resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the Gateway resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Immutable. The type of the customer managed gateway. + * This field is required. If unspecified, an error is returned. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway.Type type = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Immutable. The type of the customer managed gateway. + * This field is required. If unspecified, an error is returned. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway.Type type = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\Gateway\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Required. One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * + * Generated from protobuf field repeated int32 ports = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPorts() + { + return $this->ports; + } + + /** + * Required. One or more ports that the Gateway must receive traffic on. The + * proxy binds to the ports specified. Gateway listen on 0.0.0.0 on the ports + * specified below. + * + * Generated from protobuf field repeated int32 ports = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPorts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->ports = $arr; + + return $this; + } + + /** + * Required. Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + * + * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Required. Immutable. Scope determines how configuration across multiple + * Gateway instances are merged. The configuration for multiple Gateway + * instances with the same scope will be merged as presented as a single + * coniguration to the proxy/load balancer. + * Max length 64 characters. + * Scope should start with a letter and can only have letters, numbers, + * hyphens. + * + * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how + * TLS traffic is terminated. If empty, TLS termination is disabled. + * + * Generated from protobuf field string server_tls_policy = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServerTlsPolicy() + { + return $this->server_tls_policy; + } + + /** + * Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how + * TLS traffic is terminated. If empty, TLS termination is disabled. + * + * Generated from protobuf field string server_tls_policy = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServerTlsPolicy($var) + { + GPBUtil::checkString($var, True); + $this->server_tls_policy = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/Gateway/Type.php b/NetworkServices/src/V1/Gateway/Type.php new file mode 100644 index 000000000000..db55d3853089 --- /dev/null +++ b/NetworkServices/src/V1/Gateway/Type.php @@ -0,0 +1,66 @@ +google.cloud.networkservices.v1.Gateway.Type + */ +class Type +{ + /** + * The type of the customer managed gateway is unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * The type of the customer managed gateway is TrafficDirector Open + * Mesh. + * + * Generated from protobuf enum OPEN_MESH = 1; + */ + const OPEN_MESH = 1; + /** + * The type of the customer managed gateway is SecureWebGateway (SWG). + * + * Generated from protobuf enum SECURE_WEB_GATEWAY = 2; + */ + const SECURE_WEB_GATEWAY = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::OPEN_MESH => 'OPEN_MESH', + self::SECURE_WEB_GATEWAY => 'SECURE_WEB_GATEWAY', + ]; + + 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/NetworkServices/src/V1/GetEndpointPolicyRequest.php b/NetworkServices/src/V1/GetEndpointPolicyRequest.php new file mode 100644 index 000000000000..185d8ae98028 --- /dev/null +++ b/NetworkServices/src/V1/GetEndpointPolicyRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetEndpointPolicyRequest + */ +class GetEndpointPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the EndpointPolicy to get. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the EndpointPolicy to get. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the EndpointPolicy to get. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the EndpointPolicy to get. Must be in the format + * `projects/*/locations/global/endpointPolicies/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetGatewayRequest.php b/NetworkServices/src/V1/GetGatewayRequest.php new file mode 100644 index 000000000000..94c1dd152792 --- /dev/null +++ b/NetworkServices/src/V1/GetGatewayRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetGatewayRequest + */ +class GetGatewayRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the Gateway to get. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the Gateway to get. Must be in the format + * `projects/*/locations/*/gateways/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the Gateway to get. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the Gateway to get. Must be in the format + * `projects/*/locations/*/gateways/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetGrpcRouteRequest.php b/NetworkServices/src/V1/GetGrpcRouteRequest.php new file mode 100644 index 000000000000..a78e9293575a --- /dev/null +++ b/NetworkServices/src/V1/GetGrpcRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetGrpcRouteRequest + */ +class GetGrpcRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the GrpcRoute to get. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the GrpcRoute to get. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the GrpcRoute to get. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the GrpcRoute to get. Must be in the format + * `projects/*/locations/global/grpcRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetHttpRouteRequest.php b/NetworkServices/src/V1/GetHttpRouteRequest.php new file mode 100644 index 000000000000..6a0950a4ae8a --- /dev/null +++ b/NetworkServices/src/V1/GetHttpRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetHttpRouteRequest + */ +class GetHttpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the HttpRoute to get. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the HttpRoute to get. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the HttpRoute to get. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the HttpRoute to get. Must be in the format + * `projects/*/locations/global/httpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetLbRouteExtensionRequest.php b/NetworkServices/src/V1/GetLbRouteExtensionRequest.php new file mode 100644 index 000000000000..8392a00c0eb2 --- /dev/null +++ b/NetworkServices/src/V1/GetLbRouteExtensionRequest.php @@ -0,0 +1,75 @@ +google.cloud.networkservices.v1.GetLbRouteExtensionRequest + */ +class GetLbRouteExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the `LbRouteExtension` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the `LbRouteExtension` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the `LbRouteExtension` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the `LbRouteExtension` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetLbTrafficExtensionRequest.php b/NetworkServices/src/V1/GetLbTrafficExtensionRequest.php new file mode 100644 index 000000000000..c8ddafef9721 --- /dev/null +++ b/NetworkServices/src/V1/GetLbTrafficExtensionRequest.php @@ -0,0 +1,75 @@ +google.cloud.networkservices.v1.GetLbTrafficExtensionRequest + */ +class GetLbTrafficExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the `LbTrafficExtension` resource to get. Must be in + * the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the `LbTrafficExtension` resource to get. Must be in + * the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the `LbTrafficExtension` resource to get. Must be in + * the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the `LbTrafficExtension` resource to get. Must be in + * the format + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetMeshRequest.php b/NetworkServices/src/V1/GetMeshRequest.php new file mode 100644 index 000000000000..268a9a24efca --- /dev/null +++ b/NetworkServices/src/V1/GetMeshRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetMeshRequest + */ +class GetMeshRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the Mesh to get. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the Mesh to get. Must be in the format + * `projects/*/locations/global/meshes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the Mesh to get. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the Mesh to get. Must be in the format + * `projects/*/locations/global/meshes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetServiceBindingRequest.php b/NetworkServices/src/V1/GetServiceBindingRequest.php new file mode 100644 index 000000000000..36a12ec1ce97 --- /dev/null +++ b/NetworkServices/src/V1/GetServiceBindingRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetServiceBindingRequest + */ +class GetServiceBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the ServiceBinding to get. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the ServiceBinding to get. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the ServiceBinding to get. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the ServiceBinding to get. Must be in the format + * `projects/*/locations/global/serviceBindings/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetTcpRouteRequest.php b/NetworkServices/src/V1/GetTcpRouteRequest.php new file mode 100644 index 000000000000..9fc56eba0b6a --- /dev/null +++ b/NetworkServices/src/V1/GetTcpRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetTcpRouteRequest + */ +class GetTcpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the TcpRoute to get. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the TcpRoute to get. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the TcpRoute to get. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the TcpRoute to get. Must be in the format + * `projects/*/locations/global/tcpRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GetTlsRouteRequest.php b/NetworkServices/src/V1/GetTlsRouteRequest.php new file mode 100644 index 000000000000..89e92b962a86 --- /dev/null +++ b/NetworkServices/src/V1/GetTlsRouteRequest.php @@ -0,0 +1,71 @@ +google.cloud.networkservices.v1.GetTlsRouteRequest + */ +class GetTlsRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the TlsRoute to get. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the TlsRoute to get. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the TlsRoute to get. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the TlsRoute to get. Must be in the format + * `projects/*/locations/global/tlsRoutes/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GrpcRoute.php b/NetworkServices/src/V1/GrpcRoute.php new file mode 100644 index 000000000000..2404004aec76 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute.php @@ -0,0 +1,534 @@ +google.cloud.networkservices.v1.GrpcRoute + */ +class GrpcRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the GrpcRoute resource. It matches pattern + * `projects/*/locations/global/grpcRoutes/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Set of label tags associated with the GrpcRoute resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. Service hostnames with an optional port for which this route + * describes traffic. + * Format: [:] + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + * + * Generated from protobuf field repeated string hostnames = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + private $hostnames; + /** + * Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * + * Generated from protobuf field repeated string meshes = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $meshes; + /** + * Optional. Gateways defines a list of gateways this GrpcRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 10 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $gateways; + /** + * Required. A list of detailed rules defining how to route traffic. + * Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the + * first matching GrpcRoute.RouteRule will be executed. At least one rule + * must be supplied. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteRule rules = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the GrpcRoute resource. It matches pattern + * `projects/*/locations/global/grpcRoutes/` + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the GrpcRoute resource. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type array|\Google\Protobuf\Internal\RepeatedField $hostnames + * Required. Service hostnames with an optional port for which this route + * describes traffic. + * Format: [:] + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + * @type array|\Google\Protobuf\Internal\RepeatedField $meshes + * Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * @type array|\Google\Protobuf\Internal\RepeatedField $gateways + * Optional. Gateways defines a list of gateways this GrpcRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * @type array<\Google\Cloud\NetworkServices\V1\GrpcRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $rules + * Required. A list of detailed rules defining how to route traffic. + * Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the + * first matching GrpcRoute.RouteRule will be executed. At least one rule + * must be supplied. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the GrpcRoute resource. It matches pattern + * `projects/*/locations/global/grpcRoutes/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the GrpcRoute resource. It matches pattern + * `projects/*/locations/global/grpcRoutes/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Set of label tags associated with the GrpcRoute resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the GrpcRoute resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Service hostnames with an optional port for which this route + * describes traffic. + * Format: [:] + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + * + * Generated from protobuf field repeated string hostnames = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHostnames() + { + return $this->hostnames; + } + + /** + * Required. Service hostnames with an optional port for which this route + * describes traffic. + * Format: [:] + * Hostname is the fully qualified domain name of a network host. This matches + * the RFC 1123 definition of a hostname with 2 notable exceptions: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateway must have unique hostnames. If + * you attempt to attach multiple routes with conflicting hostnames, the + * configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is + * not possible to associate two routes both with `*.bar.com` or both with + * `bar.com`. + * If a port is specified, then gRPC clients must use the channel URI with the + * port to match this rule (i.e. "xds:///service:123"), otherwise they must + * supply the URI without a port (i.e. "xds:///service"). + * + * Generated from protobuf field repeated string hostnames = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHostnames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->hostnames = $arr; + + return $this; + } + + /** + * Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * + * Generated from protobuf field repeated string meshes = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeshes() + { + return $this->meshes; + } + + /** + * Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * + * Generated from protobuf field repeated string meshes = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeshes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->meshes = $arr; + + return $this; + } + + /** + * Optional. Gateways defines a list of gateways this GrpcRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 10 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * Optional. Gateways defines a list of gateways this GrpcRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 10 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGateways($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->gateways = $arr; + + return $this; + } + + /** + * Required. A list of detailed rules defining how to route traffic. + * Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the + * first matching GrpcRoute.RouteRule will be executed. At least one rule + * must be supplied. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteRule rules = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Required. A list of detailed rules defining how to route traffic. + * Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the + * first matching GrpcRoute.RouteRule will be executed. At least one rule + * must be supplied. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteRule rules = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\GrpcRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteRule::class); + $this->rules = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/GrpcRoute/Destination.php b/NetworkServices/src/V1/GrpcRoute/Destination.php new file mode 100644 index 000000000000..4a86ffa2e4a0 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/Destination.php @@ -0,0 +1,163 @@ +google.cloud.networkservices.v1.GrpcRoute.Destination + */ +class Destination extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field optional int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $weight = null; + protected $destination_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_name + * Required. The URL of a destination service to which to route traffic. + * Must refer to either a BackendService or ServiceDirectoryService. + * @type int $weight + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URL of a destination service to which to route traffic. + * Must refer to either a BackendService or ServiceDirectoryService. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getServiceName() + { + return $this->readOneof(1); + } + + public function hasServiceName() + { + return $this->hasOneof(1); + } + + /** + * Required. The URL of a destination service to which to route traffic. + * Must refer to either a BackendService or ServiceDirectoryService. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field optional int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getWeight() + { + return isset($this->weight) ? $this->weight : 0; + } + + public function hasWeight() + { + return isset($this->weight); + } + + public function clearWeight() + { + unset($this->weight); + } + + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field optional int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setWeight($var) + { + GPBUtil::checkInt32($var); + $this->weight = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestinationType() + { + return $this->whichOneof("destination_type"); + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy.php b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy.php new file mode 100644 index 000000000000..66fe88cebbf6 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy.php @@ -0,0 +1,127 @@ +google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy + */ +class FaultInjectionPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay delay = 1; + */ + protected $delay = null; + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort abort = 2; + */ + protected $abort = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Delay $delay + * The specification for injecting delay to client requests. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Abort $abort + * The specification for aborting to client requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay delay = 1; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Delay|null + */ + public function getDelay() + { + return $this->delay; + } + + public function hasDelay() + { + return isset($this->delay); + } + + public function clearDelay() + { + unset($this->delay); + } + + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay delay = 1; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Delay $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Delay::class); + $this->delay = $var; + + return $this; + } + + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort abort = 2; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Abort|null + */ + public function getAbort() + { + return $this->abort; + } + + public function hasAbort() + { + return isset($this->abort); + } + + public function clearAbort() + { + unset($this->abort); + } + + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort abort = 2; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Abort $var + * @return $this + */ + public function setAbort($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy\Abort::class); + $this->abort = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Abort.php b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Abort.php new file mode 100644 index 000000000000..5410ea0bd2ac --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Abort.php @@ -0,0 +1,131 @@ +google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort + */ +class Abort extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field optional int32 http_status = 1; + */ + protected $http_status = null; + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + */ + protected $percentage = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $http_status + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * @type int $percentage + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field optional int32 http_status = 1; + * @return int + */ + public function getHttpStatus() + { + return isset($this->http_status) ? $this->http_status : 0; + } + + public function hasHttpStatus() + { + return isset($this->http_status); + } + + public function clearHttpStatus() + { + unset($this->http_status); + } + + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field optional int32 http_status = 1; + * @param int $var + * @return $this + */ + public function setHttpStatus($var) + { + GPBUtil::checkInt32($var); + $this->http_status = $var; + + return $this; + } + + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + * @return int + */ + public function getPercentage() + { + return isset($this->percentage) ? $this->percentage : 0; + } + + public function hasPercentage() + { + return isset($this->percentage); + } + + public function clearPercentage() + { + unset($this->percentage); + } + + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + * @param int $var + * @return $this + */ + public function setPercentage($var) + { + GPBUtil::checkInt32($var); + $this->percentage = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Delay.php b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Delay.php new file mode 100644 index 000000000000..a68314953ff2 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/FaultInjectionPolicy/Delay.php @@ -0,0 +1,127 @@ +google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay + */ +class Delay extends \Google\Protobuf\Internal\Message +{ + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field optional .google.protobuf.Duration fixed_delay = 1; + */ + protected $fixed_delay = null; + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + */ + protected $percentage = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $fixed_delay + * Specify a fixed delay before forwarding the request. + * @type int $percentage + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field optional .google.protobuf.Duration fixed_delay = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getFixedDelay() + { + return $this->fixed_delay; + } + + public function hasFixedDelay() + { + return isset($this->fixed_delay); + } + + public function clearFixedDelay() + { + unset($this->fixed_delay); + } + + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field optional .google.protobuf.Duration fixed_delay = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setFixedDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->fixed_delay = $var; + + return $this; + } + + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + * @return int + */ + public function getPercentage() + { + return isset($this->percentage) ? $this->percentage : 0; + } + + public function hasPercentage() + { + return isset($this->percentage); + } + + public function clearPercentage() + { + unset($this->percentage); + } + + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field optional int32 percentage = 2; + * @param int $var + * @return $this + */ + public function setPercentage($var) + { + GPBUtil::checkInt32($var); + $this->percentage = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/HeaderMatch.php b/NetworkServices/src/V1/GrpcRoute/HeaderMatch.php new file mode 100644 index 000000000000..262656cf1653 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/HeaderMatch.php @@ -0,0 +1,140 @@ +google.cloud.networkservices.v1.GrpcRoute.HeaderMatch + */ +class HeaderMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies how to match against the value of the header. If not + * specified, a default value of EXACT is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + /** + * Required. The key of the header. + * + * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key = ''; + /** + * Required. The value of the header. + * + * Generated from protobuf field string value = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Optional. Specifies how to match against the value of the header. If not + * specified, a default value of EXACT is used. + * @type string $key + * Required. The key of the header. + * @type string $value + * Required. The value of the header. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Specifies how to match against the value of the header. If not + * specified, a default value of EXACT is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. Specifies how to match against the value of the header. If not + * specified, a default value of EXACT is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\HeaderMatch\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Required. The key of the header. + * + * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Required. The key of the header. + * + * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Required. The value of the header. + * + * Generated from protobuf field string value = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The value of the header. + * + * Generated from protobuf field string value = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/HeaderMatch/Type.php b/NetworkServices/src/V1/GrpcRoute/HeaderMatch/Type.php new file mode 100644 index 000000000000..d9a3d9463930 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/HeaderMatch/Type.php @@ -0,0 +1,63 @@ +google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type + */ +class Type +{ + /** + * Unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Will only match the exact value provided. + * + * Generated from protobuf enum EXACT = 1; + */ + const EXACT = 1; + /** + * Will match paths conforming to the prefix specified by value. RE2 + * syntax is supported. + * + * Generated from protobuf enum REGULAR_EXPRESSION = 2; + */ + const REGULAR_EXPRESSION = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::EXACT => 'EXACT', + self::REGULAR_EXPRESSION => 'REGULAR_EXPRESSION', + ]; + + 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/NetworkServices/src/V1/GrpcRoute/MethodMatch.php b/NetworkServices/src/V1/GrpcRoute/MethodMatch.php new file mode 100644 index 000000000000..09aa288199ad --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/MethodMatch.php @@ -0,0 +1,200 @@ +google.cloud.networkservices.v1.GrpcRoute.MethodMatch + */ +class MethodMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies how to match against the name. If not specified, a + * default value of "EXACT" is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + /** + * Required. Name of the service to match against. If unspecified, will + * match all services. + * + * Generated from protobuf field string grpc_service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $grpc_service = ''; + /** + * Required. Name of the method to match against. If unspecified, will match + * all methods. + * + * Generated from protobuf field string grpc_method = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $grpc_method = ''; + /** + * Optional. Specifies that matches are case sensitive. The default value + * is true. case_sensitive must not be used with a type of + * REGULAR_EXPRESSION. + * + * Generated from protobuf field optional bool case_sensitive = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $case_sensitive = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Optional. Specifies how to match against the name. If not specified, a + * default value of "EXACT" is used. + * @type string $grpc_service + * Required. Name of the service to match against. If unspecified, will + * match all services. + * @type string $grpc_method + * Required. Name of the method to match against. If unspecified, will match + * all methods. + * @type bool $case_sensitive + * Optional. Specifies that matches are case sensitive. The default value + * is true. case_sensitive must not be used with a type of + * REGULAR_EXPRESSION. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Specifies how to match against the name. If not specified, a + * default value of "EXACT" is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. Specifies how to match against the name. If not specified, a + * default value of "EXACT" is used. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Required. Name of the service to match against. If unspecified, will + * match all services. + * + * Generated from protobuf field string grpc_service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGrpcService() + { + return $this->grpc_service; + } + + /** + * Required. Name of the service to match against. If unspecified, will + * match all services. + * + * Generated from protobuf field string grpc_service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGrpcService($var) + { + GPBUtil::checkString($var, True); + $this->grpc_service = $var; + + return $this; + } + + /** + * Required. Name of the method to match against. If unspecified, will match + * all methods. + * + * Generated from protobuf field string grpc_method = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGrpcMethod() + { + return $this->grpc_method; + } + + /** + * Required. Name of the method to match against. If unspecified, will match + * all methods. + * + * Generated from protobuf field string grpc_method = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGrpcMethod($var) + { + GPBUtil::checkString($var, True); + $this->grpc_method = $var; + + return $this; + } + + /** + * Optional. Specifies that matches are case sensitive. The default value + * is true. case_sensitive must not be used with a type of + * REGULAR_EXPRESSION. + * + * Generated from protobuf field optional bool case_sensitive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getCaseSensitive() + { + return isset($this->case_sensitive) ? $this->case_sensitive : false; + } + + public function hasCaseSensitive() + { + return isset($this->case_sensitive); + } + + public function clearCaseSensitive() + { + unset($this->case_sensitive); + } + + /** + * Optional. Specifies that matches are case sensitive. The default value + * is true. case_sensitive must not be used with a type of + * REGULAR_EXPRESSION. + * + * Generated from protobuf field optional bool case_sensitive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setCaseSensitive($var) + { + GPBUtil::checkBool($var); + $this->case_sensitive = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/MethodMatch/Type.php b/NetworkServices/src/V1/GrpcRoute/MethodMatch/Type.php new file mode 100644 index 000000000000..bd338efc7c0c --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/MethodMatch/Type.php @@ -0,0 +1,63 @@ +google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type + */ +class Type +{ + /** + * Unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Will only match the exact name provided. + * + * Generated from protobuf enum EXACT = 1; + */ + const EXACT = 1; + /** + * Will interpret grpc_method and grpc_service as regexes. RE2 syntax is + * supported. + * + * Generated from protobuf enum REGULAR_EXPRESSION = 2; + */ + const REGULAR_EXPRESSION = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::EXACT => 'EXACT', + self::REGULAR_EXPRESSION => 'REGULAR_EXPRESSION', + ]; + + 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/NetworkServices/src/V1/GrpcRoute/RetryPolicy.php b/NetworkServices/src/V1/GrpcRoute/RetryPolicy.php new file mode 100644 index 000000000000..af01dc57b8d7 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/RetryPolicy.php @@ -0,0 +1,166 @@ +google.cloud.networkservices.v1.GrpcRoute.RetryPolicy + */ +class RetryPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * - connect-failure: Router will retry on failures connecting to Backend + * Services, for example due to connection timeouts. + * - refused-stream: Router will retry if the backend service resets the + * stream + * with a REFUSED_STREAM error code. This reset type indicates that it is + * safe to retry. + * - cancelled: Router will retry if the gRPC status code in the response + * header + * is set to cancelled + * - deadline-exceeded: Router will retry if the gRPC status code in the + * response + * header is set to deadline-exceeded + * - resource-exhausted: Router will retry if the gRPC status code in the + * response header is set to resource-exhausted + * - unavailable: Router will retry if the gRPC status code in the response + * header is set to unavailable + * + * Generated from protobuf field repeated string retry_conditions = 1; + */ + private $retry_conditions; + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field uint32 num_retries = 2; + */ + protected $num_retries = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $retry_conditions + * - connect-failure: Router will retry on failures connecting to Backend + * Services, for example due to connection timeouts. + * - refused-stream: Router will retry if the backend service resets the + * stream + * with a REFUSED_STREAM error code. This reset type indicates that it is + * safe to retry. + * - cancelled: Router will retry if the gRPC status code in the response + * header + * is set to cancelled + * - deadline-exceeded: Router will retry if the gRPC status code in the + * response + * header is set to deadline-exceeded + * - resource-exhausted: Router will retry if the gRPC status code in the + * response header is set to resource-exhausted + * - unavailable: Router will retry if the gRPC status code in the response + * header is set to unavailable + * @type int $num_retries + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * - connect-failure: Router will retry on failures connecting to Backend + * Services, for example due to connection timeouts. + * - refused-stream: Router will retry if the backend service resets the + * stream + * with a REFUSED_STREAM error code. This reset type indicates that it is + * safe to retry. + * - cancelled: Router will retry if the gRPC status code in the response + * header + * is set to cancelled + * - deadline-exceeded: Router will retry if the gRPC status code in the + * response + * header is set to deadline-exceeded + * - resource-exhausted: Router will retry if the gRPC status code in the + * response header is set to resource-exhausted + * - unavailable: Router will retry if the gRPC status code in the response + * header is set to unavailable + * + * Generated from protobuf field repeated string retry_conditions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRetryConditions() + { + return $this->retry_conditions; + } + + /** + * - connect-failure: Router will retry on failures connecting to Backend + * Services, for example due to connection timeouts. + * - refused-stream: Router will retry if the backend service resets the + * stream + * with a REFUSED_STREAM error code. This reset type indicates that it is + * safe to retry. + * - cancelled: Router will retry if the gRPC status code in the response + * header + * is set to cancelled + * - deadline-exceeded: Router will retry if the gRPC status code in the + * response + * header is set to deadline-exceeded + * - resource-exhausted: Router will retry if the gRPC status code in the + * response header is set to resource-exhausted + * - unavailable: Router will retry if the gRPC status code in the response + * header is set to unavailable + * + * Generated from protobuf field repeated string retry_conditions = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRetryConditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->retry_conditions = $arr; + + return $this; + } + + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field uint32 num_retries = 2; + * @return int + */ + public function getNumRetries() + { + return $this->num_retries; + } + + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field uint32 num_retries = 2; + * @param int $var + * @return $this + */ + public function setNumRetries($var) + { + GPBUtil::checkUint32($var); + $this->num_retries = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/RouteAction.php b/NetworkServices/src/V1/GrpcRoute/RouteAction.php new file mode 100644 index 000000000000..de116a6717b2 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/RouteAction.php @@ -0,0 +1,248 @@ +google.cloud.networkservices.v1.GrpcRoute.RouteAction + */ +class RouteAction extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The destination services to which traffic should be forwarded. + * If multiple destinations are specified, traffic will be split between + * Backend Service(s) according to the weight field of these destinations. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.Destination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $destinations; + /** + * Optional. The specification for fault injection introduced into traffic to test the + * resiliency of clients to destination service failure. As part of fault + * injection, when clients send requests to a destination, delays can be + * introduced on a percentage of requests before sending those requests to + * the destination service. Similarly requests from clients can be aborted + * by for a percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy fault_injection_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $fault_injection_policy = null; + /** + * Optional. Specifies the timeout for selected route. Timeout is computed + * from the time the request has been fully processed (i.e. end of stream) + * up until the response has been completely processed. Timeout includes all + * retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $timeout = null; + /** + * Optional. Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RetryPolicy retry_policy = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retry_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\GrpcRoute\Destination>|\Google\Protobuf\Internal\RepeatedField $destinations + * Optional. The destination services to which traffic should be forwarded. + * If multiple destinations are specified, traffic will be split between + * Backend Service(s) according to the weight field of these destinations. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy $fault_injection_policy + * Optional. The specification for fault injection introduced into traffic to test the + * resiliency of clients to destination service failure. As part of fault + * injection, when clients send requests to a destination, delays can be + * introduced on a percentage of requests before sending those requests to + * the destination service. Similarly requests from clients can be aborted + * by for a percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * @type \Google\Protobuf\Duration $timeout + * Optional. Specifies the timeout for selected route. Timeout is computed + * from the time the request has been fully processed (i.e. end of stream) + * up until the response has been completely processed. Timeout includes all + * retries. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\RetryPolicy $retry_policy + * Optional. Specifies the retry policy associated with this route. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The destination services to which traffic should be forwarded. + * If multiple destinations are specified, traffic will be split between + * Backend Service(s) according to the weight field of these destinations. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.Destination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinations() + { + return $this->destinations; + } + + /** + * Optional. The destination services to which traffic should be forwarded. + * If multiple destinations are specified, traffic will be split between + * Backend Service(s) according to the weight field of these destinations. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.Destination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\NetworkServices\V1\GrpcRoute\Destination>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\GrpcRoute\Destination::class); + $this->destinations = $arr; + + return $this; + } + + /** + * Optional. The specification for fault injection introduced into traffic to test the + * resiliency of clients to destination service failure. As part of fault + * injection, when clients send requests to a destination, delays can be + * introduced on a percentage of requests before sending those requests to + * the destination service. Similarly requests from clients can be aborted + * by for a percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy fault_injection_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy|null + */ + public function getFaultInjectionPolicy() + { + return $this->fault_injection_policy; + } + + public function hasFaultInjectionPolicy() + { + return isset($this->fault_injection_policy); + } + + public function clearFaultInjectionPolicy() + { + unset($this->fault_injection_policy); + } + + /** + * Optional. The specification for fault injection introduced into traffic to test the + * resiliency of clients to destination service failure. As part of fault + * injection, when clients send requests to a destination, delays can be + * introduced on a percentage of requests before sending those requests to + * the destination service. Similarly requests from clients can be aborted + * by for a percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy fault_injection_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy $var + * @return $this + */ + public function setFaultInjectionPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\FaultInjectionPolicy::class); + $this->fault_injection_policy = $var; + + return $this; + } + + /** + * Optional. Specifies the timeout for selected route. Timeout is computed + * from the time the request has been fully processed (i.e. end of stream) + * up until the response has been completely processed. Timeout includes all + * retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * Optional. Specifies the timeout for selected route. Timeout is computed + * from the time the request has been fully processed (i.e. end of stream) + * up until the response has been completely processed. Timeout includes all + * retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Optional. Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RetryPolicy retry_policy = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\RetryPolicy|null + */ + public function getRetryPolicy() + { + return $this->retry_policy; + } + + public function hasRetryPolicy() + { + return isset($this->retry_policy); + } + + public function clearRetryPolicy() + { + unset($this->retry_policy); + } + + /** + * Optional. Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RetryPolicy retry_policy = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\RetryPolicy $var + * @return $this + */ + public function setRetryPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\RetryPolicy::class); + $this->retry_policy = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/RouteMatch.php b/NetworkServices/src/V1/GrpcRoute/RouteMatch.php new file mode 100644 index 000000000000..42b682b8cbc3 --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/RouteMatch.php @@ -0,0 +1,117 @@ +google.cloud.networkservices.v1.GrpcRoute.RouteMatch + */ +class RouteMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A gRPC method to match against. If this field is empty or + * omitted, will match all methods. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.MethodMatch method = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $method = null; + /** + * Optional. Specifies a collection of headers to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch headers = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $headers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch $method + * Optional. A gRPC method to match against. If this field is empty or + * omitted, will match all methods. + * @type array<\Google\Cloud\NetworkServices\V1\GrpcRoute\HeaderMatch>|\Google\Protobuf\Internal\RepeatedField $headers + * Optional. Specifies a collection of headers to match. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A gRPC method to match against. If this field is empty or + * omitted, will match all methods. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.MethodMatch method = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch|null + */ + public function getMethod() + { + return $this->method; + } + + public function hasMethod() + { + return isset($this->method); + } + + public function clearMethod() + { + unset($this->method); + } + + /** + * Optional. A gRPC method to match against. If this field is empty or + * omitted, will match all methods. + * + * Generated from protobuf field optional .google.cloud.networkservices.v1.GrpcRoute.MethodMatch method = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch $var + * @return $this + */ + public function setMethod($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\MethodMatch::class); + $this->method = $var; + + return $this; + } + + /** + * Optional. Specifies a collection of headers to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch headers = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * Optional. Specifies a collection of headers to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.HeaderMatch headers = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\NetworkServices\V1\GrpcRoute\HeaderMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\GrpcRoute\HeaderMatch::class); + $this->headers = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/GrpcRoute/RouteRule.php b/NetworkServices/src/V1/GrpcRoute/RouteRule.php new file mode 100644 index 000000000000..97b6b43f567e --- /dev/null +++ b/NetworkServices/src/V1/GrpcRoute/RouteRule.php @@ -0,0 +1,128 @@ +google.cloud.networkservices.v1.GrpcRoute.RouteRule + */ +class RouteRule extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Matches define conditions used for matching the rule against + * incoming gRPC requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. If no matches field is + * specified, this rule will unconditionally match traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $matches; + /** + * Required. A detailed rule defining how to route traffic. This field is + * required. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\GrpcRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $matches + * Optional. Matches define conditions used for matching the rule against + * incoming gRPC requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. If no matches field is + * specified, this rule will unconditionally match traffic. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteAction $action + * Required. A detailed rule defining how to route traffic. This field is + * required. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Matches define conditions used for matching the rule against + * incoming gRPC requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. If no matches field is + * specified, this rule will unconditionally match traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMatches() + { + return $this->matches; + } + + /** + * Optional. Matches define conditions used for matching the rule against + * incoming gRPC requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. If no matches field is + * specified, this rule will unconditionally match traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\NetworkServices\V1\GrpcRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMatches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteMatch::class); + $this->matches = $arr; + + return $this; + } + + /** + * Required. A detailed rule defining how to route traffic. This field is + * required. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteAction|null + */ + public function getAction() + { + return $this->action; + } + + public function hasAction() + { + return isset($this->action); + } + + public function clearAction() + { + unset($this->action); + } + + /** + * Required. A detailed rule defining how to route traffic. This field is + * required. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteAction $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute\RouteAction::class); + $this->action = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute.php b/NetworkServices/src/V1/HttpRoute.php new file mode 100644 index 000000000000..7663ee89f61e --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute.php @@ -0,0 +1,518 @@ +google.cloud.networkservices.v1.HttpRoute + */ +class HttpRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the HttpRoute resource. It matches pattern + * `projects/*/locations/global/httpRoutes/http_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + * + * Generated from protobuf field repeated string hostnames = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $hostnames; + /** + * Optional. Meshes defines a list of meshes this HttpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $meshes; + /** + * Optional. Gateways defines a list of gateways this HttpRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $gateways; + /** + * Optional. Set of label tags associated with the HttpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Required. Rules that define how traffic is routed and handled. + * Rules will be matched sequentially based on the RouteMatch specified for + * the rule. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteRule rules = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + private $rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the HttpRoute resource. It matches pattern + * `projects/*/locations/global/httpRoutes/http_route_name>`. + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type array|\Google\Protobuf\Internal\RepeatedField $hostnames + * Required. Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + * @type array|\Google\Protobuf\Internal\RepeatedField $meshes + * Optional. Meshes defines a list of meshes this HttpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * @type array|\Google\Protobuf\Internal\RepeatedField $gateways + * Optional. Gateways defines a list of gateways this HttpRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the HttpRoute resource. + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $rules + * Required. Rules that define how traffic is routed and handled. + * Rules will be matched sequentially based on the RouteMatch specified for + * the rule. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the HttpRoute resource. It matches pattern + * `projects/*/locations/global/httpRoutes/http_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the HttpRoute resource. It matches pattern + * `projects/*/locations/global/httpRoutes/http_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + * + * Generated from protobuf field repeated string hostnames = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHostnames() + { + return $this->hostnames; + } + + /** + * Required. Hostnames define a set of hosts that should match against the + * HTTP host header to select a HttpRoute to process the request. Hostname is + * the fully qualified domain name of a network host, as defined by RFC 1123 + * with the exception that: + * - IPs are not allowed. + * - A hostname may be prefixed with a wildcard label (`*.`). The wildcard + * label must appear by itself as the first label. + * Hostname can be "precise" which is a domain name without the terminating + * dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a + * domain name prefixed with a single wildcard label (e.g. `*.example.com`). + * Note that as per RFC1035 and RFC1123, a label must consist of lower case + * alphanumeric characters or '-', and must start and end with an alphanumeric + * character. No other punctuation is allowed. + * The routes associated with a Mesh or Gateways must have unique hostnames. + * If you attempt to attach multiple routes with conflicting hostnames, + * the configuration will be rejected. + * For example, while it is acceptable for routes for the hostnames + * `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or + * Gateways under the same scope), it is not possible to associate two routes + * both with `*.bar.com` or both with `bar.com`. + * + * Generated from protobuf field repeated string hostnames = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHostnames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->hostnames = $arr; + + return $this; + } + + /** + * Optional. Meshes defines a list of meshes this HttpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeshes() + { + return $this->meshes; + } + + /** + * Optional. Meshes defines a list of meshes this HttpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeshes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->meshes = $arr; + + return $this; + } + + /** + * Optional. Gateways defines a list of gateways this HttpRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * Optional. Gateways defines a list of gateways this HttpRoute is attached + * to, as one of the routing rules to route the requests served by the + * gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGateways($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->gateways = $arr; + + return $this; + } + + /** + * Optional. Set of label tags associated with the HttpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the HttpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. Rules that define how traffic is routed and handled. + * Rules will be matched sequentially based on the RouteMatch specified for + * the rule. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteRule rules = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Required. Rules that define how traffic is routed and handled. + * Rules will be matched sequentially based on the RouteMatch specified for + * the rule. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteRule rules = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute\RouteRule::class); + $this->rules = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/HttpRoute/CorsPolicy.php b/NetworkServices/src/V1/HttpRoute/CorsPolicy.php new file mode 100644 index 000000000000..933d8ca4ce6c --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/CorsPolicy.php @@ -0,0 +1,342 @@ +google.cloud.networkservices.v1.HttpRoute.CorsPolicy + */ +class CorsPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the list of origins that will be allowed to do CORS requests. + * An origin is allowed if it matches either an item in allow_origins or + * an item in allow_origin_regexes. + * + * Generated from protobuf field repeated string allow_origins = 1; + */ + private $allow_origins; + /** + * Specifies the regular expression patterns that match allowed origins. For + * regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax. + * + * Generated from protobuf field repeated string allow_origin_regexes = 2; + */ + private $allow_origin_regexes; + /** + * Specifies the content for Access-Control-Allow-Methods header. + * + * Generated from protobuf field repeated string allow_methods = 3; + */ + private $allow_methods; + /** + * Specifies the content for Access-Control-Allow-Headers header. + * + * Generated from protobuf field repeated string allow_headers = 4; + */ + private $allow_headers; + /** + * Specifies the content for Access-Control-Expose-Headers header. + * + * Generated from protobuf field repeated string expose_headers = 5; + */ + private $expose_headers; + /** + * Specifies how long result of a preflight request can be cached in + * seconds. This translates to the Access-Control-Max-Age header. + * + * Generated from protobuf field string max_age = 6; + */ + protected $max_age = ''; + /** + * In response to a preflight request, setting this to true indicates that + * the actual request can include user credentials. This translates to the + * Access-Control-Allow-Credentials header. + * Default value is false. + * + * Generated from protobuf field bool allow_credentials = 7; + */ + protected $allow_credentials = false; + /** + * If true, the CORS policy is disabled. The default value is false, which + * indicates that the CORS policy is in effect. + * + * Generated from protobuf field bool disabled = 8; + */ + protected $disabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allow_origins + * Specifies the list of origins that will be allowed to do CORS requests. + * An origin is allowed if it matches either an item in allow_origins or + * an item in allow_origin_regexes. + * @type array|\Google\Protobuf\Internal\RepeatedField $allow_origin_regexes + * Specifies the regular expression patterns that match allowed origins. For + * regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax. + * @type array|\Google\Protobuf\Internal\RepeatedField $allow_methods + * Specifies the content for Access-Control-Allow-Methods header. + * @type array|\Google\Protobuf\Internal\RepeatedField $allow_headers + * Specifies the content for Access-Control-Allow-Headers header. + * @type array|\Google\Protobuf\Internal\RepeatedField $expose_headers + * Specifies the content for Access-Control-Expose-Headers header. + * @type string $max_age + * Specifies how long result of a preflight request can be cached in + * seconds. This translates to the Access-Control-Max-Age header. + * @type bool $allow_credentials + * In response to a preflight request, setting this to true indicates that + * the actual request can include user credentials. This translates to the + * Access-Control-Allow-Credentials header. + * Default value is false. + * @type bool $disabled + * If true, the CORS policy is disabled. The default value is false, which + * indicates that the CORS policy is in effect. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the list of origins that will be allowed to do CORS requests. + * An origin is allowed if it matches either an item in allow_origins or + * an item in allow_origin_regexes. + * + * Generated from protobuf field repeated string allow_origins = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowOrigins() + { + return $this->allow_origins; + } + + /** + * Specifies the list of origins that will be allowed to do CORS requests. + * An origin is allowed if it matches either an item in allow_origins or + * an item in allow_origin_regexes. + * + * Generated from protobuf field repeated string allow_origins = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowOrigins($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allow_origins = $arr; + + return $this; + } + + /** + * Specifies the regular expression patterns that match allowed origins. For + * regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax. + * + * Generated from protobuf field repeated string allow_origin_regexes = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowOriginRegexes() + { + return $this->allow_origin_regexes; + } + + /** + * Specifies the regular expression patterns that match allowed origins. For + * regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax. + * + * Generated from protobuf field repeated string allow_origin_regexes = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowOriginRegexes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allow_origin_regexes = $arr; + + return $this; + } + + /** + * Specifies the content for Access-Control-Allow-Methods header. + * + * Generated from protobuf field repeated string allow_methods = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowMethods() + { + return $this->allow_methods; + } + + /** + * Specifies the content for Access-Control-Allow-Methods header. + * + * Generated from protobuf field repeated string allow_methods = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowMethods($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allow_methods = $arr; + + return $this; + } + + /** + * Specifies the content for Access-Control-Allow-Headers header. + * + * Generated from protobuf field repeated string allow_headers = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowHeaders() + { + return $this->allow_headers; + } + + /** + * Specifies the content for Access-Control-Allow-Headers header. + * + * Generated from protobuf field repeated string allow_headers = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allow_headers = $arr; + + return $this; + } + + /** + * Specifies the content for Access-Control-Expose-Headers header. + * + * Generated from protobuf field repeated string expose_headers = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExposeHeaders() + { + return $this->expose_headers; + } + + /** + * Specifies the content for Access-Control-Expose-Headers header. + * + * Generated from protobuf field repeated string expose_headers = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExposeHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->expose_headers = $arr; + + return $this; + } + + /** + * Specifies how long result of a preflight request can be cached in + * seconds. This translates to the Access-Control-Max-Age header. + * + * Generated from protobuf field string max_age = 6; + * @return string + */ + public function getMaxAge() + { + return $this->max_age; + } + + /** + * Specifies how long result of a preflight request can be cached in + * seconds. This translates to the Access-Control-Max-Age header. + * + * Generated from protobuf field string max_age = 6; + * @param string $var + * @return $this + */ + public function setMaxAge($var) + { + GPBUtil::checkString($var, True); + $this->max_age = $var; + + return $this; + } + + /** + * In response to a preflight request, setting this to true indicates that + * the actual request can include user credentials. This translates to the + * Access-Control-Allow-Credentials header. + * Default value is false. + * + * Generated from protobuf field bool allow_credentials = 7; + * @return bool + */ + public function getAllowCredentials() + { + return $this->allow_credentials; + } + + /** + * In response to a preflight request, setting this to true indicates that + * the actual request can include user credentials. This translates to the + * Access-Control-Allow-Credentials header. + * Default value is false. + * + * Generated from protobuf field bool allow_credentials = 7; + * @param bool $var + * @return $this + */ + public function setAllowCredentials($var) + { + GPBUtil::checkBool($var); + $this->allow_credentials = $var; + + return $this; + } + + /** + * If true, the CORS policy is disabled. The default value is false, which + * indicates that the CORS policy is in effect. + * + * Generated from protobuf field bool disabled = 8; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * If true, the CORS policy is disabled. The default value is false, which + * indicates that the CORS policy is in effect. + * + * Generated from protobuf field bool disabled = 8; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/Destination.php b/NetworkServices/src/V1/HttpRoute/Destination.php new file mode 100644 index 000000000000..11407089692a --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/Destination.php @@ -0,0 +1,142 @@ +google.cloud.networkservices.v1.HttpRoute.Destination + */ +class Destination extends \Google\Protobuf\Internal\Message +{ + /** + * The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.resource_reference) = { + */ + protected $service_name = ''; + /** + * Specifies the proportion of requests forwarded to the backend referenced + * by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2; + */ + protected $weight = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_name + * The URL of a BackendService to route traffic to. + * @type int $weight + * Specifies the proportion of requests forwarded to the backend referenced + * by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + + /** + * Specifies the proportion of requests forwarded to the backend referenced + * by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2; + * @return int + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Specifies the proportion of requests forwarded to the backend referenced + * by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2; + * @param int $var + * @return $this + */ + public function setWeight($var) + { + GPBUtil::checkInt32($var); + $this->weight = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy.php b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy.php new file mode 100644 index 000000000000..6c8150d71139 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy.php @@ -0,0 +1,127 @@ +google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy + */ +class FaultInjectionPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1; + */ + protected $delay = null; + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2; + */ + protected $abort = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay $delay + * The specification for injecting delay to client requests. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort $abort + * The specification for aborting to client requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay|null + */ + public function getDelay() + { + return $this->delay; + } + + public function hasDelay() + { + return isset($this->delay); + } + + public function clearDelay() + { + unset($this->delay); + } + + /** + * The specification for injecting delay to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay::class); + $this->delay = $var; + + return $this; + } + + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort|null + */ + public function getAbort() + { + return $this->abort; + } + + public function hasAbort() + { + return isset($this->abort); + } + + public function clearAbort() + { + unset($this->abort); + } + + /** + * The specification for aborting to client requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort $var + * @return $this + */ + public function setAbort($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort::class); + $this->abort = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Abort.php b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Abort.php new file mode 100644 index 000000000000..38c8ed390f7a --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Abort.php @@ -0,0 +1,111 @@ +google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort + */ +class Abort extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field int32 http_status = 1; + */ + protected $http_status = 0; + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + */ + protected $percentage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $http_status + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * @type int $percentage + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field int32 http_status = 1; + * @return int + */ + public function getHttpStatus() + { + return $this->http_status; + } + + /** + * The HTTP status code used to abort the request. + * The value must be between 200 and 599 inclusive. + * + * Generated from protobuf field int32 http_status = 1; + * @param int $var + * @return $this + */ + public function setHttpStatus($var) + { + GPBUtil::checkInt32($var); + $this->http_status = $var; + + return $this; + } + + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + * @return int + */ + public function getPercentage() + { + return $this->percentage; + } + + /** + * The percentage of traffic which will be aborted. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + * @param int $var + * @return $this + */ + public function setPercentage($var) + { + GPBUtil::checkInt32($var); + $this->percentage = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Delay.php b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Delay.php new file mode 100644 index 000000000000..59e0e4e5892e --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/FaultInjectionPolicy/Delay.php @@ -0,0 +1,117 @@ +google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay + */ +class Delay extends \Google\Protobuf\Internal\Message +{ + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field .google.protobuf.Duration fixed_delay = 1; + */ + protected $fixed_delay = null; + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + */ + protected $percentage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $fixed_delay + * Specify a fixed delay before forwarding the request. + * @type int $percentage + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field .google.protobuf.Duration fixed_delay = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getFixedDelay() + { + return $this->fixed_delay; + } + + public function hasFixedDelay() + { + return isset($this->fixed_delay); + } + + public function clearFixedDelay() + { + unset($this->fixed_delay); + } + + /** + * Specify a fixed delay before forwarding the request. + * + * Generated from protobuf field .google.protobuf.Duration fixed_delay = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setFixedDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->fixed_delay = $var; + + return $this; + } + + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + * @return int + */ + public function getPercentage() + { + return $this->percentage; + } + + /** + * The percentage of traffic on which delay will be injected. + * The value must be between [0, 100] + * + * Generated from protobuf field int32 percentage = 2; + * @param int $var + * @return $this + */ + public function setPercentage($var) + { + GPBUtil::checkInt32($var); + $this->percentage = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/HeaderMatch.php b/NetworkServices/src/V1/HttpRoute/HeaderMatch.php new file mode 100644 index 000000000000..f32578a97bb5 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/HeaderMatch.php @@ -0,0 +1,328 @@ +google.cloud.networkservices.v1.HttpRoute.HeaderMatch + */ +class HeaderMatch extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the HTTP header to match against. + * + * Generated from protobuf field string header = 1; + */ + protected $header = ''; + /** + * If specified, the match result will be inverted before checking. Default + * value is set to false. + * + * Generated from protobuf field bool invert_match = 8; + */ + protected $invert_match = false; + protected $MatchType; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $exact_match + * The value of the header should match exactly the content of + * exact_match. + * @type string $regex_match + * The value of the header must match the regular expression specified in + * regex_match. For regular expression grammar, please see: + * https://github.com/google/re2/wiki/Syntax + * @type string $prefix_match + * The value of the header must start with the contents of prefix_match. + * @type bool $present_match + * A header with header_name must exist. The match takes place whether or + * not the header has a value. + * @type string $suffix_match + * The value of the header must end with the contents of suffix_match. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch\IntegerRange $range_match + * If specified, the rule will match if the request header value is within + * the range. + * @type string $header + * The name of the HTTP header to match against. + * @type bool $invert_match + * If specified, the match result will be inverted before checking. Default + * value is set to false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The value of the header should match exactly the content of + * exact_match. + * + * Generated from protobuf field string exact_match = 2; + * @return string + */ + public function getExactMatch() + { + return $this->readOneof(2); + } + + public function hasExactMatch() + { + return $this->hasOneof(2); + } + + /** + * The value of the header should match exactly the content of + * exact_match. + * + * Generated from protobuf field string exact_match = 2; + * @param string $var + * @return $this + */ + public function setExactMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The value of the header must match the regular expression specified in + * regex_match. For regular expression grammar, please see: + * https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string regex_match = 3; + * @return string + */ + public function getRegexMatch() + { + return $this->readOneof(3); + } + + public function hasRegexMatch() + { + return $this->hasOneof(3); + } + + /** + * The value of the header must match the regular expression specified in + * regex_match. For regular expression grammar, please see: + * https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string regex_match = 3; + * @param string $var + * @return $this + */ + public function setRegexMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The value of the header must start with the contents of prefix_match. + * + * Generated from protobuf field string prefix_match = 4; + * @return string + */ + public function getPrefixMatch() + { + return $this->readOneof(4); + } + + public function hasPrefixMatch() + { + return $this->hasOneof(4); + } + + /** + * The value of the header must start with the contents of prefix_match. + * + * Generated from protobuf field string prefix_match = 4; + * @param string $var + * @return $this + */ + public function setPrefixMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A header with header_name must exist. The match takes place whether or + * not the header has a value. + * + * Generated from protobuf field bool present_match = 5; + * @return bool + */ + public function getPresentMatch() + { + return $this->readOneof(5); + } + + public function hasPresentMatch() + { + return $this->hasOneof(5); + } + + /** + * A header with header_name must exist. The match takes place whether or + * not the header has a value. + * + * Generated from protobuf field bool present_match = 5; + * @param bool $var + * @return $this + */ + public function setPresentMatch($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The value of the header must end with the contents of suffix_match. + * + * Generated from protobuf field string suffix_match = 6; + * @return string + */ + public function getSuffixMatch() + { + return $this->readOneof(6); + } + + public function hasSuffixMatch() + { + return $this->hasOneof(6); + } + + /** + * The value of the header must end with the contents of suffix_match. + * + * Generated from protobuf field string suffix_match = 6; + * @param string $var + * @return $this + */ + public function setSuffixMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * If specified, the rule will match if the request header value is within + * the range. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderMatch.IntegerRange range_match = 7; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch\IntegerRange|null + */ + public function getRangeMatch() + { + return $this->readOneof(7); + } + + public function hasRangeMatch() + { + return $this->hasOneof(7); + } + + /** + * If specified, the rule will match if the request header value is within + * the range. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderMatch.IntegerRange range_match = 7; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch\IntegerRange $var + * @return $this + */ + public function setRangeMatch($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch\IntegerRange::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * The name of the HTTP header to match against. + * + * Generated from protobuf field string header = 1; + * @return string + */ + public function getHeader() + { + return $this->header; + } + + /** + * The name of the HTTP header to match against. + * + * Generated from protobuf field string header = 1; + * @param string $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkString($var, True); + $this->header = $var; + + return $this; + } + + /** + * If specified, the match result will be inverted before checking. Default + * value is set to false. + * + * Generated from protobuf field bool invert_match = 8; + * @return bool + */ + public function getInvertMatch() + { + return $this->invert_match; + } + + /** + * If specified, the match result will be inverted before checking. Default + * value is set to false. + * + * Generated from protobuf field bool invert_match = 8; + * @param bool $var + * @return $this + */ + public function setInvertMatch($var) + { + GPBUtil::checkBool($var); + $this->invert_match = $var; + + return $this; + } + + /** + * @return string + */ + public function getMatchType() + { + return $this->whichOneof("MatchType"); + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/HeaderMatch/IntegerRange.php b/NetworkServices/src/V1/HttpRoute/HeaderMatch/IntegerRange.php new file mode 100644 index 000000000000..93c8a691649e --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/HeaderMatch/IntegerRange.php @@ -0,0 +1,102 @@ +google.cloud.networkservices.v1.HttpRoute.HeaderMatch.IntegerRange + */ +class IntegerRange extends \Google\Protobuf\Internal\Message +{ + /** + * Start of the range (inclusive) + * + * Generated from protobuf field int32 start = 1; + */ + protected $start = 0; + /** + * End of the range (exclusive) + * + * Generated from protobuf field int32 end = 2; + */ + protected $end = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Start of the range (inclusive) + * @type int $end + * End of the range (exclusive) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Start of the range (inclusive) + * + * Generated from protobuf field int32 start = 1; + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Start of the range (inclusive) + * + * Generated from protobuf field int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + + return $this; + } + + /** + * End of the range (exclusive) + * + * Generated from protobuf field int32 end = 2; + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * End of the range (exclusive) + * + * Generated from protobuf field int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/HeaderModifier.php b/NetworkServices/src/V1/HttpRoute/HeaderModifier.php new file mode 100644 index 000000000000..2d26748177ca --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/HeaderModifier.php @@ -0,0 +1,145 @@ +google.cloud.networkservices.v1.HttpRoute.HeaderModifier + */ +class HeaderModifier extends \Google\Protobuf\Internal\Message +{ + /** + * Completely overwrite/replace the headers with given map where key is the + * name of the header, value is the value of the header. + * + * Generated from protobuf field map set = 1; + */ + private $set; + /** + * Add the headers with given map where key is the name of the header, value + * is the value of the header. + * + * Generated from protobuf field map add = 2; + */ + private $add; + /** + * Remove headers (matching by header names) specified in the list. + * + * Generated from protobuf field repeated string remove = 3; + */ + private $remove; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $set + * Completely overwrite/replace the headers with given map where key is the + * name of the header, value is the value of the header. + * @type array|\Google\Protobuf\Internal\MapField $add + * Add the headers with given map where key is the name of the header, value + * is the value of the header. + * @type array|\Google\Protobuf\Internal\RepeatedField $remove + * Remove headers (matching by header names) specified in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Completely overwrite/replace the headers with given map where key is the + * name of the header, value is the value of the header. + * + * Generated from protobuf field map set = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getSet() + { + return $this->set; + } + + /** + * Completely overwrite/replace the headers with given map where key is the + * name of the header, value is the value of the header. + * + * Generated from protobuf field map set = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setSet($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->set = $arr; + + return $this; + } + + /** + * Add the headers with given map where key is the name of the header, value + * is the value of the header. + * + * Generated from protobuf field map add = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAdd() + { + return $this->add; + } + + /** + * Add the headers with given map where key is the name of the header, value + * is the value of the header. + * + * Generated from protobuf field map add = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAdd($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->add = $arr; + + return $this; + } + + /** + * Remove headers (matching by header names) specified in the list. + * + * Generated from protobuf field repeated string remove = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRemove() + { + return $this->remove; + } + + /** + * Remove headers (matching by header names) specified in the list. + * + * Generated from protobuf field repeated string remove = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRemove($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->remove = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/QueryParameterMatch.php b/NetworkServices/src/V1/HttpRoute/QueryParameterMatch.php new file mode 100644 index 000000000000..166456935351 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/QueryParameterMatch.php @@ -0,0 +1,200 @@ +google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch + */ +class QueryParameterMatch extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the query parameter to match. + * + * Generated from protobuf field string query_parameter = 1; + */ + protected $query_parameter = ''; + protected $MatchType; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $exact_match + * The value of the query parameter must exactly match the contents of + * exact_match. + * Only one of exact_match, regex_match, or present_match must be set. + * @type string $regex_match + * The value of the query parameter must match the regular expression + * specified by regex_match. For regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax + * Only one of exact_match, regex_match, or present_match must be set. + * @type bool $present_match + * Specifies that the QueryParameterMatcher matches if request contains + * query parameter, irrespective of whether the parameter has a value or + * not. + * Only one of exact_match, regex_match, or present_match must be set. + * @type string $query_parameter + * The name of the query parameter to match. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The value of the query parameter must exactly match the contents of + * exact_match. + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field string exact_match = 2; + * @return string + */ + public function getExactMatch() + { + return $this->readOneof(2); + } + + public function hasExactMatch() + { + return $this->hasOneof(2); + } + + /** + * The value of the query parameter must exactly match the contents of + * exact_match. + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field string exact_match = 2; + * @param string $var + * @return $this + */ + public function setExactMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The value of the query parameter must match the regular expression + * specified by regex_match. For regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field string regex_match = 3; + * @return string + */ + public function getRegexMatch() + { + return $this->readOneof(3); + } + + public function hasRegexMatch() + { + return $this->hasOneof(3); + } + + /** + * The value of the query parameter must match the regular expression + * specified by regex_match. For regular expression grammar, please see + * https://github.com/google/re2/wiki/Syntax + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field string regex_match = 3; + * @param string $var + * @return $this + */ + public function setRegexMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Specifies that the QueryParameterMatcher matches if request contains + * query parameter, irrespective of whether the parameter has a value or + * not. + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field bool present_match = 4; + * @return bool + */ + public function getPresentMatch() + { + return $this->readOneof(4); + } + + public function hasPresentMatch() + { + return $this->hasOneof(4); + } + + /** + * Specifies that the QueryParameterMatcher matches if request contains + * query parameter, irrespective of whether the parameter has a value or + * not. + * Only one of exact_match, regex_match, or present_match must be set. + * + * Generated from protobuf field bool present_match = 4; + * @param bool $var + * @return $this + */ + public function setPresentMatch($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The name of the query parameter to match. + * + * Generated from protobuf field string query_parameter = 1; + * @return string + */ + public function getQueryParameter() + { + return $this->query_parameter; + } + + /** + * The name of the query parameter to match. + * + * Generated from protobuf field string query_parameter = 1; + * @param string $var + * @return $this + */ + public function setQueryParameter($var) + { + GPBUtil::checkString($var, True); + $this->query_parameter = $var; + + return $this; + } + + /** + * @return string + */ + public function getMatchType() + { + return $this->whichOneof("MatchType"); + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/Redirect.php b/NetworkServices/src/V1/HttpRoute/Redirect.php new file mode 100644 index 000000000000..07c8da47ad5b --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/Redirect.php @@ -0,0 +1,328 @@ +google.cloud.networkservices.v1.HttpRoute.Redirect + */ +class Redirect extends \Google\Protobuf\Internal\Message +{ + /** + * The host that will be used in the redirect response instead of the one + * that was supplied in the request. + * + * Generated from protobuf field string host_redirect = 1; + */ + protected $host_redirect = ''; + /** + * The path that will be used in the redirect response instead of the one + * that was supplied in the request. + * path_redirect can not be supplied together with prefix_redirect. Supply + * one alone or neither. If neither is supplied, the path of the original + * request will be used for the redirect. + * + * Generated from protobuf field string path_redirect = 2; + */ + protected $path_redirect = ''; + /** + * Indicates that during redirection, the matched prefix (or path) should be + * swapped with this value. This option allows URLs be dynamically created + * based on the request. + * + * Generated from protobuf field string prefix_rewrite = 3; + */ + protected $prefix_rewrite = ''; + /** + * The HTTP Status code to use for the redirect. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode response_code = 4; + */ + protected $response_code = 0; + /** + * 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 will remain the + * same as that of the request. + * The default is set to false. + * + * Generated from protobuf field bool https_redirect = 5; + */ + protected $https_redirect = false; + /** + * if set to true, any accompanying query portion of the original URL is + * removed prior to 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 bool strip_query = 6; + */ + protected $strip_query = false; + /** + * The port that will be used in the redirected request instead of the one + * that was supplied in the request. + * + * Generated from protobuf field int32 port_redirect = 7; + */ + protected $port_redirect = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host_redirect + * The host that will be used in the redirect response instead of the one + * that was supplied in the request. + * @type string $path_redirect + * The path that will be used in the redirect response instead of the one + * that was supplied in the request. + * path_redirect can not be supplied together with prefix_redirect. Supply + * one alone or neither. If neither is supplied, the path of the original + * request will be used for the redirect. + * @type string $prefix_rewrite + * Indicates that during redirection, the matched prefix (or path) should be + * swapped with this value. This option allows URLs be dynamically created + * based on the request. + * @type int $response_code + * The HTTP Status code to use for the redirect. + * @type bool $https_redirect + * 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 will remain the + * same as that of the request. + * The default is set to false. + * @type bool $strip_query + * if set to true, any accompanying query portion of the original URL is + * removed prior to redirecting the request. If set to false, the query + * portion of the original URL is retained. + * The default is set to false. + * @type int $port_redirect + * The port that will be used in the redirected request instead of the one + * that was supplied in the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The host that will be used in the redirect response instead of the one + * that was supplied in the request. + * + * Generated from protobuf field string host_redirect = 1; + * @return string + */ + public function getHostRedirect() + { + return $this->host_redirect; + } + + /** + * The host that will be used in the redirect response instead of the one + * that was supplied in the request. + * + * Generated from protobuf field string host_redirect = 1; + * @param string $var + * @return $this + */ + public function setHostRedirect($var) + { + GPBUtil::checkString($var, True); + $this->host_redirect = $var; + + return $this; + } + + /** + * The path that will be used in the redirect response instead of the one + * that was supplied in the request. + * path_redirect can not be supplied together with prefix_redirect. Supply + * one alone or neither. If neither is supplied, the path of the original + * request will be used for the redirect. + * + * Generated from protobuf field string path_redirect = 2; + * @return string + */ + public function getPathRedirect() + { + return $this->path_redirect; + } + + /** + * The path that will be used in the redirect response instead of the one + * that was supplied in the request. + * path_redirect can not be supplied together with prefix_redirect. Supply + * one alone or neither. If neither is supplied, the path of the original + * request will be used for the redirect. + * + * Generated from protobuf field string path_redirect = 2; + * @param string $var + * @return $this + */ + public function setPathRedirect($var) + { + GPBUtil::checkString($var, True); + $this->path_redirect = $var; + + return $this; + } + + /** + * Indicates that during redirection, the matched prefix (or path) should be + * swapped with this value. This option allows URLs be dynamically created + * based on the request. + * + * Generated from protobuf field string prefix_rewrite = 3; + * @return string + */ + public function getPrefixRewrite() + { + return $this->prefix_rewrite; + } + + /** + * Indicates that during redirection, the matched prefix (or path) should be + * swapped with this value. This option allows URLs be dynamically created + * based on the request. + * + * Generated from protobuf field string prefix_rewrite = 3; + * @param string $var + * @return $this + */ + public function setPrefixRewrite($var) + { + GPBUtil::checkString($var, True); + $this->prefix_rewrite = $var; + + return $this; + } + + /** + * The HTTP Status code to use for the redirect. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode response_code = 4; + * @return int + */ + public function getResponseCode() + { + return $this->response_code; + } + + /** + * The HTTP Status code to use for the redirect. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode response_code = 4; + * @param int $var + * @return $this + */ + public function setResponseCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\HttpRoute\Redirect\ResponseCode::class); + $this->response_code = $var; + + return $this; + } + + /** + * 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 will remain the + * same as that of the request. + * The default is set to false. + * + * Generated from protobuf field bool https_redirect = 5; + * @return bool + */ + public function getHttpsRedirect() + { + return $this->https_redirect; + } + + /** + * 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 will remain the + * same as that of the request. + * The default is set to false. + * + * Generated from protobuf field bool https_redirect = 5; + * @param bool $var + * @return $this + */ + public function setHttpsRedirect($var) + { + GPBUtil::checkBool($var); + $this->https_redirect = $var; + + return $this; + } + + /** + * if set to true, any accompanying query portion of the original URL is + * removed prior to 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 bool strip_query = 6; + * @return bool + */ + public function getStripQuery() + { + return $this->strip_query; + } + + /** + * if set to true, any accompanying query portion of the original URL is + * removed prior to 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 bool strip_query = 6; + * @param bool $var + * @return $this + */ + public function setStripQuery($var) + { + GPBUtil::checkBool($var); + $this->strip_query = $var; + + return $this; + } + + /** + * The port that will be used in the redirected request instead of the one + * that was supplied in the request. + * + * Generated from protobuf field int32 port_redirect = 7; + * @return int + */ + public function getPortRedirect() + { + return $this->port_redirect; + } + + /** + * The port that will be used in the redirected request instead of the one + * that was supplied in the request. + * + * Generated from protobuf field int32 port_redirect = 7; + * @param int $var + * @return $this + */ + public function setPortRedirect($var) + { + GPBUtil::checkInt32($var); + $this->port_redirect = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/Redirect/ResponseCode.php b/NetworkServices/src/V1/HttpRoute/Redirect/ResponseCode.php new file mode 100644 index 000000000000..1d05afded328 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/Redirect/ResponseCode.php @@ -0,0 +1,83 @@ +google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode + */ +class ResponseCode +{ + /** + * Default value + * + * Generated from protobuf enum RESPONSE_CODE_UNSPECIFIED = 0; + */ + const RESPONSE_CODE_UNSPECIFIED = 0; + /** + * Corresponds to 301. + * + * Generated from protobuf enum MOVED_PERMANENTLY_DEFAULT = 1; + */ + const MOVED_PERMANENTLY_DEFAULT = 1; + /** + * Corresponds to 302. + * + * Generated from protobuf enum FOUND = 2; + */ + const FOUND = 2; + /** + * Corresponds to 303. + * + * Generated from protobuf enum SEE_OTHER = 3; + */ + const SEE_OTHER = 3; + /** + * Corresponds to 307. In this case, the request method will be retained. + * + * Generated from protobuf enum TEMPORARY_REDIRECT = 4; + */ + const TEMPORARY_REDIRECT = 4; + /** + * Corresponds to 308. In this case, the request method will be retained. + * + * Generated from protobuf enum PERMANENT_REDIRECT = 5; + */ + const PERMANENT_REDIRECT = 5; + + private static $valueToName = [ + self::RESPONSE_CODE_UNSPECIFIED => 'RESPONSE_CODE_UNSPECIFIED', + self::MOVED_PERMANENTLY_DEFAULT => 'MOVED_PERMANENTLY_DEFAULT', + self::FOUND => 'FOUND', + self::SEE_OTHER => 'SEE_OTHER', + self::TEMPORARY_REDIRECT => 'TEMPORARY_REDIRECT', + self::PERMANENT_REDIRECT => 'PERMANENT_REDIRECT', + ]; + + 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/NetworkServices/src/V1/HttpRoute/RequestMirrorPolicy.php b/NetworkServices/src/V1/HttpRoute/RequestMirrorPolicy.php new file mode 100644 index 000000000000..f80400e5e43b --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/RequestMirrorPolicy.php @@ -0,0 +1,85 @@ +google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy + */ +class RequestMirrorPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * The destination the requests will be mirrored to. The weight of the + * destination will be ignored. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Destination destination = 1; + */ + protected $destination = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\Destination $destination + * The destination the requests will be mirrored to. The weight of the + * destination will be ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The destination the requests will be mirrored to. The weight of the + * destination will be ignored. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Destination destination = 1; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\Destination|null + */ + public function getDestination() + { + return $this->destination; + } + + public function hasDestination() + { + return isset($this->destination); + } + + public function clearDestination() + { + unset($this->destination); + } + + /** + * The destination the requests will be mirrored to. The weight of the + * destination will be ignored. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Destination destination = 1; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\Destination $var + * @return $this + */ + public function setDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\Destination::class); + $this->destination = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/RetryPolicy.php b/NetworkServices/src/V1/HttpRoute/RetryPolicy.php new file mode 100644 index 000000000000..1cb2959062b1 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/RetryPolicy.php @@ -0,0 +1,214 @@ +google.cloud.networkservices.v1.HttpRoute.RetryPolicy + */ +class RetryPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies one or more conditions when this retry policy applies. Valid + * values are: + * 5xx: Proxy will attempt a retry if the destination service responds + * with any 5xx response code, of if the destination service does not + * respond at all, example: disconnect, reset, read timeout, connection + * failure and refused streams. + * gateway-error: Similar to 5xx, but only applies to response codes 502, + * 503, 504. + * reset: Proxy will attempt a retry if the destination service does not + * respond at all (disconnect/reset/read timeout) + * connect-failure: Proxy will retry on failures connecting to destination + * for example due to connection timeouts. + * retriable-4xx: Proxy will retry fro retriable 4xx response codes. + * Currently the only retriable error supported is 409. + * refused-stream: Proxy will retry if the destination resets the stream + * with a REFUSED_STREAM error code. This reset type indicates that it + * is safe to retry. + * + * Generated from protobuf field repeated string retry_conditions = 1; + */ + private $retry_conditions; + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field int32 num_retries = 2; + */ + protected $num_retries = 0; + /** + * Specifies a non-zero timeout per retry attempt. + * + * Generated from protobuf field .google.protobuf.Duration per_try_timeout = 3; + */ + protected $per_try_timeout = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $retry_conditions + * Specifies one or more conditions when this retry policy applies. Valid + * values are: + * 5xx: Proxy will attempt a retry if the destination service responds + * with any 5xx response code, of if the destination service does not + * respond at all, example: disconnect, reset, read timeout, connection + * failure and refused streams. + * gateway-error: Similar to 5xx, but only applies to response codes 502, + * 503, 504. + * reset: Proxy will attempt a retry if the destination service does not + * respond at all (disconnect/reset/read timeout) + * connect-failure: Proxy will retry on failures connecting to destination + * for example due to connection timeouts. + * retriable-4xx: Proxy will retry fro retriable 4xx response codes. + * Currently the only retriable error supported is 409. + * refused-stream: Proxy will retry if the destination resets the stream + * with a REFUSED_STREAM error code. This reset type indicates that it + * is safe to retry. + * @type int $num_retries + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * @type \Google\Protobuf\Duration $per_try_timeout + * Specifies a non-zero timeout per retry attempt. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Specifies one or more conditions when this retry policy applies. Valid + * values are: + * 5xx: Proxy will attempt a retry if the destination service responds + * with any 5xx response code, of if the destination service does not + * respond at all, example: disconnect, reset, read timeout, connection + * failure and refused streams. + * gateway-error: Similar to 5xx, but only applies to response codes 502, + * 503, 504. + * reset: Proxy will attempt a retry if the destination service does not + * respond at all (disconnect/reset/read timeout) + * connect-failure: Proxy will retry on failures connecting to destination + * for example due to connection timeouts. + * retriable-4xx: Proxy will retry fro retriable 4xx response codes. + * Currently the only retriable error supported is 409. + * refused-stream: Proxy will retry if the destination resets the stream + * with a REFUSED_STREAM error code. This reset type indicates that it + * is safe to retry. + * + * Generated from protobuf field repeated string retry_conditions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRetryConditions() + { + return $this->retry_conditions; + } + + /** + * Specifies one or more conditions when this retry policy applies. Valid + * values are: + * 5xx: Proxy will attempt a retry if the destination service responds + * with any 5xx response code, of if the destination service does not + * respond at all, example: disconnect, reset, read timeout, connection + * failure and refused streams. + * gateway-error: Similar to 5xx, but only applies to response codes 502, + * 503, 504. + * reset: Proxy will attempt a retry if the destination service does not + * respond at all (disconnect/reset/read timeout) + * connect-failure: Proxy will retry on failures connecting to destination + * for example due to connection timeouts. + * retriable-4xx: Proxy will retry fro retriable 4xx response codes. + * Currently the only retriable error supported is 409. + * refused-stream: Proxy will retry if the destination resets the stream + * with a REFUSED_STREAM error code. This reset type indicates that it + * is safe to retry. + * + * Generated from protobuf field repeated string retry_conditions = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRetryConditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->retry_conditions = $arr; + + return $this; + } + + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field int32 num_retries = 2; + * @return int + */ + public function getNumRetries() + { + return $this->num_retries; + } + + /** + * Specifies the allowed number of retries. This number must be > 0. If not + * specified, default to 1. + * + * Generated from protobuf field int32 num_retries = 2; + * @param int $var + * @return $this + */ + public function setNumRetries($var) + { + GPBUtil::checkInt32($var); + $this->num_retries = $var; + + return $this; + } + + /** + * Specifies a non-zero timeout per retry attempt. + * + * Generated from protobuf field .google.protobuf.Duration per_try_timeout = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getPerTryTimeout() + { + return $this->per_try_timeout; + } + + public function hasPerTryTimeout() + { + return isset($this->per_try_timeout); + } + + public function clearPerTryTimeout() + { + unset($this->per_try_timeout); + } + + /** + * Specifies a non-zero timeout per retry attempt. + * + * Generated from protobuf field .google.protobuf.Duration per_try_timeout = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPerTryTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->per_try_timeout = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/RouteAction.php b/NetworkServices/src/V1/HttpRoute/RouteAction.php new file mode 100644 index 000000000000..7c470d169513 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/RouteAction.php @@ -0,0 +1,544 @@ +google.cloud.networkservices.v1.HttpRoute.RouteAction + */ +class RouteAction extends \Google\Protobuf\Internal\Message +{ + /** + * The destination to which traffic should be forwarded. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.Destination destinations = 1; + */ + private $destinations; + /** + * If set, the request is directed as configured by this field. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect redirect = 2; + */ + protected $redirect = 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 on a percentage of requests before sending those requests to + * the backend service. Similarly requests from clients can be aborted for a + * percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy fault_injection_policy = 4; + */ + protected $fault_injection_policy = null; + /** + * The specification for modifying the headers of a matching request prior + * to delivery of the request to the destination. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier request_header_modifier = 5; + */ + protected $request_header_modifier = null; + /** + * The specification for modifying the headers of a response prior to + * sending the response back to the client. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier response_header_modifier = 6; + */ + protected $response_header_modifier = null; + /** + * The specification for rewrite URL before forwarding requests to the + * destination. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.URLRewrite url_rewrite = 7; + */ + protected $url_rewrite = null; + /** + * Specifies the timeout for selected route. Timeout is computed from the + * time the request has been fully processed (i.e. end of stream) up until + * the response has been completely processed. Timeout includes all retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + */ + protected $timeout = null; + /** + * Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RetryPolicy retry_policy = 9; + */ + protected $retry_policy = null; + /** + * Specifies the policy on how requests intended for the routes destination + * are shadowed to a separate mirrored destination. Proxy will not wait for + * the shadow destination to respond before returning the response. Prior to + * sending traffic to the shadow service, the host/authority header is + * suffixed with -shadow. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy request_mirror_policy = 10; + */ + protected $request_mirror_policy = null; + /** + * The specification for allowing client side cross-origin requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.CorsPolicy cors_policy = 11; + */ + protected $cors_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute\Destination>|\Google\Protobuf\Internal\RepeatedField $destinations + * The destination to which traffic should be forwarded. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\Redirect $redirect + * If set, the request is directed as configured by this field. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy $fault_injection_policy + * 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 on a percentage of requests before sending those requests to + * the backend service. Similarly requests from clients can be aborted for a + * percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier $request_header_modifier + * The specification for modifying the headers of a matching request prior + * to delivery of the request to the destination. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier $response_header_modifier + * The specification for modifying the headers of a response prior to + * sending the response back to the client. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\URLRewrite $url_rewrite + * The specification for rewrite URL before forwarding requests to the + * destination. + * @type \Google\Protobuf\Duration $timeout + * Specifies the timeout for selected route. Timeout is computed from the + * time the request has been fully processed (i.e. end of stream) up until + * the response has been completely processed. Timeout includes all retries. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\RetryPolicy $retry_policy + * Specifies the retry policy associated with this route. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\RequestMirrorPolicy $request_mirror_policy + * Specifies the policy on how requests intended for the routes destination + * are shadowed to a separate mirrored destination. Proxy will not wait for + * the shadow destination to respond before returning the response. Prior to + * sending traffic to the shadow service, the host/authority header is + * suffixed with -shadow. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\CorsPolicy $cors_policy + * The specification for allowing client side cross-origin requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The destination to which traffic should be forwarded. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.Destination destinations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinations() + { + return $this->destinations; + } + + /** + * The destination to which traffic should be forwarded. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.Destination destinations = 1; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute\Destination>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute\Destination::class); + $this->destinations = $arr; + + return $this; + } + + /** + * If set, the request is directed as configured by this field. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect redirect = 2; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\Redirect|null + */ + public function getRedirect() + { + return $this->redirect; + } + + public function hasRedirect() + { + return isset($this->redirect); + } + + public function clearRedirect() + { + unset($this->redirect); + } + + /** + * If set, the request is directed as configured by this field. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.Redirect redirect = 2; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\Redirect $var + * @return $this + */ + public function setRedirect($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\Redirect::class); + $this->redirect = $var; + + return $this; + } + + /** + * 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 on a percentage of requests before sending those requests to + * the backend service. Similarly requests from clients can be aborted for a + * percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy fault_injection_policy = 4; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy|null + */ + public function getFaultInjectionPolicy() + { + return $this->fault_injection_policy; + } + + public function hasFaultInjectionPolicy() + { + return isset($this->fault_injection_policy); + } + + public function clearFaultInjectionPolicy() + { + unset($this->fault_injection_policy); + } + + /** + * 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 on a percentage of requests before sending those requests to + * the backend service. Similarly requests from clients can be aborted for a + * percentage of requests. + * timeout and retry_policy will be ignored by clients that are configured + * with a fault_injection_policy + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy fault_injection_policy = 4; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy $var + * @return $this + */ + public function setFaultInjectionPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy::class); + $this->fault_injection_policy = $var; + + return $this; + } + + /** + * The specification for modifying the headers of a matching request prior + * to delivery of the request to the destination. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier request_header_modifier = 5; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier|null + */ + public function getRequestHeaderModifier() + { + return $this->request_header_modifier; + } + + public function hasRequestHeaderModifier() + { + return isset($this->request_header_modifier); + } + + public function clearRequestHeaderModifier() + { + unset($this->request_header_modifier); + } + + /** + * The specification for modifying the headers of a matching request prior + * to delivery of the request to the destination. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier request_header_modifier = 5; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier $var + * @return $this + */ + public function setRequestHeaderModifier($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier::class); + $this->request_header_modifier = $var; + + return $this; + } + + /** + * The specification for modifying the headers of a response prior to + * sending the response back to the client. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier response_header_modifier = 6; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier|null + */ + public function getResponseHeaderModifier() + { + return $this->response_header_modifier; + } + + public function hasResponseHeaderModifier() + { + return isset($this->response_header_modifier); + } + + public function clearResponseHeaderModifier() + { + unset($this->response_header_modifier); + } + + /** + * The specification for modifying the headers of a response prior to + * sending the response back to the client. If HeaderModifiers are set + * on both the Destination and the RouteAction, they will be merged. + * Conflicts between the two will not be resolved on the configuration. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.HeaderModifier response_header_modifier = 6; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier $var + * @return $this + */ + public function setResponseHeaderModifier($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderModifier::class); + $this->response_header_modifier = $var; + + return $this; + } + + /** + * The specification for rewrite URL before forwarding requests to the + * destination. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.URLRewrite url_rewrite = 7; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\URLRewrite|null + */ + public function getUrlRewrite() + { + return $this->url_rewrite; + } + + public function hasUrlRewrite() + { + return isset($this->url_rewrite); + } + + public function clearUrlRewrite() + { + unset($this->url_rewrite); + } + + /** + * The specification for rewrite URL before forwarding requests to the + * destination. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.URLRewrite url_rewrite = 7; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\URLRewrite $var + * @return $this + */ + public function setUrlRewrite($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\URLRewrite::class); + $this->url_rewrite = $var; + + return $this; + } + + /** + * Specifies the timeout for selected route. Timeout is computed from the + * time the request has been fully processed (i.e. end of stream) up until + * the response has been completely processed. Timeout includes all retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * Specifies the timeout for selected route. Timeout is computed from the + * time the request has been fully processed (i.e. end of stream) up until + * the response has been completely processed. Timeout includes all retries. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RetryPolicy retry_policy = 9; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\RetryPolicy|null + */ + public function getRetryPolicy() + { + return $this->retry_policy; + } + + public function hasRetryPolicy() + { + return isset($this->retry_policy); + } + + public function clearRetryPolicy() + { + unset($this->retry_policy); + } + + /** + * Specifies the retry policy associated with this route. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RetryPolicy retry_policy = 9; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\RetryPolicy $var + * @return $this + */ + public function setRetryPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\RetryPolicy::class); + $this->retry_policy = $var; + + return $this; + } + + /** + * Specifies the policy on how requests intended for the routes destination + * are shadowed to a separate mirrored destination. Proxy will not wait for + * the shadow destination to respond before returning the response. Prior to + * sending traffic to the shadow service, the host/authority header is + * suffixed with -shadow. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy request_mirror_policy = 10; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\RequestMirrorPolicy|null + */ + public function getRequestMirrorPolicy() + { + return $this->request_mirror_policy; + } + + public function hasRequestMirrorPolicy() + { + return isset($this->request_mirror_policy); + } + + public function clearRequestMirrorPolicy() + { + unset($this->request_mirror_policy); + } + + /** + * Specifies the policy on how requests intended for the routes destination + * are shadowed to a separate mirrored destination. Proxy will not wait for + * the shadow destination to respond before returning the response. Prior to + * sending traffic to the shadow service, the host/authority header is + * suffixed with -shadow. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy request_mirror_policy = 10; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\RequestMirrorPolicy $var + * @return $this + */ + public function setRequestMirrorPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\RequestMirrorPolicy::class); + $this->request_mirror_policy = $var; + + return $this; + } + + /** + * The specification for allowing client side cross-origin requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.CorsPolicy cors_policy = 11; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\CorsPolicy|null + */ + public function getCorsPolicy() + { + return $this->cors_policy; + } + + public function hasCorsPolicy() + { + return isset($this->cors_policy); + } + + public function clearCorsPolicy() + { + unset($this->cors_policy); + } + + /** + * The specification for allowing client side cross-origin requests. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.CorsPolicy cors_policy = 11; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\CorsPolicy $var + * @return $this + */ + public function setCorsPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\CorsPolicy::class); + $this->cors_policy = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/RouteMatch.php b/NetworkServices/src/V1/HttpRoute/RouteMatch.php new file mode 100644 index 000000000000..5a253d249df6 --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/RouteMatch.php @@ -0,0 +1,288 @@ +google.cloud.networkservices.v1.HttpRoute.RouteMatch + */ +class RouteMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies if prefix_match and full_path_match matches are case sensitive. + * The default value is false. + * + * Generated from protobuf field bool ignore_case = 4; + */ + protected $ignore_case = false; + /** + * Specifies a list of HTTP request headers to match against. ALL of the + * supplied headers must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.HeaderMatch headers = 5; + */ + private $headers; + /** + * Specifies a list of query parameters to match against. ALL of the query + * parameters must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch query_parameters = 6; + */ + private $query_parameters; + protected $PathMatch; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $full_path_match + * The HTTP request path value should exactly match this value. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * @type string $prefix_match + * The HTTP request path value must begin with specified prefix_match. + * prefix_match must begin with a /. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * @type string $regex_match + * The HTTP request path value must satisfy the regular expression + * specified by regex_match after removing any query parameters and anchor + * supplied with the original URL. For regular expression grammar, please + * see https://github.com/google/re2/wiki/Syntax + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * @type bool $ignore_case + * Specifies if prefix_match and full_path_match matches are case sensitive. + * The default value is false. + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch>|\Google\Protobuf\Internal\RepeatedField $headers + * Specifies a list of HTTP request headers to match against. ALL of the + * supplied headers must be matched. + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute\QueryParameterMatch>|\Google\Protobuf\Internal\RepeatedField $query_parameters + * Specifies a list of query parameters to match against. ALL of the query + * parameters must be matched. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP request path value should exactly match this value. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string full_path_match = 1; + * @return string + */ + public function getFullPathMatch() + { + return $this->readOneof(1); + } + + public function hasFullPathMatch() + { + return $this->hasOneof(1); + } + + /** + * The HTTP request path value should exactly match this value. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string full_path_match = 1; + * @param string $var + * @return $this + */ + public function setFullPathMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The HTTP request path value must begin with specified prefix_match. + * prefix_match must begin with a /. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string prefix_match = 2; + * @return string + */ + public function getPrefixMatch() + { + return $this->readOneof(2); + } + + public function hasPrefixMatch() + { + return $this->hasOneof(2); + } + + /** + * The HTTP request path value must begin with specified prefix_match. + * prefix_match must begin with a /. + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string prefix_match = 2; + * @param string $var + * @return $this + */ + public function setPrefixMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The HTTP request path value must satisfy the regular expression + * specified by regex_match after removing any query parameters and anchor + * supplied with the original URL. For regular expression grammar, please + * see https://github.com/google/re2/wiki/Syntax + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string regex_match = 3; + * @return string + */ + public function getRegexMatch() + { + return $this->readOneof(3); + } + + public function hasRegexMatch() + { + return $this->hasOneof(3); + } + + /** + * The HTTP request path value must satisfy the regular expression + * specified by regex_match after removing any query parameters and anchor + * supplied with the original URL. For regular expression grammar, please + * see https://github.com/google/re2/wiki/Syntax + * Only one of full_path_match, prefix_match, or regex_match should be + * used. + * + * Generated from protobuf field string regex_match = 3; + * @param string $var + * @return $this + */ + public function setRegexMatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Specifies if prefix_match and full_path_match matches are case sensitive. + * The default value is false. + * + * Generated from protobuf field bool ignore_case = 4; + * @return bool + */ + public function getIgnoreCase() + { + return $this->ignore_case; + } + + /** + * Specifies if prefix_match and full_path_match matches are case sensitive. + * The default value is false. + * + * Generated from protobuf field bool ignore_case = 4; + * @param bool $var + * @return $this + */ + public function setIgnoreCase($var) + { + GPBUtil::checkBool($var); + $this->ignore_case = $var; + + return $this; + } + + /** + * Specifies a list of HTTP request headers to match against. ALL of the + * supplied headers must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.HeaderMatch headers = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * Specifies a list of HTTP request headers to match against. ALL of the + * supplied headers must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.HeaderMatch headers = 5; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute\HeaderMatch::class); + $this->headers = $arr; + + return $this; + } + + /** + * Specifies a list of query parameters to match against. ALL of the query + * parameters must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch query_parameters = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQueryParameters() + { + return $this->query_parameters; + } + + /** + * Specifies a list of query parameters to match against. ALL of the query + * parameters must be matched. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch query_parameters = 6; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute\QueryParameterMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQueryParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute\QueryParameterMatch::class); + $this->query_parameters = $arr; + + return $this; + } + + /** + * @return string + */ + public function getPathMatch() + { + return $this->whichOneof("PathMatch"); + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/RouteRule.php b/NetworkServices/src/V1/HttpRoute/RouteRule.php new file mode 100644 index 000000000000..7e5875caaa5a --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/RouteRule.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.HttpRoute.RouteRule + */ +class RouteRule extends \Google\Protobuf\Internal\Message +{ + /** + * A list of matches define conditions used for matching the rule against + * incoming HTTP requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. + * If no matches field is specified, this rule will unconditionally match + * traffic. + * If a default rule is desired to be configured, add a rule with no matches + * specified to the end of the rules list. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteMatch matches = 1; + */ + private $matches; + /** + * The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RouteAction action = 2; + */ + protected $action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $matches + * A list of matches define conditions used for matching the rule against + * incoming HTTP requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. + * If no matches field is specified, this rule will unconditionally match + * traffic. + * If a default rule is desired to be configured, add a rule with no matches + * specified to the end of the rules list. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute\RouteAction $action + * The detailed rule defining how to route matched traffic. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * A list of matches define conditions used for matching the rule against + * incoming HTTP requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. + * If no matches field is specified, this rule will unconditionally match + * traffic. + * If a default rule is desired to be configured, add a rule with no matches + * specified to the end of the rules list. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteMatch matches = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMatches() + { + return $this->matches; + } + + /** + * A list of matches define conditions used for matching the rule against + * incoming HTTP requests. Each match is independent, i.e. this rule will be + * matched if ANY one of the matches is satisfied. + * If no matches field is specified, this rule will unconditionally match + * traffic. + * If a default rule is desired to be configured, add a rule with no matches + * specified to the end of the rules list. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute.RouteMatch matches = 1; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMatches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute\RouteMatch::class); + $this->matches = $arr; + + return $this; + } + + /** + * The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RouteAction action = 2; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute\RouteAction|null + */ + public function getAction() + { + return $this->action; + } + + public function hasAction() + { + return isset($this->action); + } + + public function clearAction() + { + unset($this->action); + } + + /** + * The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute.RouteAction action = 2; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute\RouteAction $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\RouteAction::class); + $this->action = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/HttpRoute/URLRewrite.php b/NetworkServices/src/V1/HttpRoute/URLRewrite.php new file mode 100644 index 000000000000..d9c7db9e1acc --- /dev/null +++ b/NetworkServices/src/V1/HttpRoute/URLRewrite.php @@ -0,0 +1,111 @@ +google.cloud.networkservices.v1.HttpRoute.URLRewrite + */ +class URLRewrite extends \Google\Protobuf\Internal\Message +{ + /** + * Prior to forwarding the request to the selected destination, the matching + * portion of the requests path is replaced by this value. + * + * Generated from protobuf field string path_prefix_rewrite = 1; + */ + protected $path_prefix_rewrite = ''; + /** + * Prior to forwarding the request to the selected destination, the requests + * host header is replaced by this value. + * + * Generated from protobuf field string host_rewrite = 2; + */ + protected $host_rewrite = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $path_prefix_rewrite + * Prior to forwarding the request to the selected destination, the matching + * portion of the requests path is replaced by this value. + * @type string $host_rewrite + * Prior to forwarding the request to the selected destination, the requests + * host header is replaced by this value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Prior to forwarding the request to the selected destination, the matching + * portion of the requests path is replaced by this value. + * + * Generated from protobuf field string path_prefix_rewrite = 1; + * @return string + */ + public function getPathPrefixRewrite() + { + return $this->path_prefix_rewrite; + } + + /** + * Prior to forwarding the request to the selected destination, the matching + * portion of the requests path is replaced by this value. + * + * Generated from protobuf field string path_prefix_rewrite = 1; + * @param string $var + * @return $this + */ + public function setPathPrefixRewrite($var) + { + GPBUtil::checkString($var, True); + $this->path_prefix_rewrite = $var; + + return $this; + } + + /** + * Prior to forwarding the request to the selected destination, the requests + * host header is replaced by this value. + * + * Generated from protobuf field string host_rewrite = 2; + * @return string + */ + public function getHostRewrite() + { + return $this->host_rewrite; + } + + /** + * Prior to forwarding the request to the selected destination, the requests + * host header is replaced by this value. + * + * Generated from protobuf field string host_rewrite = 2; + * @param string $var + * @return $this + */ + public function setHostRewrite($var) + { + GPBUtil::checkString($var, True); + $this->host_rewrite = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/LbRouteExtension.php b/NetworkServices/src/V1/LbRouteExtension.php new file mode 100644 index 000000000000..9609aa638c89 --- /dev/null +++ b/NetworkServices/src/V1/LbRouteExtension.php @@ -0,0 +1,462 @@ +google.cloud.networkservices.v1.LbRouteExtension + */ +class LbRouteExtension extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifier. Name of the `LbRouteExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. Set of labels associated with the `LbRouteExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LbRouteExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $forwarding_rules; + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $extension_chains; + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $load_balancing_scheme = 0; + /** + * Optional. The metadata provided here is included as part of the + * `metadata_context` (of type `google.protobuf.Struct`) in the + * `ProcessingRequest` message sent to the extension + * server. The metadata is available under the namespace + * `com.google.lb_route_extension.`. + * The following variables are supported in the metadata Struct: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Identifier. Name of the `LbRouteExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type string $description + * Optional. A human-readable description of the resource. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of labels associated with the `LbRouteExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * @type array|\Google\Protobuf\Internal\RepeatedField $forwarding_rules + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LbRouteExtension` resource per forwarding rule. + * @type array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $extension_chains + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * @type int $load_balancing_scheme + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * @type \Google\Protobuf\Struct $metadata + * Optional. The metadata provided here is included as part of the + * `metadata_context` (of type `google.protobuf.Struct`) in the + * `ProcessingRequest` message sent to the extension + * server. The metadata is available under the namespace + * `com.google.lb_route_extension.`. + * The following variables are supported in the metadata Struct: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifier. Name of the `LbRouteExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Identifier. Name of the `LbRouteExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. Set of labels associated with the `LbRouteExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of labels associated with the `LbRouteExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LbRouteExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getForwardingRules() + { + return $this->forwarding_rules; + } + + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LbRouteExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setForwardingRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->forwarding_rules = $arr; + + return $this; + } + + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtensionChains() + { + return $this->extension_chains; + } + + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtensionChains($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ExtensionChain::class); + $this->extension_chains = $arr; + + return $this; + } + + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getLoadBalancingScheme() + { + return $this->load_balancing_scheme; + } + + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setLoadBalancingScheme($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\LoadBalancingScheme::class); + $this->load_balancing_scheme = $var; + + return $this; + } + + /** + * Optional. The metadata provided here is included as part of the + * `metadata_context` (of type `google.protobuf.Struct`) in the + * `ProcessingRequest` message sent to the extension + * server. The metadata is available under the namespace + * `com.google.lb_route_extension.`. + * The following variables are supported in the metadata Struct: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Optional. The metadata provided here is included as part of the + * `metadata_context` (of type `google.protobuf.Struct`) in the + * `ProcessingRequest` message sent to the extension + * server. The metadata is available under the namespace + * `com.google.lb_route_extension.`. + * The following variables are supported in the metadata Struct: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/LbTrafficExtension.php b/NetworkServices/src/V1/LbTrafficExtension.php new file mode 100644 index 000000000000..250a492185ab --- /dev/null +++ b/NetworkServices/src/V1/LbTrafficExtension.php @@ -0,0 +1,460 @@ +google.cloud.networkservices.v1.LbTrafficExtension + */ +class LbTrafficExtension extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifier. Name of the `LbTrafficExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. Set of labels associated with the `LbTrafficExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LBTrafficExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $forwarding_rules; + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $extension_chains; + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $load_balancing_scheme = 0; + /** + * Optional. The metadata provided here is included in the + * `ProcessingRequest.metadata_context.filter_metadata` map field. The + * metadata is available under the key + * `com.google.lb_traffic_extension.`. + * The following variables are supported in the metadata: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Identifier. Name of the `LbTrafficExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type string $description + * Optional. A human-readable description of the resource. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of labels associated with the `LbTrafficExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * @type array|\Google\Protobuf\Internal\RepeatedField $forwarding_rules + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LBTrafficExtension` resource per forwarding rule. + * @type array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $extension_chains + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * @type int $load_balancing_scheme + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * @type \Google\Protobuf\Struct $metadata + * Optional. The metadata provided here is included in the + * `ProcessingRequest.metadata_context.filter_metadata` map field. The + * metadata is available under the key + * `com.google.lb_traffic_extension.`. + * The following variables are supported in the metadata: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifier. Name of the `LbTrafficExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Identifier. Name of the `LbTrafficExtension` resource in the + * following format: + * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A human-readable description of the resource. + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. Set of labels associated with the `LbTrafficExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of labels associated with the `LbTrafficExtension` resource. + * The format must comply with [the requirements for + * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements) + * for Google Cloud resources. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LBTrafficExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getForwardingRules() + { + return $this->forwarding_rules; + } + + /** + * Required. A list of references to the forwarding rules to which this + * service extension is attached to. At least one forwarding rule is required. + * There can be only one `LBTrafficExtension` resource per forwarding rule. + * + * Generated from protobuf field repeated string forwarding_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setForwardingRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->forwarding_rules = $arr; + + return $this; + } + + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtensionChains() + { + return $this->extension_chains; + } + + /** + * Required. A set of ordered extension chains that contain the match + * conditions and extensions to execute. Match conditions for each extension + * chain are evaluated in sequence for a given request. The first extension + * chain that has a condition that matches the request is executed. + * Any subsequent extension chains do not execute. + * Limited to 5 extension chains per resource. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtensionChains($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ExtensionChain::class); + $this->extension_chains = $arr; + + return $this; + } + + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getLoadBalancingScheme() + { + return $this->load_balancing_scheme; + } + + /** + * Required. All backend services and forwarding rules referenced by this + * extension must share the same load balancing scheme. Supported values: + * `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to + * [Choosing a load + * balancer](https://cloud.google.com/load-balancing/docs/backend-service). + * + * Generated from protobuf field .google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setLoadBalancingScheme($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\LoadBalancingScheme::class); + $this->load_balancing_scheme = $var; + + return $this; + } + + /** + * Optional. The metadata provided here is included in the + * `ProcessingRequest.metadata_context.filter_metadata` map field. The + * metadata is available under the key + * `com.google.lb_traffic_extension.`. + * The following variables are supported in the metadata: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Optional. The metadata provided here is included in the + * `ProcessingRequest.metadata_context.filter_metadata` map field. The + * metadata is available under the key + * `com.google.lb_traffic_extension.`. + * The following variables are supported in the metadata: + * `{forwarding_rule_id}` - substituted with the forwarding rule's fully + * qualified resource name. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListEndpointPoliciesRequest.php b/NetworkServices/src/V1/ListEndpointPoliciesRequest.php new file mode 100644 index 000000000000..21810b6aea0d --- /dev/null +++ b/NetworkServices/src/V1/ListEndpointPoliciesRequest.php @@ -0,0 +1,151 @@ +google.cloud.networkservices.v1.ListEndpointPoliciesRequest + */ +class ListEndpointPoliciesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the EndpointPolicies should + * be listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of EndpointPolicies to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListEndpointPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListEndpointPolicies` call, and that the system should return the + * next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the EndpointPolicies should + * be listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of EndpointPolicies to return per call. + * @type string $page_token + * The value returned by the last `ListEndpointPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListEndpointPolicies` call, and that the system should return the + * next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the EndpointPolicies should + * be listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the EndpointPolicies should + * be listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of EndpointPolicies to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of EndpointPolicies to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListEndpointPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListEndpointPolicies` call, and that the system should return the + * next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListEndpointPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListEndpointPolicies` call, and that the system should return the + * next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListEndpointPoliciesResponse.php b/NetworkServices/src/V1/ListEndpointPoliciesResponse.php new file mode 100644 index 000000000000..05c64b8047f8 --- /dev/null +++ b/NetworkServices/src/V1/ListEndpointPoliciesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListEndpointPoliciesResponse + */ +class ListEndpointPoliciesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of EndpointPolicy resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointPolicy endpoint_policies = 1; + */ + private $endpoint_policies; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\EndpointPolicy>|\Google\Protobuf\Internal\RepeatedField $endpoint_policies + * List of EndpointPolicy resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * List of EndpointPolicy resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointPolicy endpoint_policies = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndpointPolicies() + { + return $this->endpoint_policies; + } + + /** + * List of EndpointPolicy resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.EndpointPolicy endpoint_policies = 1; + * @param array<\Google\Cloud\NetworkServices\V1\EndpointPolicy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndpointPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\EndpointPolicy::class); + $this->endpoint_policies = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListGatewaysRequest.php b/NetworkServices/src/V1/ListGatewaysRequest.php new file mode 100644 index 000000000000..392d1e12e611 --- /dev/null +++ b/NetworkServices/src/V1/ListGatewaysRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListGatewaysRequest + */ +class ListGatewaysRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the Gateways should be + * listed, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of Gateways to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListGatewaysResponse` + * Indicates that this is a continuation of a prior `ListGateways` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the Gateways should be + * listed, specified in the format `projects/*/locations/*`. + * @type int $page_size + * Maximum number of Gateways to return per call. + * @type string $page_token + * The value returned by the last `ListGatewaysResponse` + * Indicates that this is a continuation of a prior `ListGateways` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the Gateways should be + * listed, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the Gateways should be + * listed, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of Gateways to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of Gateways to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListGatewaysResponse` + * Indicates that this is a continuation of a prior `ListGateways` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListGatewaysResponse` + * Indicates that this is a continuation of a prior `ListGateways` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListGatewaysResponse.php b/NetworkServices/src/V1/ListGatewaysResponse.php new file mode 100644 index 000000000000..4e2ad9ad2a55 --- /dev/null +++ b/NetworkServices/src/V1/ListGatewaysResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListGatewaysResponse + */ +class ListGatewaysResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of Gateway resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Gateway gateways = 1; + */ + private $gateways; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\Gateway>|\Google\Protobuf\Internal\RepeatedField $gateways + * List of Gateway resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * List of Gateway resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Gateway gateways = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * List of Gateway resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Gateway gateways = 1; + * @param array<\Google\Cloud\NetworkServices\V1\Gateway>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGateways($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\Gateway::class); + $this->gateways = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListGrpcRoutesRequest.php b/NetworkServices/src/V1/ListGrpcRoutesRequest.php new file mode 100644 index 000000000000..2e87d06f1647 --- /dev/null +++ b/NetworkServices/src/V1/ListGrpcRoutesRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListGrpcRoutesRequest + */ +class ListGrpcRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the GrpcRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of GrpcRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListGrpcRoutesResponse` + * Indicates that this is a continuation of a prior `ListGrpcRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the GrpcRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of GrpcRoutes to return per call. + * @type string $page_token + * The value returned by the last `ListGrpcRoutesResponse` + * Indicates that this is a continuation of a prior `ListGrpcRoutes` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the GrpcRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the GrpcRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of GrpcRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of GrpcRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListGrpcRoutesResponse` + * Indicates that this is a continuation of a prior `ListGrpcRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListGrpcRoutesResponse` + * Indicates that this is a continuation of a prior `ListGrpcRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListGrpcRoutesResponse.php b/NetworkServices/src/V1/ListGrpcRoutesResponse.php new file mode 100644 index 000000000000..25ae1ebe88f6 --- /dev/null +++ b/NetworkServices/src/V1/ListGrpcRoutesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListGrpcRoutesResponse + */ +class ListGrpcRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of GrpcRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute grpc_routes = 1; + */ + private $grpc_routes; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\GrpcRoute>|\Google\Protobuf\Internal\RepeatedField $grpc_routes + * List of GrpcRoute resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * List of GrpcRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute grpc_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGrpcRoutes() + { + return $this->grpc_routes; + } + + /** + * List of GrpcRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.GrpcRoute grpc_routes = 1; + * @param array<\Google\Cloud\NetworkServices\V1\GrpcRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGrpcRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\GrpcRoute::class); + $this->grpc_routes = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListHttpRoutesRequest.php b/NetworkServices/src/V1/ListHttpRoutesRequest.php new file mode 100644 index 000000000000..c4373e5845c5 --- /dev/null +++ b/NetworkServices/src/V1/ListHttpRoutesRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListHttpRoutesRequest + */ +class ListHttpRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the HttpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of HttpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListHttpRoutesResponse` + * Indicates that this is a continuation of a prior `ListHttpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the HttpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of HttpRoutes to return per call. + * @type string $page_token + * The value returned by the last `ListHttpRoutesResponse` + * Indicates that this is a continuation of a prior `ListHttpRoutes` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the HttpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the HttpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of HttpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of HttpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListHttpRoutesResponse` + * Indicates that this is a continuation of a prior `ListHttpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListHttpRoutesResponse` + * Indicates that this is a continuation of a prior `ListHttpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListHttpRoutesResponse.php b/NetworkServices/src/V1/ListHttpRoutesResponse.php new file mode 100644 index 000000000000..121684e24a3e --- /dev/null +++ b/NetworkServices/src/V1/ListHttpRoutesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListHttpRoutesResponse + */ +class ListHttpRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of HttpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute http_routes = 1; + */ + private $http_routes; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\HttpRoute>|\Google\Protobuf\Internal\RepeatedField $http_routes + * List of HttpRoute resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * List of HttpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute http_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHttpRoutes() + { + return $this->http_routes; + } + + /** + * List of HttpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.HttpRoute http_routes = 1; + * @param array<\Google\Cloud\NetworkServices\V1\HttpRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHttpRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\HttpRoute::class); + $this->http_routes = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListLbRouteExtensionsRequest.php b/NetworkServices/src/V1/ListLbRouteExtensionsRequest.php new file mode 100644 index 000000000000..f9ecef198259 --- /dev/null +++ b/NetworkServices/src/V1/ListLbRouteExtensionsRequest.php @@ -0,0 +1,215 @@ +google.cloud.networkservices.v1.ListLbRouteExtensionsRequest + */ +class ListLbRouteExtensionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the `LbRouteExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the `LbRouteExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @type int $page_size + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results that the server returns. + * @type string $filter + * Optional. Filtering results. + * @type string $order_by + * Optional. Hint for how to order the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the `LbRouteExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the `LbRouteExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListLbRouteExtensionsResponse.php b/NetworkServices/src/V1/ListLbRouteExtensionsResponse.php new file mode 100644 index 000000000000..eefc0f3e2d60 --- /dev/null +++ b/NetworkServices/src/V1/ListLbRouteExtensionsResponse.php @@ -0,0 +1,135 @@ +google.cloud.networkservices.v1.ListLbRouteExtensionsResponse + */ +class ListLbRouteExtensionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of `LbRouteExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbRouteExtension lb_route_extensions = 1; + */ + private $lb_route_extensions; + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\LbRouteExtension>|\Google\Protobuf\Internal\RepeatedField $lb_route_extensions + * The list of `LbRouteExtension` resources. + * @type string $next_page_token + * A token identifying a page of results that the server returns. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * The list of `LbRouteExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbRouteExtension lb_route_extensions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLbRouteExtensions() + { + return $this->lb_route_extensions; + } + + /** + * The list of `LbRouteExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbRouteExtension lb_route_extensions = 1; + * @param array<\Google\Cloud\NetworkServices\V1\LbRouteExtension>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLbRouteExtensions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\LbRouteExtension::class); + $this->lb_route_extensions = $arr; + + return $this; + } + + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListLbTrafficExtensionsRequest.php b/NetworkServices/src/V1/ListLbTrafficExtensionsRequest.php new file mode 100644 index 000000000000..23db243c4023 --- /dev/null +++ b/NetworkServices/src/V1/ListLbTrafficExtensionsRequest.php @@ -0,0 +1,215 @@ +google.cloud.networkservices.v1.ListLbTrafficExtensionsRequest + */ +class ListLbTrafficExtensionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the `LbTrafficExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the `LbTrafficExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @type int $page_size + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results that the server returns. + * @type string $filter + * Optional. Filtering results. + * @type string $order_by + * Optional. Hint for how to order the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the `LbTrafficExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the `LbTrafficExtension` + * resources are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results that the server returns. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListLbTrafficExtensionsResponse.php b/NetworkServices/src/V1/ListLbTrafficExtensionsResponse.php new file mode 100644 index 000000000000..f87a63f11b09 --- /dev/null +++ b/NetworkServices/src/V1/ListLbTrafficExtensionsResponse.php @@ -0,0 +1,135 @@ +google.cloud.networkservices.v1.ListLbTrafficExtensionsResponse + */ +class ListLbTrafficExtensionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of `LbTrafficExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extensions = 1; + */ + private $lb_traffic_extensions; + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\LbTrafficExtension>|\Google\Protobuf\Internal\RepeatedField $lb_traffic_extensions + * The list of `LbTrafficExtension` resources. + * @type string $next_page_token + * A token identifying a page of results that the server returns. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * The list of `LbTrafficExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extensions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLbTrafficExtensions() + { + return $this->lb_traffic_extensions; + } + + /** + * The list of `LbTrafficExtension` resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extensions = 1; + * @param array<\Google\Cloud\NetworkServices\V1\LbTrafficExtension>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLbTrafficExtensions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\LbTrafficExtension::class); + $this->lb_traffic_extensions = $arr; + + return $this; + } + + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results that the server returns. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListMeshesRequest.php b/NetworkServices/src/V1/ListMeshesRequest.php new file mode 100644 index 000000000000..a68f0aad5fab --- /dev/null +++ b/NetworkServices/src/V1/ListMeshesRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListMeshesRequest + */ +class ListMeshesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the Meshes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of Meshes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListMeshesResponse` + * Indicates that this is a continuation of a prior `ListMeshes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the Meshes should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of Meshes to return per call. + * @type string $page_token + * The value returned by the last `ListMeshesResponse` + * Indicates that this is a continuation of a prior `ListMeshes` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the Meshes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the Meshes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of Meshes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of Meshes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListMeshesResponse` + * Indicates that this is a continuation of a prior `ListMeshes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListMeshesResponse` + * Indicates that this is a continuation of a prior `ListMeshes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListMeshesResponse.php b/NetworkServices/src/V1/ListMeshesResponse.php new file mode 100644 index 000000000000..4fc4bf9fd178 --- /dev/null +++ b/NetworkServices/src/V1/ListMeshesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListMeshesResponse + */ +class ListMeshesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of Mesh resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Mesh meshes = 1; + */ + private $meshes; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\Mesh>|\Google\Protobuf\Internal\RepeatedField $meshes + * List of Mesh resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * List of Mesh resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Mesh meshes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeshes() + { + return $this->meshes; + } + + /** + * List of Mesh resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.Mesh meshes = 1; + * @param array<\Google\Cloud\NetworkServices\V1\Mesh>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeshes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\Mesh::class); + $this->meshes = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListServiceBindingsRequest.php b/NetworkServices/src/V1/ListServiceBindingsRequest.php new file mode 100644 index 000000000000..de4c7e3221de --- /dev/null +++ b/NetworkServices/src/V1/ListServiceBindingsRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListServiceBindingsRequest + */ +class ListServiceBindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the ServiceBindings should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of ServiceBindings to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListServiceBindingsResponse` + * Indicates that this is a continuation of a prior `ListRouters` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the ServiceBindings should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of ServiceBindings to return per call. + * @type string $page_token + * The value returned by the last `ListServiceBindingsResponse` + * Indicates that this is a continuation of a prior `ListRouters` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the ServiceBindings should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the ServiceBindings should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of ServiceBindings to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of ServiceBindings to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListServiceBindingsResponse` + * Indicates that this is a continuation of a prior `ListRouters` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListServiceBindingsResponse` + * Indicates that this is a continuation of a prior `ListRouters` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListServiceBindingsResponse.php b/NetworkServices/src/V1/ListServiceBindingsResponse.php new file mode 100644 index 000000000000..e1ebc8bef520 --- /dev/null +++ b/NetworkServices/src/V1/ListServiceBindingsResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListServiceBindingsResponse + */ +class ListServiceBindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of ServiceBinding resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ServiceBinding service_bindings = 1; + */ + private $service_bindings; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\ServiceBinding>|\Google\Protobuf\Internal\RepeatedField $service_bindings + * List of ServiceBinding resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * List of ServiceBinding resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ServiceBinding service_bindings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceBindings() + { + return $this->service_bindings; + } + + /** + * List of ServiceBinding resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.ServiceBinding service_bindings = 1; + * @param array<\Google\Cloud\NetworkServices\V1\ServiceBinding>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceBindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ServiceBinding::class); + $this->service_bindings = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListTcpRoutesRequest.php b/NetworkServices/src/V1/ListTcpRoutesRequest.php new file mode 100644 index 000000000000..703c0941b27a --- /dev/null +++ b/NetworkServices/src/V1/ListTcpRoutesRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListTcpRoutesRequest + */ +class ListTcpRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the TcpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of TcpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListTcpRoutesResponse` + * Indicates that this is a continuation of a prior `ListTcpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the TcpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of TcpRoutes to return per call. + * @type string $page_token + * The value returned by the last `ListTcpRoutesResponse` + * Indicates that this is a continuation of a prior `ListTcpRoutes` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the TcpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the TcpRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of TcpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of TcpRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListTcpRoutesResponse` + * Indicates that this is a continuation of a prior `ListTcpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListTcpRoutesResponse` + * Indicates that this is a continuation of a prior `ListTcpRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListTcpRoutesResponse.php b/NetworkServices/src/V1/ListTcpRoutesResponse.php new file mode 100644 index 000000000000..ed511f17c5f4 --- /dev/null +++ b/NetworkServices/src/V1/ListTcpRoutesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListTcpRoutesResponse + */ +class ListTcpRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of TcpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute tcp_routes = 1; + */ + private $tcp_routes; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TcpRoute>|\Google\Protobuf\Internal\RepeatedField $tcp_routes + * List of TcpRoute resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * List of TcpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute tcp_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTcpRoutes() + { + return $this->tcp_routes; + } + + /** + * List of TcpRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute tcp_routes = 1; + * @param array<\Google\Cloud\NetworkServices\V1\TcpRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTcpRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TcpRoute::class); + $this->tcp_routes = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListTlsRoutesRequest.php b/NetworkServices/src/V1/ListTlsRoutesRequest.php new file mode 100644 index 000000000000..1afc22c3f5fd --- /dev/null +++ b/NetworkServices/src/V1/ListTlsRoutesRequest.php @@ -0,0 +1,147 @@ +google.cloud.networkservices.v1.ListTlsRoutesRequest + */ +class ListTlsRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the TlsRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of TlsRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListTlsRoutesResponse` + * Indicates that this is a continuation of a prior `ListTlsRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the TlsRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * @type int $page_size + * Maximum number of TlsRoutes to return per call. + * @type string $page_token + * The value returned by the last `ListTlsRoutesResponse` + * Indicates that this is a continuation of a prior `ListTlsRoutes` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the TlsRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the TlsRoutes should be + * listed, specified in the format `projects/*/locations/global`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of TlsRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of TlsRoutes to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListTlsRoutesResponse` + * Indicates that this is a continuation of a prior `ListTlsRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListTlsRoutesResponse` + * Indicates that this is a continuation of a prior `ListTlsRoutes` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ListTlsRoutesResponse.php b/NetworkServices/src/V1/ListTlsRoutesResponse.php new file mode 100644 index 000000000000..baf951142c4e --- /dev/null +++ b/NetworkServices/src/V1/ListTlsRoutesResponse.php @@ -0,0 +1,109 @@ +google.cloud.networkservices.v1.ListTlsRoutesResponse + */ +class ListTlsRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of TlsRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute tls_routes = 1; + */ + private $tls_routes; + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TlsRoute>|\Google\Protobuf\Internal\RepeatedField $tls_routes + * List of TlsRoute resources. + * @type string $next_page_token + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * List of TlsRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute tls_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTlsRoutes() + { + return $this->tls_routes; + } + + /** + * List of TlsRoute resources. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute tls_routes = 1; + * @param array<\Google\Cloud\NetworkServices\V1\TlsRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTlsRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TlsRoute::class); + $this->tls_routes = $arr; + + return $this; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than those appearing in this response, then + * `next_page_token` is included. To get the next set of results, call this + * method again using the value of `next_page_token` as `page_token`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/LoadBalancingScheme.php b/NetworkServices/src/V1/LoadBalancingScheme.php new file mode 100644 index 000000000000..263ab38300d8 --- /dev/null +++ b/NetworkServices/src/V1/LoadBalancingScheme.php @@ -0,0 +1,65 @@ +google.cloud.networkservices.v1.LoadBalancingScheme + */ +class LoadBalancingScheme +{ + /** + * Default value. Do not use. + * + * Generated from protobuf enum LOAD_BALANCING_SCHEME_UNSPECIFIED = 0; + */ + const LOAD_BALANCING_SCHEME_UNSPECIFIED = 0; + /** + * Signifies that this is used for Internal HTTP(S) Load Balancing. + * + * Generated from protobuf enum INTERNAL_MANAGED = 1; + */ + const INTERNAL_MANAGED = 1; + /** + * Signifies that this is used for External Managed HTTP(S) Load + * Balancing. + * + * Generated from protobuf enum EXTERNAL_MANAGED = 2; + */ + const EXTERNAL_MANAGED = 2; + + private static $valueToName = [ + self::LOAD_BALANCING_SCHEME_UNSPECIFIED => 'LOAD_BALANCING_SCHEME_UNSPECIFIED', + self::INTERNAL_MANAGED => 'INTERNAL_MANAGED', + self::EXTERNAL_MANAGED => 'EXTERNAL_MANAGED', + ]; + + 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/NetworkServices/src/V1/Mesh.php b/NetworkServices/src/V1/Mesh.php new file mode 100644 index 000000000000..14d967fcf671 --- /dev/null +++ b/NetworkServices/src/V1/Mesh.php @@ -0,0 +1,321 @@ +google.cloud.networkservices.v1.Mesh + */ +class Mesh extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Mesh resource. It matches pattern + * `projects/*/locations/global/meshes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Set of label tags associated with the Mesh resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy + * to listen on the specified port of localhost (127.0.0.1) address. The + * SIDECAR proxy will expect all traffic to be redirected to this port + * regardless of its actual ip:port destination. If unset, a port '15001' is + * used as the interception port. This is applicable only for sidecar proxy + * deployments. + * + * Generated from protobuf field int32 interception_port = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $interception_port = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the Mesh resource. It matches pattern + * `projects/*/locations/global/meshes/`. + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the Mesh resource. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type int $interception_port + * Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy + * to listen on the specified port of localhost (127.0.0.1) address. The + * SIDECAR proxy will expect all traffic to be redirected to this port + * regardless of its actual ip:port destination. If unset, a port '15001' is + * used as the interception port. This is applicable only for sidecar proxy + * deployments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Mesh resource. It matches pattern + * `projects/*/locations/global/meshes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the Mesh resource. It matches pattern + * `projects/*/locations/global/meshes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Set of label tags associated with the Mesh resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the Mesh resource. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy + * to listen on the specified port of localhost (127.0.0.1) address. The + * SIDECAR proxy will expect all traffic to be redirected to this port + * regardless of its actual ip:port destination. If unset, a port '15001' is + * used as the interception port. This is applicable only for sidecar proxy + * deployments. + * + * Generated from protobuf field int32 interception_port = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getInterceptionPort() + { + return $this->interception_port; + } + + /** + * Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy + * to listen on the specified port of localhost (127.0.0.1) address. The + * SIDECAR proxy will expect all traffic to be redirected to this port + * regardless of its actual ip:port destination. If unset, a port '15001' is + * used as the interception port. This is applicable only for sidecar proxy + * deployments. + * + * Generated from protobuf field int32 interception_port = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setInterceptionPort($var) + { + GPBUtil::checkInt32($var); + $this->interception_port = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/NetworkServicesClient.php b/NetworkServices/src/V1/NetworkServicesClient.php new file mode 100644 index 000000000000..d5820d488650 --- /dev/null +++ b/NetworkServices/src/V1/NetworkServicesClient.php @@ -0,0 +1,34 @@ +google.cloud.networkservices.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/ServiceBinding.php b/NetworkServices/src/V1/ServiceBinding.php new file mode 100644 index 000000000000..93e657a35992 --- /dev/null +++ b/NetworkServices/src/V1/ServiceBinding.php @@ -0,0 +1,270 @@ +google.cloud.networkservices.v1.ServiceBinding + */ +class ServiceBinding extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the ServiceBinding resource. It matches pattern + * `projects/*/locations/global/serviceBindings/service_binding_name`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. The full service directory service name of the format + * /projects/*/locations/*/namespaces/*/services/* + * + * Generated from protobuf field string service = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = ''; + /** + * Optional. Set of label tags associated with the ServiceBinding resource. + * + * Generated from protobuf field map labels = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the ServiceBinding resource. It matches pattern + * `projects/*/locations/global/serviceBindings/service_binding_name`. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type string $service + * Required. The full service directory service name of the format + * /projects/*/locations/*/namespaces/*/services/* + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the ServiceBinding resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\ServiceBinding::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the ServiceBinding resource. It matches pattern + * `projects/*/locations/global/serviceBindings/service_binding_name`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the ServiceBinding resource. It matches pattern + * `projects/*/locations/global/serviceBindings/service_binding_name`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. The full service directory service name of the format + * /projects/*/locations/*/namespaces/*/services/* + * + * Generated from protobuf field string service = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The full service directory service name of the format + * /projects/*/locations/*/namespaces/*/services/* + * + * Generated from protobuf field string service = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Optional. Set of label tags associated with the ServiceBinding resource. + * + * Generated from protobuf field map labels = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the ServiceBinding resource. + * + * Generated from protobuf field map labels = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/TcpRoute.php b/NetworkServices/src/V1/TcpRoute.php new file mode 100644 index 000000000000..00624114cb2f --- /dev/null +++ b/NetworkServices/src/V1/TcpRoute.php @@ -0,0 +1,404 @@ +google.cloud.networkservices.v1.TcpRoute + */ +class TcpRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the TcpRoute resource. It matches pattern + * `projects/*/locations/global/tcpRoutes/tcp_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $rules; + /** + * Optional. Meshes defines a list of meshes this TcpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $meshes; + /** + * Optional. Gateways defines a list of gateways this TcpRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $gateways; + /** + * Optional. Set of label tags associated with the TcpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the TcpRoute resource. It matches pattern + * `projects/*/locations/global/tcpRoutes/tcp_route_name>`. + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $rules + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * @type array|\Google\Protobuf\Internal\RepeatedField $meshes + * Optional. Meshes defines a list of meshes this TcpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * @type array|\Google\Protobuf\Internal\RepeatedField $gateways + * Optional. Gateways defines a list of gateways this TcpRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Set of label tags associated with the TcpRoute resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the TcpRoute resource. It matches pattern + * `projects/*/locations/global/tcpRoutes/tcp_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the TcpRoute resource. It matches pattern + * `projects/*/locations/global/tcpRoutes/tcp_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TcpRoute\RouteRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * Optional. Meshes defines a list of meshes this TcpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeshes() + { + return $this->meshes; + } + + /** + * Optional. Meshes defines a list of meshes this TcpRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeshes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->meshes = $arr; + + return $this; + } + + /** + * Optional. Gateways defines a list of gateways this TcpRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * Optional. Gateways defines a list of gateways this TcpRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGateways($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->gateways = $arr; + + return $this; + } + + /** + * Optional. Set of label tags associated with the TcpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Set of label tags associated with the TcpRoute resource. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/TcpRoute/RouteAction.php b/NetworkServices/src/V1/TcpRoute/RouteAction.php new file mode 100644 index 000000000000..625d6bfaf160 --- /dev/null +++ b/NetworkServices/src/V1/TcpRoute/RouteAction.php @@ -0,0 +1,118 @@ +google.cloud.networkservices.v1.TcpRoute.RouteAction + */ +class RouteAction extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The destination services to which traffic should be forwarded. + * At least one destination service is required. Only one of route + * destination or original destination can be set. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $destinations; + /** + * Optional. If true, Router will use the destination IP and port of the + * original connection as the destination of the request. Default is false. + * Only one of route destinations or original destination can be set. + * + * Generated from protobuf field bool original_destination = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $original_destination = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteDestination>|\Google\Protobuf\Internal\RepeatedField $destinations + * Optional. The destination services to which traffic should be forwarded. + * At least one destination service is required. Only one of route + * destination or original destination can be set. + * @type bool $original_destination + * Optional. If true, Router will use the destination IP and port of the + * original connection as the destination of the request. Default is false. + * Only one of route destinations or original destination can be set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The destination services to which traffic should be forwarded. + * At least one destination service is required. Only one of route + * destination or original destination can be set. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinations() + { + return $this->destinations; + } + + /** + * Optional. The destination services to which traffic should be forwarded. + * At least one destination service is required. Only one of route + * destination or original destination can be set. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteDestination>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TcpRoute\RouteDestination::class); + $this->destinations = $arr; + + return $this; + } + + /** + * Optional. If true, Router will use the destination IP and port of the + * original connection as the destination of the request. Default is false. + * Only one of route destinations or original destination can be set. + * + * Generated from protobuf field bool original_destination = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getOriginalDestination() + { + return $this->original_destination; + } + + /** + * Optional. If true, Router will use the destination IP and port of the + * original connection as the destination of the request. Default is false. + * Only one of route destinations or original destination can be set. + * + * Generated from protobuf field bool original_destination = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setOriginalDestination($var) + { + GPBUtil::checkBool($var); + $this->original_destination = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TcpRoute/RouteDestination.php b/NetworkServices/src/V1/TcpRoute/RouteDestination.php new file mode 100644 index 000000000000..3d34bad73b25 --- /dev/null +++ b/NetworkServices/src/V1/TcpRoute/RouteDestination.php @@ -0,0 +1,142 @@ +google.cloud.networkservices.v1.TcpRoute.RouteDestination + */ +class RouteDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service_name = ''; + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $weight = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_name + * Required. The URL of a BackendService to route traffic to. + * @type int $weight + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Optional. Specifies the proportion of requests forwarded to the backend + * referenced by the serviceName field. This is computed as: + * - weight/Sum(weights in this destination list). + * For non-zero values, there may be some epsilon from the exact proportion + * defined here depending on the precision an implementation supports. + * If only one serviceName is specified and it has a weight greater than 0, + * 100% of the traffic is forwarded to that backend. + * If weights are specified for any one service name, they need to be + * specified for all of them. + * If weights are unspecified for all services, then, traffic is distributed + * in equal proportions to all of them. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setWeight($var) + { + GPBUtil::checkInt32($var); + $this->weight = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TcpRoute/RouteMatch.php b/NetworkServices/src/V1/TcpRoute/RouteMatch.php new file mode 100644 index 000000000000..dcf1ce46d8f5 --- /dev/null +++ b/NetworkServices/src/V1/TcpRoute/RouteMatch.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.TcpRoute.RouteMatch + */ +class RouteMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Must be specified in the CIDR range format. A CIDR range + * consists of an IP Address and a prefix length to construct the subnet + * mask. By default, the prefix length is 32 (i.e. matches a single IP + * address). Only IPV4 addresses are supported. + * Examples: + * "10.0.0.1" - matches against this exact IP address. + * "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet + * and 255.255.255.0 mask. + * "0.0.0.0/0" - matches against any IP address'. + * + * Generated from protobuf field string address = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $address = ''; + /** + * Required. Specifies the destination port to match against. + * + * Generated from protobuf field string port = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $port = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $address + * Required. Must be specified in the CIDR range format. A CIDR range + * consists of an IP Address and a prefix length to construct the subnet + * mask. By default, the prefix length is 32 (i.e. matches a single IP + * address). Only IPV4 addresses are supported. + * Examples: + * "10.0.0.1" - matches against this exact IP address. + * "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet + * and 255.255.255.0 mask. + * "0.0.0.0/0" - matches against any IP address'. + * @type string $port + * Required. Specifies the destination port to match against. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. Must be specified in the CIDR range format. A CIDR range + * consists of an IP Address and a prefix length to construct the subnet + * mask. By default, the prefix length is 32 (i.e. matches a single IP + * address). Only IPV4 addresses are supported. + * Examples: + * "10.0.0.1" - matches against this exact IP address. + * "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet + * and 255.255.255.0 mask. + * "0.0.0.0/0" - matches against any IP address'. + * + * Generated from protobuf field string address = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Required. Must be specified in the CIDR range format. A CIDR range + * consists of an IP Address and a prefix length to construct the subnet + * mask. By default, the prefix length is 32 (i.e. matches a single IP + * address). Only IPV4 addresses are supported. + * Examples: + * "10.0.0.1" - matches against this exact IP address. + * "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet + * and 255.255.255.0 mask. + * "0.0.0.0/0" - matches against any IP address'. + * + * Generated from protobuf field string address = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAddress($var) + { + GPBUtil::checkString($var, True); + $this->address = $var; + + return $this; + } + + /** + * Required. Specifies the destination port to match against. + * + * Generated from protobuf field string port = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPort() + { + return $this->port; + } + + /** + * Required. Specifies the destination port to match against. + * + * Generated from protobuf field string port = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkString($var, True); + $this->port = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TcpRoute/RouteRule.php b/NetworkServices/src/V1/TcpRoute/RouteRule.php new file mode 100644 index 000000000000..93e5aca679ae --- /dev/null +++ b/NetworkServices/src/V1/TcpRoute/RouteRule.php @@ -0,0 +1,125 @@ +google.cloud.networkservices.v1.TcpRoute.RouteRule + */ +class RouteRule extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. If no + * routeMatch field is specified, this rule will unconditionally match + * traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $matches; + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $matches + * Optional. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. If no + * routeMatch field is specified, this rule will unconditionally match + * traffic. + * @type \Google\Cloud\NetworkServices\V1\TcpRoute\RouteAction $action + * Required. The detailed rule defining how to route matched traffic. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. If no + * routeMatch field is specified, this rule will unconditionally match + * traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMatches() + { + return $this->matches; + } + + /** + * Optional. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. If no + * routeMatch field is specified, this rule will unconditionally match + * traffic. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TcpRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\NetworkServices\V1\TcpRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMatches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TcpRoute\RouteMatch::class); + $this->matches = $arr; + + return $this; + } + + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TcpRoute\RouteAction|null + */ + public function getAction() + { + return $this->action; + } + + public function hasAction() + { + return isset($this->action); + } + + public function clearAction() + { + unset($this->action); + } + + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TcpRoute\RouteAction $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TcpRoute\RouteAction::class); + $this->action = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TlsRoute.php b/NetworkServices/src/V1/TlsRoute.php new file mode 100644 index 000000000000..9d44cf7d5e26 --- /dev/null +++ b/NetworkServices/src/V1/TlsRoute.php @@ -0,0 +1,370 @@ +google.cloud.networkservices.v1.TlsRoute + */ +class TlsRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the TlsRoute resource. It matches pattern + * `projects/*/locations/global/tlsRoutes/tls_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $self_link = ''; + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $rules; + /** + * Optional. Meshes defines a list of meshes this TlsRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $meshes; + /** + * Optional. Gateways defines a list of gateways this TlsRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $gateways; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the TlsRoute resource. It matches pattern + * `projects/*/locations/global/tlsRoutes/tls_route_name>`. + * @type string $self_link + * Output only. Server-defined URL of this resource + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the resource was updated. + * @type string $description + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * @type array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $rules + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * @type array|\Google\Protobuf\Internal\RepeatedField $meshes + * Optional. Meshes defines a list of meshes this TlsRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * @type array|\Google\Protobuf\Internal\RepeatedField $gateways + * Optional. Gateways defines a list of gateways this TlsRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the TlsRoute resource. It matches pattern + * `projects/*/locations/global/tlsRoutes/tls_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the TlsRoute resource. It matches pattern + * `projects/*/locations/global/tlsRoutes/tls_route_name>`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getSelfLink() + { + return $this->self_link; + } + + /** + * Output only. Server-defined URL of this resource + * + * Generated from protobuf field string self_link = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSelfLink($var) + { + GPBUtil::checkString($var, True); + $this->self_link = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A free-text description of the resource. Max length 1024 + * characters. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Required. Rules that define how traffic is routed and handled. At least one + * RouteRule must be supplied. If there are multiple rules then the action + * taken will be the first rule to match. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteRule rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TlsRoute\RouteRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * Optional. Meshes defines a list of meshes this TlsRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeshes() + { + return $this->meshes; + } + + /** + * Optional. Meshes defines a list of meshes this TlsRoute is attached to, as + * one of the routing rules to route the requests served by the mesh. + * Each mesh reference should match the pattern: + * `projects/*/locations/global/meshes/` + * The attached Mesh should be of a type SIDECAR + * + * Generated from protobuf field repeated string meshes = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeshes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->meshes = $arr; + + return $this; + } + + /** + * Optional. Gateways defines a list of gateways this TlsRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * Optional. Gateways defines a list of gateways this TlsRoute is attached to, + * as one of the routing rules to route the requests served by the gateway. + * Each gateway reference should match the pattern: + * `projects/*/locations/global/gateways/` + * + * Generated from protobuf field repeated string gateways = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGateways($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->gateways = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/TlsRoute/RouteAction.php b/NetworkServices/src/V1/TlsRoute/RouteAction.php new file mode 100644 index 000000000000..c21d616ff11f --- /dev/null +++ b/NetworkServices/src/V1/TlsRoute/RouteAction.php @@ -0,0 +1,72 @@ +google.cloud.networkservices.v1.TlsRoute.RouteAction + */ +class RouteAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The destination services to which traffic should be forwarded. + * At least one destination service is required. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $destinations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteDestination>|\Google\Protobuf\Internal\RepeatedField $destinations + * Required. The destination services to which traffic should be forwarded. + * At least one destination service is required. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The destination services to which traffic should be forwarded. + * At least one destination service is required. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinations() + { + return $this->destinations; + } + + /** + * Required. The destination services to which traffic should be forwarded. + * At least one destination service is required. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteDestination destinations = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteDestination>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TlsRoute\RouteDestination::class); + $this->destinations = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TlsRoute/RouteDestination.php b/NetworkServices/src/V1/TlsRoute/RouteDestination.php new file mode 100644 index 000000000000..bbf0121a0e41 --- /dev/null +++ b/NetworkServices/src/V1/TlsRoute/RouteDestination.php @@ -0,0 +1,114 @@ +google.cloud.networkservices.v1.TlsRoute.RouteDestination + */ +class RouteDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service_name = ''; + /** + * Optional. Specifies the proportion of requests forwareded to the backend + * referenced by the service_name field. This is computed as: + * - weight/Sum(weights in destinations) + * Weights in all destinations does not need to sum up to 100. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $weight = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_name + * Required. The URL of a BackendService to route traffic to. + * @type int $weight + * Optional. Specifies the proportion of requests forwareded to the backend + * referenced by the service_name field. This is computed as: + * - weight/Sum(weights in destinations) + * Weights in all destinations does not need to sum up to 100. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * Required. The URL of a BackendService to route traffic to. + * + * Generated from protobuf field string service_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + + /** + * Optional. Specifies the proportion of requests forwareded to the backend + * referenced by the service_name field. This is computed as: + * - weight/Sum(weights in destinations) + * Weights in all destinations does not need to sum up to 100. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Optional. Specifies the proportion of requests forwareded to the backend + * referenced by the service_name field. This is computed as: + * - weight/Sum(weights in destinations) + * Weights in all destinations does not need to sum up to 100. + * + * Generated from protobuf field int32 weight = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setWeight($var) + { + GPBUtil::checkInt32($var); + $this->weight = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TlsRoute/RouteMatch.php b/NetworkServices/src/V1/TlsRoute/RouteMatch.php new file mode 100644 index 000000000000..962f1af263a4 --- /dev/null +++ b/NetworkServices/src/V1/TlsRoute/RouteMatch.php @@ -0,0 +1,145 @@ +google.cloud.networkservices.v1.TlsRoute.RouteMatch + */ +class RouteMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. SNI (server name indicator) to match against. + * SNI will be matched against all wildcard domains, i.e. `www.example.com` + * will be first matched against `www.example.com`, then `*.example.com`, + * then `*.com.` + * Partial wildcards are not supported, and values like *w.example.com are + * invalid. + * At least one of sni_host and alpn is required. + * Up to 5 sni hosts across all matches can be set. + * + * Generated from protobuf field repeated string sni_host = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $sni_host; + /** + * Optional. ALPN (Application-Layer Protocol Negotiation) to match against. + * Examples: "http/1.1", "h2". + * At least one of sni_host and alpn is required. + * Up to 5 alpns across all matches can be set. + * + * Generated from protobuf field repeated string alpn = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $alpn; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $sni_host + * Optional. SNI (server name indicator) to match against. + * SNI will be matched against all wildcard domains, i.e. `www.example.com` + * will be first matched against `www.example.com`, then `*.example.com`, + * then `*.com.` + * Partial wildcards are not supported, and values like *w.example.com are + * invalid. + * At least one of sni_host and alpn is required. + * Up to 5 sni hosts across all matches can be set. + * @type array|\Google\Protobuf\Internal\RepeatedField $alpn + * Optional. ALPN (Application-Layer Protocol Negotiation) to match against. + * Examples: "http/1.1", "h2". + * At least one of sni_host and alpn is required. + * Up to 5 alpns across all matches can be set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. SNI (server name indicator) to match against. + * SNI will be matched against all wildcard domains, i.e. `www.example.com` + * will be first matched against `www.example.com`, then `*.example.com`, + * then `*.com.` + * Partial wildcards are not supported, and values like *w.example.com are + * invalid. + * At least one of sni_host and alpn is required. + * Up to 5 sni hosts across all matches can be set. + * + * Generated from protobuf field repeated string sni_host = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSniHost() + { + return $this->sni_host; + } + + /** + * Optional. SNI (server name indicator) to match against. + * SNI will be matched against all wildcard domains, i.e. `www.example.com` + * will be first matched against `www.example.com`, then `*.example.com`, + * then `*.com.` + * Partial wildcards are not supported, and values like *w.example.com are + * invalid. + * At least one of sni_host and alpn is required. + * Up to 5 sni hosts across all matches can be set. + * + * Generated from protobuf field repeated string sni_host = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSniHost($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->sni_host = $arr; + + return $this; + } + + /** + * Optional. ALPN (Application-Layer Protocol Negotiation) to match against. + * Examples: "http/1.1", "h2". + * At least one of sni_host and alpn is required. + * Up to 5 alpns across all matches can be set. + * + * Generated from protobuf field repeated string alpn = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAlpn() + { + return $this->alpn; + } + + /** + * Optional. ALPN (Application-Layer Protocol Negotiation) to match against. + * Examples: "http/1.1", "h2". + * At least one of sni_host and alpn is required. + * Up to 5 alpns across all matches can be set. + * + * Generated from protobuf field repeated string alpn = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAlpn($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->alpn = $arr; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TlsRoute/RouteRule.php b/NetworkServices/src/V1/TlsRoute/RouteRule.php new file mode 100644 index 000000000000..4858d3637394 --- /dev/null +++ b/NetworkServices/src/V1/TlsRoute/RouteRule.php @@ -0,0 +1,117 @@ +google.cloud.networkservices.v1.TlsRoute.RouteRule + */ +class RouteRule extends \Google\Protobuf\Internal\Message +{ + /** + * Required. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $matches; + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $matches + * Required. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. + * @type \Google\Cloud\NetworkServices\V1\TlsRoute\RouteAction $action + * Required. The detailed rule defining how to route matched traffic. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Required. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMatches() + { + return $this->matches; + } + + /** + * Required. RouteMatch defines the predicate used to match requests to a + * given action. Multiple match types are "OR"ed for evaluation. + * + * Generated from protobuf field repeated .google.cloud.networkservices.v1.TlsRoute.RouteMatch matches = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\NetworkServices\V1\TlsRoute\RouteMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMatches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\TlsRoute\RouteMatch::class); + $this->matches = $arr; + + return $this; + } + + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TlsRoute\RouteAction|null + */ + public function getAction() + { + return $this->action; + } + + public function hasAction() + { + return isset($this->action); + } + + public function clearAction() + { + unset($this->action); + } + + /** + * Required. The detailed rule defining how to route matched traffic. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute.RouteAction action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TlsRoute\RouteAction $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TlsRoute\RouteAction::class); + $this->action = $var; + + return $this; + } + +} + + diff --git a/NetworkServices/src/V1/TrafficPortSelector.php b/NetworkServices/src/V1/TrafficPortSelector.php new file mode 100644 index 000000000000..409d32c196e4 --- /dev/null +++ b/NetworkServices/src/V1/TrafficPortSelector.php @@ -0,0 +1,79 @@ +google.cloud.networkservices.v1.TrafficPortSelector + */ +class TrafficPortSelector extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A list of ports. Can be port numbers or port range + * (example, [80-90] specifies all ports from 80 to 90, including + * 80 and 90) or named ports or * to specify all ports. If the + * list is empty, all ports are selected. + * + * Generated from protobuf field repeated string ports = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $ports; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $ports + * Optional. A list of ports. Can be port numbers or port range + * (example, [80-90] specifies all ports from 80 to 90, including + * 80 and 90) or named ports or * to specify all ports. If the + * list is empty, all ports are selected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A list of ports. Can be port numbers or port range + * (example, [80-90] specifies all ports from 80 to 90, including + * 80 and 90) or named ports or * to specify all ports. If the + * list is empty, all ports are selected. + * + * Generated from protobuf field repeated string ports = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPorts() + { + return $this->ports; + } + + /** + * Optional. A list of ports. Can be port numbers or port range + * (example, [80-90] specifies all ports from 80 to 90, including + * 80 and 90) or named ports or * to specify all ports. If the + * list is empty, all ports are selected. + * + * Generated from protobuf field repeated string ports = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPorts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ports = $arr; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateEndpointPolicyRequest.php b/NetworkServices/src/V1/UpdateEndpointPolicyRequest.php new file mode 100644 index 000000000000..740ea6a28f2f --- /dev/null +++ b/NetworkServices/src/V1/UpdateEndpointPolicyRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateEndpointPolicyRequest + */ +class UpdateEndpointPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * EndpointPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated EndpointPolicy resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $endpoint_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * EndpointPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\EndpointPolicy $endpoint_policy + * Required. Updated EndpointPolicy resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\EndpointPolicy::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * EndpointPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * EndpointPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated EndpointPolicy resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\EndpointPolicy|null + */ + public function getEndpointPolicy() + { + return $this->endpoint_policy; + } + + public function hasEndpointPolicy() + { + return isset($this->endpoint_policy); + } + + public function clearEndpointPolicy() + { + unset($this->endpoint_policy); + } + + /** + * Required. Updated EndpointPolicy resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.EndpointPolicy endpoint_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\EndpointPolicy $var + * @return $this + */ + public function setEndpointPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\EndpointPolicy::class); + $this->endpoint_policy = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateGatewayRequest.php b/NetworkServices/src/V1/UpdateGatewayRequest.php new file mode 100644 index 000000000000..1e79d3c2758d --- /dev/null +++ b/NetworkServices/src/V1/UpdateGatewayRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateGatewayRequest + */ +class UpdateGatewayRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Gateway resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated Gateway resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $gateway = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Gateway resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\Gateway $gateway + * Required. Updated Gateway resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Gateway::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Gateway resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Gateway resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated Gateway resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\Gateway|null + */ + public function getGateway() + { + return $this->gateway; + } + + public function hasGateway() + { + return isset($this->gateway); + } + + public function clearGateway() + { + unset($this->gateway); + } + + /** + * Required. Updated Gateway resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Gateway gateway = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\Gateway $var + * @return $this + */ + public function setGateway($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\Gateway::class); + $this->gateway = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateGrpcRouteRequest.php b/NetworkServices/src/V1/UpdateGrpcRouteRequest.php new file mode 100644 index 000000000000..5411ee2c11a8 --- /dev/null +++ b/NetworkServices/src/V1/UpdateGrpcRouteRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateGrpcRouteRequest + */ +class UpdateGrpcRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * GrpcRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated GrpcRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $grpc_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * GrpcRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\GrpcRoute $grpc_route + * Required. Updated GrpcRoute resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\GrpcRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * GrpcRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * GrpcRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated GrpcRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\GrpcRoute|null + */ + public function getGrpcRoute() + { + return $this->grpc_route; + } + + public function hasGrpcRoute() + { + return isset($this->grpc_route); + } + + public function clearGrpcRoute() + { + unset($this->grpc_route); + } + + /** + * Required. Updated GrpcRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.GrpcRoute grpc_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\GrpcRoute $var + * @return $this + */ + public function setGrpcRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\GrpcRoute::class); + $this->grpc_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateHttpRouteRequest.php b/NetworkServices/src/V1/UpdateHttpRouteRequest.php new file mode 100644 index 000000000000..292e9c1af9d9 --- /dev/null +++ b/NetworkServices/src/V1/UpdateHttpRouteRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateHttpRouteRequest + */ +class UpdateHttpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * HttpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated HttpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $http_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * HttpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\HttpRoute $http_route + * Required. Updated HttpRoute resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * HttpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * HttpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated HttpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\HttpRoute|null + */ + public function getHttpRoute() + { + return $this->http_route; + } + + public function hasHttpRoute() + { + return isset($this->http_route); + } + + public function clearHttpRoute() + { + unset($this->http_route); + } + + /** + * Required. Updated HttpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.HttpRoute http_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\HttpRoute $var + * @return $this + */ + public function setHttpRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute::class); + $this->http_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateLbRouteExtensionRequest.php b/NetworkServices/src/V1/UpdateLbRouteExtensionRequest.php new file mode 100644 index 000000000000..ec0253dd7b40 --- /dev/null +++ b/NetworkServices/src/V1/UpdateLbRouteExtensionRequest.php @@ -0,0 +1,211 @@ +google.cloud.networkservices.v1.UpdateLbRouteExtensionRequest + */ +class UpdateLbRouteExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbRouteExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. `LbRouteExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_route_extension = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Used to specify the fields to be overwritten in the + * `LbRouteExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @type \Google\Cloud\NetworkServices\V1\LbRouteExtension $lb_route_extension + * Required. `LbRouteExtension` resource being updated. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbRouteExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbRouteExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. `LbRouteExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\LbRouteExtension|null + */ + public function getLbRouteExtension() + { + return $this->lb_route_extension; + } + + public function hasLbRouteExtension() + { + return isset($this->lb_route_extension); + } + + public function clearLbRouteExtension() + { + unset($this->lb_route_extension); + } + + /** + * Required. `LbRouteExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbRouteExtension lb_route_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\LbRouteExtension $var + * @return $this + */ + public function setLbRouteExtension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\LbRouteExtension::class); + $this->lb_route_extension = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateLbTrafficExtensionRequest.php b/NetworkServices/src/V1/UpdateLbTrafficExtensionRequest.php new file mode 100644 index 000000000000..808280a78d2e --- /dev/null +++ b/NetworkServices/src/V1/UpdateLbTrafficExtensionRequest.php @@ -0,0 +1,211 @@ +google.cloud.networkservices.v1.UpdateLbTrafficExtensionRequest + */ +class UpdateLbTrafficExtensionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbTrafficExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. `LbTrafficExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lb_traffic_extension = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Used to specify the fields to be overwritten in the + * `LbTrafficExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @type \Google\Cloud\NetworkServices\V1\LbTrafficExtension $lb_traffic_extension + * Required. `LbTrafficExtension` resource being updated. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbTrafficExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Used to specify the fields to be overwritten in the + * `LbTrafficExtension` resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. `LbTrafficExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\LbTrafficExtension|null + */ + public function getLbTrafficExtension() + { + return $this->lb_traffic_extension; + } + + public function hasLbTrafficExtension() + { + return isset($this->lb_traffic_extension); + } + + public function clearLbTrafficExtension() + { + unset($this->lb_traffic_extension); + } + + /** + * Required. `LbTrafficExtension` resource being updated. + * + * Generated from protobuf field .google.cloud.networkservices.v1.LbTrafficExtension lb_traffic_extension = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\LbTrafficExtension $var + * @return $this + */ + public function setLbTrafficExtension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\LbTrafficExtension::class); + $this->lb_traffic_extension = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateMeshRequest.php b/NetworkServices/src/V1/UpdateMeshRequest.php new file mode 100644 index 000000000000..ce964500953b --- /dev/null +++ b/NetworkServices/src/V1/UpdateMeshRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateMeshRequest + */ +class UpdateMeshRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Mesh resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated Mesh resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $mesh = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Mesh resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\Mesh $mesh + * Required. Updated Mesh resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\Mesh::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Mesh resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Mesh resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated Mesh resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\Mesh|null + */ + public function getMesh() + { + return $this->mesh; + } + + public function hasMesh() + { + return isset($this->mesh); + } + + public function clearMesh() + { + unset($this->mesh); + } + + /** + * Required. Updated Mesh resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.Mesh mesh = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\Mesh $var + * @return $this + */ + public function setMesh($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\Mesh::class); + $this->mesh = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateTcpRouteRequest.php b/NetworkServices/src/V1/UpdateTcpRouteRequest.php new file mode 100644 index 000000000000..6b041d9abb14 --- /dev/null +++ b/NetworkServices/src/V1/UpdateTcpRouteRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateTcpRouteRequest + */ +class UpdateTcpRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TcpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated TcpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tcp_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * TcpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\TcpRoute $tcp_route + * Required. Updated TcpRoute resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TcpRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TcpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TcpRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated TcpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TcpRoute|null + */ + public function getTcpRoute() + { + return $this->tcp_route; + } + + public function hasTcpRoute() + { + return isset($this->tcp_route); + } + + public function clearTcpRoute() + { + unset($this->tcp_route); + } + + /** + * Required. Updated TcpRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TcpRoute tcp_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TcpRoute $var + * @return $this + */ + public function setTcpRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TcpRoute::class); + $this->tcp_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/UpdateTlsRouteRequest.php b/NetworkServices/src/V1/UpdateTlsRouteRequest.php new file mode 100644 index 000000000000..ad8536d49340 --- /dev/null +++ b/NetworkServices/src/V1/UpdateTlsRouteRequest.php @@ -0,0 +1,137 @@ +google.cloud.networkservices.v1.UpdateTlsRouteRequest + */ +class UpdateTlsRouteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. Updated TlsRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tls_route = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\NetworkServices\V1\TlsRoute $tls_route + * Required. Updated TlsRoute resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Networkservices\V1\TlsRoute::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsRoute resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Updated TlsRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\NetworkServices\V1\TlsRoute|null + */ + public function getTlsRoute() + { + return $this->tls_route; + } + + public function hasTlsRoute() + { + return isset($this->tls_route); + } + + public function clearTlsRoute() + { + unset($this->tls_route); + } + + /** + * Required. Updated TlsRoute resource. + * + * Generated from protobuf field .google.cloud.networkservices.v1.TlsRoute tls_route = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\NetworkServices\V1\TlsRoute $var + * @return $this + */ + public function setTlsRoute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\TlsRoute::class); + $this->tls_route = $var; + + return $this; + } + +} + diff --git a/NetworkServices/src/V1/gapic_metadata.json b/NetworkServices/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..6242fe95cd6a --- /dev/null +++ b/NetworkServices/src/V1/gapic_metadata.json @@ -0,0 +1,322 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.networkservices.v1", + "libraryPackage": "Google\\Cloud\\NetworkServices\\V1", + "services": { + "DepService": { + "clients": { + "grpc": { + "libraryClient": "DepServiceGapicClient", + "rpcs": { + "CreateLbRouteExtension": { + "methods": [ + "createLbRouteExtension" + ] + }, + "CreateLbTrafficExtension": { + "methods": [ + "createLbTrafficExtension" + ] + }, + "DeleteLbRouteExtension": { + "methods": [ + "deleteLbRouteExtension" + ] + }, + "DeleteLbTrafficExtension": { + "methods": [ + "deleteLbTrafficExtension" + ] + }, + "GetLbRouteExtension": { + "methods": [ + "getLbRouteExtension" + ] + }, + "GetLbTrafficExtension": { + "methods": [ + "getLbTrafficExtension" + ] + }, + "ListLbRouteExtensions": { + "methods": [ + "listLbRouteExtensions" + ] + }, + "ListLbTrafficExtensions": { + "methods": [ + "listLbTrafficExtensions" + ] + }, + "UpdateLbRouteExtension": { + "methods": [ + "updateLbRouteExtension" + ] + }, + "UpdateLbTrafficExtension": { + "methods": [ + "updateLbTrafficExtension" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + }, + "NetworkServices": { + "clients": { + "grpc": { + "libraryClient": "NetworkServicesGapicClient", + "rpcs": { + "CreateEndpointPolicy": { + "methods": [ + "createEndpointPolicy" + ] + }, + "CreateGateway": { + "methods": [ + "createGateway" + ] + }, + "CreateGrpcRoute": { + "methods": [ + "createGrpcRoute" + ] + }, + "CreateHttpRoute": { + "methods": [ + "createHttpRoute" + ] + }, + "CreateMesh": { + "methods": [ + "createMesh" + ] + }, + "CreateServiceBinding": { + "methods": [ + "createServiceBinding" + ] + }, + "CreateTcpRoute": { + "methods": [ + "createTcpRoute" + ] + }, + "CreateTlsRoute": { + "methods": [ + "createTlsRoute" + ] + }, + "DeleteEndpointPolicy": { + "methods": [ + "deleteEndpointPolicy" + ] + }, + "DeleteGateway": { + "methods": [ + "deleteGateway" + ] + }, + "DeleteGrpcRoute": { + "methods": [ + "deleteGrpcRoute" + ] + }, + "DeleteHttpRoute": { + "methods": [ + "deleteHttpRoute" + ] + }, + "DeleteMesh": { + "methods": [ + "deleteMesh" + ] + }, + "DeleteServiceBinding": { + "methods": [ + "deleteServiceBinding" + ] + }, + "DeleteTcpRoute": { + "methods": [ + "deleteTcpRoute" + ] + }, + "DeleteTlsRoute": { + "methods": [ + "deleteTlsRoute" + ] + }, + "GetEndpointPolicy": { + "methods": [ + "getEndpointPolicy" + ] + }, + "GetGateway": { + "methods": [ + "getGateway" + ] + }, + "GetGrpcRoute": { + "methods": [ + "getGrpcRoute" + ] + }, + "GetHttpRoute": { + "methods": [ + "getHttpRoute" + ] + }, + "GetMesh": { + "methods": [ + "getMesh" + ] + }, + "GetServiceBinding": { + "methods": [ + "getServiceBinding" + ] + }, + "GetTcpRoute": { + "methods": [ + "getTcpRoute" + ] + }, + "GetTlsRoute": { + "methods": [ + "getTlsRoute" + ] + }, + "ListEndpointPolicies": { + "methods": [ + "listEndpointPolicies" + ] + }, + "ListGateways": { + "methods": [ + "listGateways" + ] + }, + "ListGrpcRoutes": { + "methods": [ + "listGrpcRoutes" + ] + }, + "ListHttpRoutes": { + "methods": [ + "listHttpRoutes" + ] + }, + "ListMeshes": { + "methods": [ + "listMeshes" + ] + }, + "ListServiceBindings": { + "methods": [ + "listServiceBindings" + ] + }, + "ListTcpRoutes": { + "methods": [ + "listTcpRoutes" + ] + }, + "ListTlsRoutes": { + "methods": [ + "listTlsRoutes" + ] + }, + "UpdateEndpointPolicy": { + "methods": [ + "updateEndpointPolicy" + ] + }, + "UpdateGateway": { + "methods": [ + "updateGateway" + ] + }, + "UpdateGrpcRoute": { + "methods": [ + "updateGrpcRoute" + ] + }, + "UpdateHttpRoute": { + "methods": [ + "updateHttpRoute" + ] + }, + "UpdateMesh": { + "methods": [ + "updateMesh" + ] + }, + "UpdateTcpRoute": { + "methods": [ + "updateTcpRoute" + ] + }, + "UpdateTlsRoute": { + "methods": [ + "updateTlsRoute" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/NetworkServices/src/V1/resources/dep_service_client_config.json b/NetworkServices/src/V1/resources/dep_service_client_config.json new file mode 100644 index 000000000000..dad488e147d4 --- /dev/null +++ b/NetworkServices/src/V1/resources/dep_service_client_config.json @@ -0,0 +1,107 @@ +{ + "interfaces": { + "google.cloud.networkservices.v1.DepService": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateLbRouteExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateLbTrafficExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteLbRouteExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteLbTrafficExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLbRouteExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLbTrafficExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLbRouteExtensions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLbTrafficExtensions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateLbRouteExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateLbTrafficExtension": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/NetworkServices/src/V1/resources/dep_service_descriptor_config.php b/NetworkServices/src/V1/resources/dep_service_descriptor_config.php new file mode 100644 index 000000000000..1dab206f9965 --- /dev/null +++ b/NetworkServices/src/V1/resources/dep_service_descriptor_config.php @@ -0,0 +1,131 @@ + [ + 'google.cloud.networkservices.v1.DepService' => [ + 'CreateLbRouteExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\LbRouteExtension', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateLbTrafficExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\LbTrafficExtension', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteLbRouteExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteLbTrafficExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateLbRouteExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\LbRouteExtension', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateLbTrafficExtension' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\LbTrafficExtension', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListLbRouteExtensions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLbRouteExtensions', + ], + ], + 'ListLbTrafficExtensions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLbTrafficExtensions', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/NetworkServices/src/V1/resources/dep_service_rest_client_config.php b/NetworkServices/src/V1/resources/dep_service_rest_client_config.php new file mode 100644 index 000000000000..00779b775bb0 --- /dev/null +++ b/NetworkServices/src/V1/resources/dep_service_rest_client_config.php @@ -0,0 +1,349 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.networkservices.v1.DepService' => [ + 'CreateLbRouteExtension' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/lbRouteExtensions', + 'body' => 'lb_route_extension', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'lb_route_extension_id', + ], + ], + 'CreateLbTrafficExtension' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/lbTrafficExtensions', + 'body' => 'lb_traffic_extension', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'lb_traffic_extension_id', + ], + ], + 'DeleteLbRouteExtension' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/lbRouteExtensions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteLbTrafficExtension' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/lbTrafficExtensions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLbRouteExtension' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/lbRouteExtensions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLbTrafficExtension' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/lbTrafficExtensions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLbRouteExtensions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/lbRouteExtensions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListLbTrafficExtensions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/lbTrafficExtensions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateLbRouteExtension' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{lb_route_extension.name=projects/*/locations/*/lbRouteExtensions/*}', + 'body' => 'lb_route_extension', + 'placeholders' => [ + 'lb_route_extension.name' => [ + 'getters' => [ + 'getLbRouteExtension', + 'getName', + ], + ], + ], + ], + 'UpdateLbTrafficExtension' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{lb_traffic_extension.name=projects/*/locations/*/lbTrafficExtensions/*}', + 'body' => 'lb_traffic_extension', + 'placeholders' => [ + 'lb_traffic_extension.name' => [ + 'getters' => [ + 'getLbTrafficExtension', + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/NetworkServices/src/V1/resources/network_services_client_config.json b/NetworkServices/src/V1/resources/network_services_client_config.json new file mode 100644 index 000000000000..39cf35750a4b --- /dev/null +++ b/NetworkServices/src/V1/resources/network_services_client_config.json @@ -0,0 +1,252 @@ +{ + "interfaces": { + "google.cloud.networkservices.v1.NetworkServices": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateEndpointPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateGateway": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateGrpcRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateHttpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateMesh": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateServiceBinding": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateTcpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateTlsRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteEndpointPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteGateway": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteGrpcRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteHttpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteMesh": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteServiceBinding": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteTcpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteTlsRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetEndpointPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetGateway": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetGrpcRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetHttpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetMesh": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetServiceBinding": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetTcpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetTlsRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListEndpointPolicies": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListGateways": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListGrpcRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListHttpRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListMeshes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListServiceBindings": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListTcpRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListTlsRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateEndpointPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateGateway": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateGrpcRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateHttpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateMesh": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateTcpRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateTlsRoute": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/NetworkServices/src/V1/resources/network_services_descriptor_config.php b/NetworkServices/src/V1/resources/network_services_descriptor_config.php new file mode 100644 index 000000000000..41cddfb811e0 --- /dev/null +++ b/NetworkServices/src/V1/resources/network_services_descriptor_config.php @@ -0,0 +1,361 @@ + [ + 'google.cloud.networkservices.v1.NetworkServices' => [ + 'CreateEndpointPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\EndpointPolicy', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateGateway' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\Gateway', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateGrpcRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\GrpcRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateHttpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\HttpRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateMesh' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\Mesh', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateServiceBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\ServiceBinding', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateTcpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\TcpRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateTlsRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\TlsRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteEndpointPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteGateway' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteGrpcRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteHttpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteMesh' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteServiceBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteTcpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteTlsRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateEndpointPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\EndpointPolicy', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateGateway' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\Gateway', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateGrpcRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\GrpcRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateHttpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\HttpRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateMesh' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\Mesh', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateTcpRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\TcpRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateTlsRoute' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\NetworkServices\V1\TlsRoute', + 'metadataReturnType' => '\Google\Cloud\NetworkServices\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListEndpointPolicies' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getEndpointPolicies', + ], + ], + 'ListGateways' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGateways', + ], + ], + 'ListGrpcRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGrpcRoutes', + ], + ], + 'ListHttpRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getHttpRoutes', + ], + ], + 'ListMeshes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMeshes', + ], + ], + 'ListServiceBindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServiceBindings', + ], + ], + 'ListTcpRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTcpRoutes', + ], + ], + 'ListTlsRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTlsRoutes', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + ], + ], +]; diff --git a/NetworkServices/src/V1/resources/network_services_rest_client_config.php b/NetworkServices/src/V1/resources/network_services_rest_client_config.php new file mode 100644 index 000000000000..ca9776abdda5 --- /dev/null +++ b/NetworkServices/src/V1/resources/network_services_rest_client_config.php @@ -0,0 +1,702 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.networkservices.v1.NetworkServices' => [ + 'CreateEndpointPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/endpointPolicies', + 'body' => 'endpoint_policy', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'endpoint_policy_id', + ], + ], + 'CreateGateway' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/gateways', + 'body' => 'gateway', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'gateway_id', + ], + ], + 'CreateGrpcRoute' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/grpcRoutes', + 'body' => 'grpc_route', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'grpc_route_id', + ], + ], + 'CreateHttpRoute' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/httpRoutes', + 'body' => 'http_route', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'http_route_id', + ], + ], + 'CreateMesh' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/meshes', + 'body' => 'mesh', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'mesh_id', + ], + ], + 'CreateServiceBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/serviceBindings', + 'body' => 'service_binding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'service_binding_id', + ], + ], + 'CreateTcpRoute' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tcpRoutes', + 'body' => 'tcp_route', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'tcp_route_id', + ], + ], + 'CreateTlsRoute' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tlsRoutes', + 'body' => 'tls_route', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'tls_route_id', + ], + ], + 'DeleteEndpointPolicy' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/endpointPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGateway' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/gateways/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGrpcRoute' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/grpcRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteHttpRoute' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/httpRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMesh' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/meshes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteServiceBinding' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/serviceBindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTcpRoute' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/tcpRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTlsRoute' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/tlsRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetEndpointPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/endpointPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGateway' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/gateways/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGrpcRoute' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/grpcRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetHttpRoute' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/httpRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMesh' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/meshes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetServiceBinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/serviceBindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTcpRoute' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/tcpRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTlsRoute' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/tlsRoutes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListEndpointPolicies' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/endpointPolicies', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListGateways' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/gateways', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListGrpcRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/grpcRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListHttpRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/httpRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMeshes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/meshes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListServiceBindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/serviceBindings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListTcpRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tcpRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListTlsRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tlsRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateEndpointPolicy' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{endpoint_policy.name=projects/*/locations/*/endpointPolicies/*}', + 'body' => 'endpoint_policy', + 'placeholders' => [ + 'endpoint_policy.name' => [ + 'getters' => [ + 'getEndpointPolicy', + 'getName', + ], + ], + ], + ], + 'UpdateGateway' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{gateway.name=projects/*/locations/*/gateways/*}', + 'body' => 'gateway', + 'placeholders' => [ + 'gateway.name' => [ + 'getters' => [ + 'getGateway', + 'getName', + ], + ], + ], + ], + 'UpdateGrpcRoute' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{grpc_route.name=projects/*/locations/*/grpcRoutes/*}', + 'body' => 'grpc_route', + 'placeholders' => [ + 'grpc_route.name' => [ + 'getters' => [ + 'getGrpcRoute', + 'getName', + ], + ], + ], + ], + 'UpdateHttpRoute' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{http_route.name=projects/*/locations/*/httpRoutes/*}', + 'body' => 'http_route', + 'placeholders' => [ + 'http_route.name' => [ + 'getters' => [ + 'getHttpRoute', + 'getName', + ], + ], + ], + ], + 'UpdateMesh' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{mesh.name=projects/*/locations/*/meshes/*}', + 'body' => 'mesh', + 'placeholders' => [ + 'mesh.name' => [ + 'getters' => [ + 'getMesh', + 'getName', + ], + ], + ], + ], + 'UpdateTcpRoute' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{tcp_route.name=projects/*/locations/*/tcpRoutes/*}', + 'body' => 'tcp_route', + 'placeholders' => [ + 'tcp_route.name' => [ + 'getters' => [ + 'getTcpRoute', + 'getName', + ], + ], + ], + ], + 'UpdateTlsRoute' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{tls_route.name=projects/*/locations/*/tlsRoutes/*}', + 'body' => 'tls_route', + 'placeholders' => [ + 'tls_route.name' => [ + 'getters' => [ + 'getTlsRoute', + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheKeysets/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheOrigins/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/edgeCacheServices/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/endpointPolicies/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/serviceBindings/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/meshes/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/gateways/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/NetworkServices/tests/Unit/V1/DepServiceClientTest.php b/NetworkServices/tests/Unit/V1/DepServiceClientTest.php new file mode 100644 index 000000000000..4941a961fba3 --- /dev/null +++ b/NetworkServices/tests/Unit/V1/DepServiceClientTest.php @@ -0,0 +1,1442 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DepServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DepServiceClient($options); + } + + /** @test */ + public function createLbRouteExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new LbRouteExtension(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLbRouteExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $lbRouteExtensionId = 'lbRouteExtensionId1673910458'; + $lbRouteExtension = new LbRouteExtension(); + $lbRouteExtensionName = 'lbRouteExtensionName-498882633'; + $lbRouteExtension->setName($lbRouteExtensionName); + $lbRouteExtensionForwardingRules = []; + $lbRouteExtension->setForwardingRules($lbRouteExtensionForwardingRules); + $lbRouteExtensionExtensionChains = []; + $lbRouteExtension->setExtensionChains($lbRouteExtensionExtensionChains); + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbRouteExtension->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + $response = $gapicClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/CreateLbRouteExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLbRouteExtensionId(); + $this->assertProtobufEquals($lbRouteExtensionId, $actualValue); + $actualValue = $actualApiRequestObject->getLbRouteExtension(); + $this->assertProtobufEquals($lbRouteExtension, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLbRouteExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createLbRouteExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $lbRouteExtensionId = 'lbRouteExtensionId1673910458'; + $lbRouteExtension = new LbRouteExtension(); + $lbRouteExtensionName = 'lbRouteExtensionName-498882633'; + $lbRouteExtension->setName($lbRouteExtensionName); + $lbRouteExtensionForwardingRules = []; + $lbRouteExtension->setForwardingRules($lbRouteExtensionForwardingRules); + $lbRouteExtensionExtensionChains = []; + $lbRouteExtension->setExtensionChains($lbRouteExtensionExtensionChains); + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbRouteExtension->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + $response = $gapicClient->createLbRouteExtension($formattedParent, $lbRouteExtensionId, $lbRouteExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLbRouteExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createLbTrafficExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new LbTrafficExtension(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLbTrafficExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $lbTrafficExtensionId = 'lbTrafficExtensionId1573377862'; + $lbTrafficExtension = new LbTrafficExtension(); + $lbTrafficExtensionName = 'lbTrafficExtensionName1872015107'; + $lbTrafficExtension->setName($lbTrafficExtensionName); + $lbTrafficExtensionForwardingRules = []; + $lbTrafficExtension->setForwardingRules($lbTrafficExtensionForwardingRules); + $lbTrafficExtensionExtensionChains = []; + $lbTrafficExtension->setExtensionChains($lbTrafficExtensionExtensionChains); + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbTrafficExtension->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + $response = $gapicClient->createLbTrafficExtension($formattedParent, $lbTrafficExtensionId, $lbTrafficExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/CreateLbTrafficExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLbTrafficExtensionId(); + $this->assertProtobufEquals($lbTrafficExtensionId, $actualValue); + $actualValue = $actualApiRequestObject->getLbTrafficExtension(); + $this->assertProtobufEquals($lbTrafficExtension, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLbTrafficExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createLbTrafficExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $lbTrafficExtensionId = 'lbTrafficExtensionId1573377862'; + $lbTrafficExtension = new LbTrafficExtension(); + $lbTrafficExtensionName = 'lbTrafficExtensionName1872015107'; + $lbTrafficExtension->setName($lbTrafficExtensionName); + $lbTrafficExtensionForwardingRules = []; + $lbTrafficExtension->setForwardingRules($lbTrafficExtensionForwardingRules); + $lbTrafficExtensionExtensionChains = []; + $lbTrafficExtension->setExtensionChains($lbTrafficExtensionExtensionChains); + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbTrafficExtension->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + $response = $gapicClient->createLbTrafficExtension($formattedParent, $lbTrafficExtensionId, $lbTrafficExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLbTrafficExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLbRouteExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLbRouteExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + $response = $gapicClient->deleteLbRouteExtension($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/DeleteLbRouteExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLbRouteExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLbRouteExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + $response = $gapicClient->deleteLbRouteExtension($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLbRouteExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLbTrafficExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLbTrafficExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + $response = $gapicClient->deleteLbTrafficExtension($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/DeleteLbTrafficExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLbTrafficExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLbTrafficExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + $response = $gapicClient->deleteLbTrafficExtension($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLbTrafficExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getLbRouteExtensionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new LbRouteExtension(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + $response = $gapicClient->getLbRouteExtension($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/GetLbRouteExtension', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLbRouteExtensionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->lbRouteExtensionName('[PROJECT]', '[LOCATION]', '[LB_ROUTE_EXTENSION]'); + try { + $gapicClient->getLbRouteExtension($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLbTrafficExtensionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new LbTrafficExtension(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + $response = $gapicClient->getLbTrafficExtension($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/GetLbTrafficExtension', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLbTrafficExtensionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->lbTrafficExtensionName('[PROJECT]', '[LOCATION]', '[LB_TRAFFIC_EXTENSION]'); + try { + $gapicClient->getLbTrafficExtension($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLbRouteExtensionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $lbRouteExtensionsElement = new LbRouteExtension(); + $lbRouteExtensions = [ + $lbRouteExtensionsElement, + ]; + $expectedResponse = new ListLbRouteExtensionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLbRouteExtensions($lbRouteExtensions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listLbRouteExtensions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLbRouteExtensions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/ListLbRouteExtensions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLbRouteExtensionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listLbRouteExtensions($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLbTrafficExtensionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $lbTrafficExtensionsElement = new LbTrafficExtension(); + $lbTrafficExtensions = [ + $lbTrafficExtensionsElement, + ]; + $expectedResponse = new ListLbTrafficExtensionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLbTrafficExtensions($lbTrafficExtensions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listLbTrafficExtensions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLbTrafficExtensions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/ListLbTrafficExtensions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLbTrafficExtensionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listLbTrafficExtensions($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateLbRouteExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new LbRouteExtension(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateLbRouteExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $lbRouteExtension = new LbRouteExtension(); + $lbRouteExtensionName = 'lbRouteExtensionName-498882633'; + $lbRouteExtension->setName($lbRouteExtensionName); + $lbRouteExtensionForwardingRules = []; + $lbRouteExtension->setForwardingRules($lbRouteExtensionForwardingRules); + $lbRouteExtensionExtensionChains = []; + $lbRouteExtension->setExtensionChains($lbRouteExtensionExtensionChains); + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbRouteExtension->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + $response = $gapicClient->updateLbRouteExtension($lbRouteExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/UpdateLbRouteExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getLbRouteExtension(); + $this->assertProtobufEquals($lbRouteExtension, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLbRouteExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateLbRouteExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateLbRouteExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $lbRouteExtension = new LbRouteExtension(); + $lbRouteExtensionName = 'lbRouteExtensionName-498882633'; + $lbRouteExtension->setName($lbRouteExtensionName); + $lbRouteExtensionForwardingRules = []; + $lbRouteExtension->setForwardingRules($lbRouteExtensionForwardingRules); + $lbRouteExtensionExtensionChains = []; + $lbRouteExtension->setExtensionChains($lbRouteExtensionExtensionChains); + $lbRouteExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbRouteExtension->setLoadBalancingScheme($lbRouteExtensionLoadBalancingScheme); + $response = $gapicClient->updateLbRouteExtension($lbRouteExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLbRouteExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateLbTrafficExtensionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new LbTrafficExtension(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateLbTrafficExtensionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $lbTrafficExtension = new LbTrafficExtension(); + $lbTrafficExtensionName = 'lbTrafficExtensionName1872015107'; + $lbTrafficExtension->setName($lbTrafficExtensionName); + $lbTrafficExtensionForwardingRules = []; + $lbTrafficExtension->setForwardingRules($lbTrafficExtensionForwardingRules); + $lbTrafficExtensionExtensionChains = []; + $lbTrafficExtension->setExtensionChains($lbTrafficExtensionExtensionChains); + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbTrafficExtension->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + $response = $gapicClient->updateLbTrafficExtension($lbTrafficExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.DepService/UpdateLbTrafficExtension', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getLbTrafficExtension(); + $this->assertProtobufEquals($lbTrafficExtension, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLbTrafficExtensionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateLbTrafficExtensionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateLbTrafficExtensionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $lbTrafficExtension = new LbTrafficExtension(); + $lbTrafficExtensionName = 'lbTrafficExtensionName1872015107'; + $lbTrafficExtension->setName($lbTrafficExtensionName); + $lbTrafficExtensionForwardingRules = []; + $lbTrafficExtension->setForwardingRules($lbTrafficExtensionForwardingRules); + $lbTrafficExtensionExtensionChains = []; + $lbTrafficExtension->setExtensionChains($lbTrafficExtensionExtensionChains); + $lbTrafficExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED; + $lbTrafficExtension->setLoadBalancingScheme($lbTrafficExtensionLoadBalancingScheme); + $response = $gapicClient->updateLbTrafficExtension($lbTrafficExtension); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLbTrafficExtensionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/NetworkServices/tests/Unit/V1/NetworkServicesClientTest.php b/NetworkServices/tests/Unit/V1/NetworkServicesClientTest.php new file mode 100644 index 000000000000..bb3e3d923e70 --- /dev/null +++ b/NetworkServices/tests/Unit/V1/NetworkServicesClientTest.php @@ -0,0 +1,4472 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return NetworkServicesClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new NetworkServicesClient($options); + } + + /** @test */ + public function createEndpointPolicyTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $authorizationPolicy = 'authorizationPolicy-1576667208'; + $description = 'description-1724546052'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $clientTlsPolicy = 'clientTlsPolicy-611416598'; + $expectedResponse = new EndpointPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setAuthorizationPolicy($authorizationPolicy); + $expectedResponse->setDescription($description); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $expectedResponse->setClientTlsPolicy($clientTlsPolicy); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createEndpointPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointPolicyId = 'endpointPolicyId-969914082'; + $endpointPolicy = new EndpointPolicy(); + $endpointPolicyName = 'endpointPolicyName36531794'; + $endpointPolicy->setName($endpointPolicyName); + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + $endpointPolicy->setType($endpointPolicyType); + $endpointPolicyEndpointMatcher = new EndpointMatcher(); + $endpointPolicy->setEndpointMatcher($endpointPolicyEndpointMatcher); + $response = $gapicClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateEndpointPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getEndpointPolicyId(); + $this->assertProtobufEquals($endpointPolicyId, $actualValue); + $actualValue = $actualApiRequestObject->getEndpointPolicy(); + $this->assertProtobufEquals($endpointPolicy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointPolicyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createEndpointPolicyExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $endpointPolicyId = 'endpointPolicyId-969914082'; + $endpointPolicy = new EndpointPolicy(); + $endpointPolicyName = 'endpointPolicyName36531794'; + $endpointPolicy->setName($endpointPolicyName); + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + $endpointPolicy->setType($endpointPolicyType); + $endpointPolicyEndpointMatcher = new EndpointMatcher(); + $endpointPolicy->setEndpointMatcher($endpointPolicyEndpointMatcher); + $response = $gapicClient->createEndpointPolicy($formattedParent, $endpointPolicyId, $endpointPolicy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createEndpointPolicyTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createGatewayTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $scope = 'scope109264468'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $expectedResponse = new Gateway(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setScope($scope); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGatewayTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $gatewayId = 'gatewayId955798774'; + $gateway = new Gateway(); + $gatewayName = 'gatewayName-435522833'; + $gateway->setName($gatewayName); + $gatewayPorts = []; + $gateway->setPorts($gatewayPorts); + $gatewayScope = 'gatewayScope-611626384'; + $gateway->setScope($gatewayScope); + $response = $gapicClient->createGateway($formattedParent, $gatewayId, $gateway); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateGateway', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGatewayId(); + $this->assertProtobufEquals($gatewayId, $actualValue); + $actualValue = $actualApiRequestObject->getGateway(); + $this->assertProtobufEquals($gateway, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGatewayTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createGatewayExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $gatewayId = 'gatewayId955798774'; + $gateway = new Gateway(); + $gatewayName = 'gatewayName-435522833'; + $gateway->setName($gatewayName); + $gatewayPorts = []; + $gateway->setPorts($gatewayPorts); + $gatewayScope = 'gatewayScope-611626384'; + $gateway->setScope($gatewayScope); + $response = $gapicClient->createGateway($formattedParent, $gatewayId, $gateway); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGatewayTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createGrpcRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new GrpcRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGrpcRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $grpcRouteId = 'grpcRouteId100668882'; + $grpcRoute = new GrpcRoute(); + $grpcRouteName = 'grpcRouteName-2118800906'; + $grpcRoute->setName($grpcRouteName); + $grpcRouteHostnames = []; + $grpcRoute->setHostnames($grpcRouteHostnames); + $grpcRouteRules = []; + $grpcRoute->setRules($grpcRouteRules); + $response = $gapicClient->createGrpcRoute($formattedParent, $grpcRouteId, $grpcRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateGrpcRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGrpcRouteId(); + $this->assertProtobufEquals($grpcRouteId, $actualValue); + $actualValue = $actualApiRequestObject->getGrpcRoute(); + $this->assertProtobufEquals($grpcRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGrpcRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createGrpcRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $grpcRouteId = 'grpcRouteId100668882'; + $grpcRoute = new GrpcRoute(); + $grpcRouteName = 'grpcRouteName-2118800906'; + $grpcRoute->setName($grpcRouteName); + $grpcRouteHostnames = []; + $grpcRoute->setHostnames($grpcRouteHostnames); + $grpcRouteRules = []; + $grpcRoute->setRules($grpcRouteRules); + $response = $gapicClient->createGrpcRoute($formattedParent, $grpcRouteId, $grpcRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGrpcRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createHttpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new HttpRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createHttpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $httpRouteId = 'httpRouteId-1087115096'; + $httpRoute = new HttpRoute(); + $httpRouteName = 'httpRouteName988382412'; + $httpRoute->setName($httpRouteName); + $httpRouteHostnames = []; + $httpRoute->setHostnames($httpRouteHostnames); + $httpRouteRules = []; + $httpRoute->setRules($httpRouteRules); + $response = $gapicClient->createHttpRoute($formattedParent, $httpRouteId, $httpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateHttpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getHttpRouteId(); + $this->assertProtobufEquals($httpRouteId, $actualValue); + $actualValue = $actualApiRequestObject->getHttpRoute(); + $this->assertProtobufEquals($httpRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHttpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createHttpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $httpRouteId = 'httpRouteId-1087115096'; + $httpRoute = new HttpRoute(); + $httpRouteName = 'httpRouteName988382412'; + $httpRoute->setName($httpRouteName); + $httpRouteHostnames = []; + $httpRoute->setHostnames($httpRouteHostnames); + $httpRouteRules = []; + $httpRoute->setRules($httpRouteRules); + $response = $gapicClient->createHttpRoute($formattedParent, $httpRouteId, $httpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHttpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createMeshTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $interceptionPort = 537115930; + $expectedResponse = new Mesh(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setInterceptionPort($interceptionPort); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMeshTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $meshId = 'meshId954595501'; + $mesh = new Mesh(); + $meshName = 'meshName-472824296'; + $mesh->setName($meshName); + $response = $gapicClient->createMesh($formattedParent, $meshId, $mesh); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateMesh', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMeshId(); + $this->assertProtobufEquals($meshId, $actualValue); + $actualValue = $actualApiRequestObject->getMesh(); + $this->assertProtobufEquals($mesh, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMeshTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createMeshExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $meshId = 'meshId954595501'; + $mesh = new Mesh(); + $meshName = 'meshName-472824296'; + $mesh->setName($meshName); + $response = $gapicClient->createMesh($formattedParent, $meshId, $mesh); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMeshTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createServiceBindingTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createServiceBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $service = 'service1984153269'; + $expectedResponse = new ServiceBinding(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setService($service); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createServiceBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceBindingId = 'serviceBindingId-2088291105'; + $serviceBinding = new ServiceBinding(); + $serviceBindingName = 'serviceBindingName985981115'; + $serviceBinding->setName($serviceBindingName); + $serviceBindingService = 'serviceBindingService344355461'; + $serviceBinding->setService($serviceBindingService); + $response = $gapicClient->createServiceBinding($formattedParent, $serviceBindingId, $serviceBinding); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateServiceBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getServiceBindingId(); + $this->assertProtobufEquals($serviceBindingId, $actualValue); + $actualValue = $actualApiRequestObject->getServiceBinding(); + $this->assertProtobufEquals($serviceBinding, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceBindingTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createServiceBindingExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createServiceBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $serviceBindingId = 'serviceBindingId-2088291105'; + $serviceBinding = new ServiceBinding(); + $serviceBindingName = 'serviceBindingName985981115'; + $serviceBinding->setName($serviceBindingName); + $serviceBindingService = 'serviceBindingService344355461'; + $serviceBinding->setService($serviceBindingService); + $response = $gapicClient->createServiceBinding($formattedParent, $serviceBindingId, $serviceBinding); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createServiceBindingTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createTcpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TcpRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTcpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $tcpRouteId = 'tcpRouteId-154571409'; + $tcpRoute = new TcpRoute(); + $tcpRouteName = 'tcpRouteName1920926099'; + $tcpRoute->setName($tcpRouteName); + $tcpRouteRules = []; + $tcpRoute->setRules($tcpRouteRules); + $response = $gapicClient->createTcpRoute($formattedParent, $tcpRouteId, $tcpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateTcpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTcpRouteId(); + $this->assertProtobufEquals($tcpRouteId, $actualValue); + $actualValue = $actualApiRequestObject->getTcpRoute(); + $this->assertProtobufEquals($tcpRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTcpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createTcpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $tcpRouteId = 'tcpRouteId-154571409'; + $tcpRoute = new TcpRoute(); + $tcpRouteName = 'tcpRouteName1920926099'; + $tcpRoute->setName($tcpRouteName); + $tcpRouteRules = []; + $tcpRoute->setRules($tcpRouteRules); + $response = $gapicClient->createTcpRoute($formattedParent, $tcpRouteId, $tcpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTcpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createTlsRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TlsRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTlsRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $tlsRouteId = 'tlsRouteId263195029'; + $tlsRoute = new TlsRoute(); + $tlsRouteName = 'tlsRouteName-1956274759'; + $tlsRoute->setName($tlsRouteName); + $tlsRouteRules = []; + $tlsRoute->setRules($tlsRouteRules); + $response = $gapicClient->createTlsRoute($formattedParent, $tlsRouteId, $tlsRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/CreateTlsRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTlsRouteId(); + $this->assertProtobufEquals($tlsRouteId, $actualValue); + $actualValue = $actualApiRequestObject->getTlsRoute(); + $this->assertProtobufEquals($tlsRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTlsRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createTlsRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $tlsRouteId = 'tlsRouteId263195029'; + $tlsRoute = new TlsRoute(); + $tlsRouteName = 'tlsRouteName-1956274759'; + $tlsRoute->setName($tlsRouteName); + $tlsRouteRules = []; + $tlsRoute->setRules($tlsRouteRules); + $response = $gapicClient->createTlsRoute($formattedParent, $tlsRouteId, $tlsRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTlsRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteEndpointPolicyTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteEndpointPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + $response = $gapicClient->deleteEndpointPolicy($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteEndpointPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointPolicyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteEndpointPolicyExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + $response = $gapicClient->deleteEndpointPolicy($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteEndpointPolicyTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteGatewayTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGatewayTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + $response = $gapicClient->deleteGateway($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteGateway', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGatewayTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteGatewayExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + $response = $gapicClient->deleteGateway($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGatewayTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteGrpcRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGrpcRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + $response = $gapicClient->deleteGrpcRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteGrpcRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGrpcRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteGrpcRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + $response = $gapicClient->deleteGrpcRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGrpcRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteHttpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteHttpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + $response = $gapicClient->deleteHttpRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteHttpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteHttpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteHttpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + $response = $gapicClient->deleteHttpRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteHttpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteMeshTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMeshTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + $response = $gapicClient->deleteMesh($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteMesh', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMeshTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteMeshExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + $response = $gapicClient->deleteMesh($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMeshTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteServiceBindingTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteServiceBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteServiceBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + $response = $gapicClient->deleteServiceBinding($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteServiceBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceBindingTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteServiceBindingExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteServiceBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + $response = $gapicClient->deleteServiceBinding($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteServiceBindingTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteTcpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTcpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + $response = $gapicClient->deleteTcpRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteTcpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTcpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteTcpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + $response = $gapicClient->deleteTcpRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTcpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteTlsRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTlsRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + $response = $gapicClient->deleteTlsRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/DeleteTlsRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTlsRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteTlsRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + $response = $gapicClient->deleteTlsRoute($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTlsRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getEndpointPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $authorizationPolicy = 'authorizationPolicy-1576667208'; + $description = 'description-1724546052'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $clientTlsPolicy = 'clientTlsPolicy-611416598'; + $expectedResponse = new EndpointPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setAuthorizationPolicy($authorizationPolicy); + $expectedResponse->setDescription($description); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $expectedResponse->setClientTlsPolicy($clientTlsPolicy); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + $response = $gapicClient->getEndpointPolicy($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetEndpointPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEndpointPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->endpointPolicyName('[PROJECT]', '[LOCATION]', '[ENDPOINT_POLICY]'); + try { + $gapicClient->getEndpointPolicy($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGatewayTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $scope = 'scope109264468'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $expectedResponse = new Gateway(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setScope($scope); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + $response = $gapicClient->getGateway($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetGateway', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGatewayExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->gatewayName('[PROJECT]', '[LOCATION]', '[GATEWAY]'); + try { + $gapicClient->getGateway($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGrpcRouteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new GrpcRoute(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + $response = $gapicClient->getGrpcRoute($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetGrpcRoute', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGrpcRouteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->grpcRouteName('[PROJECT]', '[LOCATION]', '[GRPC_ROUTE]'); + try { + $gapicClient->getGrpcRoute($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getHttpRouteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new HttpRoute(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + $response = $gapicClient->getHttpRoute($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetHttpRoute', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getHttpRouteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->httpRouteName('[PROJECT]', '[LOCATION]', '[HTTP_ROUTE]'); + try { + $gapicClient->getHttpRoute($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMeshTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $interceptionPort = 537115930; + $expectedResponse = new Mesh(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setInterceptionPort($interceptionPort); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + $response = $gapicClient->getMesh($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetMesh', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMeshExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->meshName('[PROJECT]', '[LOCATION]', '[MESH]'); + try { + $gapicClient->getMesh($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $service = 'service1984153269'; + $expectedResponse = new ServiceBinding(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setService($service); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + $response = $gapicClient->getServiceBinding($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetServiceBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceBindingExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceBindingName('[PROJECT]', '[LOCATION]', '[SERVICE_BINDING]'); + try { + $gapicClient->getServiceBinding($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTcpRouteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TcpRoute(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + $response = $gapicClient->getTcpRoute($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetTcpRoute', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTcpRouteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->tcpRouteName('[PROJECT]', '[LOCATION]', '[TCP_ROUTE]'); + try { + $gapicClient->getTcpRoute($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTlsRouteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TlsRoute(); + $expectedResponse->setName($name2); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + $response = $gapicClient->getTlsRoute($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/GetTlsRoute', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTlsRouteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->tlsRouteName('[PROJECT]', '[LOCATION]', '[TLS_ROUTE]'); + try { + $gapicClient->getTlsRoute($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEndpointPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $endpointPoliciesElement = new EndpointPolicy(); + $endpointPolicies = [ + $endpointPoliciesElement, + ]; + $expectedResponse = new ListEndpointPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEndpointPolicies($endpointPolicies); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listEndpointPolicies($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEndpointPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListEndpointPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEndpointPoliciesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listEndpointPolicies($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGatewaysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $gatewaysElement = new Gateway(); + $gateways = [ + $gatewaysElement, + ]; + $expectedResponse = new ListGatewaysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGateways($gateways); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listGateways($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGateways()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListGateways', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGatewaysExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listGateways($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGrpcRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $grpcRoutesElement = new GrpcRoute(); + $grpcRoutes = [ + $grpcRoutesElement, + ]; + $expectedResponse = new ListGrpcRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGrpcRoutes($grpcRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listGrpcRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGrpcRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListGrpcRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGrpcRoutesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listGrpcRoutes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listHttpRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $httpRoutesElement = new HttpRoute(); + $httpRoutes = [ + $httpRoutesElement, + ]; + $expectedResponse = new ListHttpRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setHttpRoutes($httpRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listHttpRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getHttpRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListHttpRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listHttpRoutesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listHttpRoutes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMeshesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $meshesElement = new Mesh(); + $meshes = [ + $meshesElement, + ]; + $expectedResponse = new ListMeshesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMeshes($meshes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listMeshes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMeshes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListMeshes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMeshesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listMeshes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $serviceBindingsElement = new ServiceBinding(); + $serviceBindings = [ + $serviceBindingsElement, + ]; + $expectedResponse = new ListServiceBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServiceBindings($serviceBindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listServiceBindings($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServiceBindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListServiceBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceBindingsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listServiceBindings($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTcpRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $tcpRoutesElement = new TcpRoute(); + $tcpRoutes = [ + $tcpRoutesElement, + ]; + $expectedResponse = new ListTcpRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTcpRoutes($tcpRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listTcpRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTcpRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListTcpRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTcpRoutesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listTcpRoutes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTlsRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $tlsRoutesElement = new TlsRoute(); + $tlsRoutes = [ + $tlsRoutesElement, + ]; + $expectedResponse = new ListTlsRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTlsRoutes($tlsRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listTlsRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTlsRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/ListTlsRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTlsRoutesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listTlsRoutes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateEndpointPolicyTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $authorizationPolicy = 'authorizationPolicy-1576667208'; + $description = 'description-1724546052'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $clientTlsPolicy = 'clientTlsPolicy-611416598'; + $expectedResponse = new EndpointPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setAuthorizationPolicy($authorizationPolicy); + $expectedResponse->setDescription($description); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $expectedResponse->setClientTlsPolicy($clientTlsPolicy); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateEndpointPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $endpointPolicy = new EndpointPolicy(); + $endpointPolicyName = 'endpointPolicyName36531794'; + $endpointPolicy->setName($endpointPolicyName); + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + $endpointPolicy->setType($endpointPolicyType); + $endpointPolicyEndpointMatcher = new EndpointMatcher(); + $endpointPolicy->setEndpointMatcher($endpointPolicyEndpointMatcher); + $response = $gapicClient->updateEndpointPolicy($endpointPolicy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateEndpointPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getEndpointPolicy(); + $this->assertProtobufEquals($endpointPolicy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateEndpointPolicyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateEndpointPolicyExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateEndpointPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $endpointPolicy = new EndpointPolicy(); + $endpointPolicyName = 'endpointPolicyName36531794'; + $endpointPolicy->setName($endpointPolicyName); + $endpointPolicyType = EndpointPolicyType::ENDPOINT_POLICY_TYPE_UNSPECIFIED; + $endpointPolicy->setType($endpointPolicyType); + $endpointPolicyEndpointMatcher = new EndpointMatcher(); + $endpointPolicy->setEndpointMatcher($endpointPolicyEndpointMatcher); + $response = $gapicClient->updateEndpointPolicy($endpointPolicy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateEndpointPolicyTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateGatewayTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $scope = 'scope109264468'; + $serverTlsPolicy = 'serverTlsPolicy1906438002'; + $expectedResponse = new Gateway(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setScope($scope); + $expectedResponse->setServerTlsPolicy($serverTlsPolicy); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateGatewayTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $gateway = new Gateway(); + $gatewayName = 'gatewayName-435522833'; + $gateway->setName($gatewayName); + $gatewayPorts = []; + $gateway->setPorts($gatewayPorts); + $gatewayScope = 'gatewayScope-611626384'; + $gateway->setScope($gatewayScope); + $response = $gapicClient->updateGateway($gateway); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateGateway', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGateway(); + $this->assertProtobufEquals($gateway, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGatewayTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateGatewayExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateGatewayTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $gateway = new Gateway(); + $gatewayName = 'gatewayName-435522833'; + $gateway->setName($gatewayName); + $gatewayPorts = []; + $gateway->setPorts($gatewayPorts); + $gatewayScope = 'gatewayScope-611626384'; + $gateway->setScope($gatewayScope); + $response = $gapicClient->updateGateway($gateway); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGatewayTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateGrpcRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new GrpcRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateGrpcRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $grpcRoute = new GrpcRoute(); + $grpcRouteName = 'grpcRouteName-2118800906'; + $grpcRoute->setName($grpcRouteName); + $grpcRouteHostnames = []; + $grpcRoute->setHostnames($grpcRouteHostnames); + $grpcRouteRules = []; + $grpcRoute->setRules($grpcRouteRules); + $response = $gapicClient->updateGrpcRoute($grpcRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateGrpcRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGrpcRoute(); + $this->assertProtobufEquals($grpcRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGrpcRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateGrpcRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateGrpcRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $grpcRoute = new GrpcRoute(); + $grpcRouteName = 'grpcRouteName-2118800906'; + $grpcRoute->setName($grpcRouteName); + $grpcRouteHostnames = []; + $grpcRoute->setHostnames($grpcRouteHostnames); + $grpcRouteRules = []; + $grpcRoute->setRules($grpcRouteRules); + $response = $gapicClient->updateGrpcRoute($grpcRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGrpcRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateHttpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new HttpRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateHttpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $httpRoute = new HttpRoute(); + $httpRouteName = 'httpRouteName988382412'; + $httpRoute->setName($httpRouteName); + $httpRouteHostnames = []; + $httpRoute->setHostnames($httpRouteHostnames); + $httpRouteRules = []; + $httpRoute->setRules($httpRouteRules); + $response = $gapicClient->updateHttpRoute($httpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateHttpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getHttpRoute(); + $this->assertProtobufEquals($httpRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateHttpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateHttpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateHttpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $httpRoute = new HttpRoute(); + $httpRouteName = 'httpRouteName988382412'; + $httpRoute->setName($httpRouteName); + $httpRouteHostnames = []; + $httpRoute->setHostnames($httpRouteHostnames); + $httpRouteRules = []; + $httpRoute->setRules($httpRouteRules); + $response = $gapicClient->updateHttpRoute($httpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateHttpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateMeshTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $interceptionPort = 537115930; + $expectedResponse = new Mesh(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $expectedResponse->setInterceptionPort($interceptionPort); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMeshTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $mesh = new Mesh(); + $meshName = 'meshName-472824296'; + $mesh->setName($meshName); + $response = $gapicClient->updateMesh($mesh); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateMesh', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMesh(); + $this->assertProtobufEquals($mesh, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMeshTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateMeshExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateMeshTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $mesh = new Mesh(); + $meshName = 'meshName-472824296'; + $mesh->setName($meshName); + $response = $gapicClient->updateMesh($mesh); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMeshTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateTcpRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TcpRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTcpRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $tcpRoute = new TcpRoute(); + $tcpRouteName = 'tcpRouteName1920926099'; + $tcpRoute->setName($tcpRouteName); + $tcpRouteRules = []; + $tcpRoute->setRules($tcpRouteRules); + $response = $gapicClient->updateTcpRoute($tcpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateTcpRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getTcpRoute(); + $this->assertProtobufEquals($tcpRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTcpRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateTcpRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateTcpRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $tcpRoute = new TcpRoute(); + $tcpRouteName = 'tcpRouteName1920926099'; + $tcpRoute->setName($tcpRouteName); + $tcpRouteRules = []; + $tcpRoute->setRules($tcpRouteRules); + $response = $gapicClient->updateTcpRoute($tcpRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTcpRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateTlsRouteTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $selfLink = 'selfLink-1691268851'; + $description = 'description-1724546052'; + $expectedResponse = new TlsRoute(); + $expectedResponse->setName($name); + $expectedResponse->setSelfLink($selfLink); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTlsRouteTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $tlsRoute = new TlsRoute(); + $tlsRouteName = 'tlsRouteName-1956274759'; + $tlsRoute->setName($tlsRouteName); + $tlsRouteRules = []; + $tlsRoute->setRules($tlsRouteRules); + $response = $gapicClient->updateTlsRoute($tlsRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.networkservices.v1.NetworkServices/UpdateTlsRoute', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getTlsRoute(); + $this->assertProtobufEquals($tlsRoute, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTlsRouteTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateTlsRouteExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateTlsRouteTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $tlsRoute = new TlsRoute(); + $tlsRouteName = 'tlsRouteName-1956274759'; + $tlsRoute->setName($tlsRouteName); + $tlsRouteRules = []; + $tlsRoute->setRules($tlsRouteRules); + $response = $gapicClient->updateTlsRoute($tlsRoute); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTlsRouteTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 352f405e1166..44ef6a7bdc94 100644 --- a/composer.json +++ b/composer.json @@ -179,6 +179,7 @@ "google/cloud-network-connectivity": "1.5.5", "google/cloud-network-management": "1.7.3", "google/cloud-network-security": "0.6.5", + "google/cloud-networkservices": "0.0.0", "google/cloud-notebooks": "0.7.5", "google/cloud-optimization": "0.6.5", "google/cloud-orchestration-airflow": "1.6.4", @@ -357,6 +358,7 @@ "GPBMetadata\\Google\\Cloud\\Networkconnectivity\\": "NetworkConnectivity/metadata", "GPBMetadata\\Google\\Cloud\\Networkmanagement\\": "NetworkManagement/metadata", "GPBMetadata\\Google\\Cloud\\Networksecurity\\": "NetworkSecurity/metadata", + "GPBMetadata\\Google\\Cloud\\Networkservices\\": "NetworkServices/metadata", "GPBMetadata\\Google\\Cloud\\Notebooks\\": "Notebooks/metadata", "GPBMetadata\\Google\\Cloud\\Optimization\\": "Optimization/metadata", "GPBMetadata\\Google\\Cloud\\Orchestration\\Airflow\\Service\\": "OrchestrationAirflow/metadata", @@ -562,6 +564,7 @@ "Google\\Cloud\\NetworkConnectivity\\": "NetworkConnectivity/src", "Google\\Cloud\\NetworkManagement\\": "NetworkManagement/src", "Google\\Cloud\\NetworkSecurity\\": "NetworkSecurity/src", + "Google\\Cloud\\NetworkServices\\": "NetworkServices/src", "Google\\Cloud\\Notebooks\\": "Notebooks/src", "Google\\Cloud\\Optimization\\": "Optimization/src", "Google\\Cloud\\Orchestration\\Airflow\\Service\\": "OrchestrationAirflow/src",