From 2321727f788c24262b4da8c90c13d79b3de85c30 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 8 Aug 2024 01:15:10 +0000 Subject: [PATCH 1/4] feat: Added `build_service_account` field to CloudFunction docs: A comment for field `runtime_version` in message `.google.cloud.functions.v1.CloudFunction` is changed docs: A comment for field `docker_repository` in message `.google.cloud.functions.v1.CloudFunction` is changed docs: A comment for field `automatic_update_policy` in message `.google.cloud.functions.v1.CloudFunction` is changed docs: A comment for field `on_deploy_update_policy` in message `.google.cloud.functions.v1.CloudFunction` is changed docs: A comment for field `url` in message `.google.cloud.functions.v1.SourceRepository` is changed docs: A comment for field `url` in message `.google.cloud.functions.v1.HttpsTrigger` is changed PiperOrigin-RevId: 660564990 Source-Link: https://github.com/googleapis/googleapis/commit/7767c573e4fffa76310a876cc9d7995a74c37481 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3ceb79737d8622e2e1ca231e2e85e89483dab0a2 Copy-Tag: eyJwIjoiRnVuY3Rpb25zLy5Pd2xCb3QueWFtbCIsImgiOiIzY2ViNzk3MzdkODYyMmUyZTFjYTIzMWUyZTg1ZTg5NDgzZGFiMGEyIn0= --- .../Google/Cloud/Functions/V1/Functions.php | Bin 0 -> 9005 bytes .../Google/Cloud/Functions/V1/Operations.php | Bin 0 -> 1271 bytes .../Functions/V1/CallFunctionRequest.php | 101 + .../Functions/V1/CallFunctionResponse.php | 143 ++ .../Cloud/Functions/V1/CloudFunction.php | 1639 +++++++++++++++++ .../CloudFunction/AutomaticUpdatePolicy.php | 37 + .../V1/CloudFunction/DockerRegistry.php | 69 + .../V1/CloudFunction/IngressSettings.php | 73 + .../V1/CloudFunction/OnDeployUpdatePolicy.php | 74 + .../VpcConnectorEgressSettings.php | 67 + .../Functions/V1/CloudFunctionStatus.php | 83 + .../Functions/V1/CreateFunctionRequest.php | 115 ++ .../Functions/V1/DeleteFunctionRequest.php | 67 + .../Cloud/Functions/V1/EventTrigger.php | 292 +++ .../Cloud/Functions/V1/FailurePolicy.php | 76 + .../Functions/V1/FailurePolicy/Retry.php | 40 + .../V1/GenerateDownloadUrlRequest.php | 109 ++ .../V1/GenerateDownloadUrlResponse.php | 71 + .../Functions/V1/GenerateUploadUrlRequest.php | 161 ++ .../V1/GenerateUploadUrlResponse.php | 75 + .../Cloud/Functions/V1/GetFunctionRequest.php | 121 ++ .../Cloud/Functions/V1/HttpsTrigger.php | 101 + .../V1/HttpsTrigger/SecurityLevel.php | 70 + .../Functions/V1/ListFunctionsRequest.php | 167 ++ .../Functions/V1/ListFunctionsResponse.php | 151 ++ .../Functions/V1/OperationMetadataV1.php | 349 ++++ .../Cloud/Functions/V1/OperationType.php | 68 + .../Cloud/Functions/V1/SecretEnvVar.php | 191 ++ .../Cloud/Functions/V1/SecretVolume.php | 213 +++ .../V1/SecretVolume/SecretVersion.php | 124 ++ .../Cloud/Functions/V1/SourceRepository.php | 154 ++ .../Functions/V1/UpdateFunctionRequest.php | 121 ++ .../call_function.php | 75 + .../create_function.php | 84 + .../delete_function.php | 81 + .../generate_download_url.php | 57 + .../generate_upload_url.php | 77 + .../get_function.php | 70 + .../get_iam_policy.php | 68 + .../list_functions.php | 58 + .../list_locations.php | 58 + .../set_iam_policy.php | 70 + .../test_iam_permissions.php | 77 + .../update_function.php | 68 + .../v1/src/V1/CloudFunctionsServiceClient.php | 34 + .../CloudFunctionsServiceGapicClient.php | 1154 ++++++++++++ .../Functions/v1/src/V1/gapic_metadata.json | 78 + ...cloud_functions_service_client_config.json | 105 ++ ...ud_functions_service_descriptor_config.php | 79 + ...d_functions_service_rest_client_config.php | 188 ++ .../V1/CloudFunctionsServiceClientTest.php | 1091 +++++++++++ .../Google/Cloud/Functions/V2/Functions.php | Bin 0 -> 11429 bytes .../Google/Cloud/Functions/V2/BuildConfig.php | 500 +++++ .../V2/BuildConfig/DockerRegistry.php | 69 + .../Functions/V2/CreateFunctionRequest.php | 184 ++ .../Functions/V2/DeleteFunctionRequest.php | 81 + .../Google/Cloud/Functions/V2/Environment.php | 61 + .../Google/Cloud/Functions/V2/EventFilter.php | 147 ++ .../Cloud/Functions/V2/EventTrigger.php | 378 ++++ .../Functions/V2/EventTrigger/RetryPolicy.php | 66 + .../V2/GenerateDownloadUrlRequest.php | 71 + .../V2/GenerateDownloadUrlResponse.php | 71 + .../Functions/V2/GenerateUploadUrlRequest.php | 153 ++ .../V2/GenerateUploadUrlResponse.php | 139 ++ .../Cloud/Functions/V2/GetFunctionRequest.php | 81 + .../Functions/V2/ListFunctionsRequest.php | 278 +++ .../Functions/V2/ListFunctionsResponse.php | 143 ++ .../Functions/V2/ListRuntimesRequest.php | 124 ++ .../Functions/V2/ListRuntimesResponse.php | 67 + .../V2/ListRuntimesResponse/Runtime.php | 207 +++ .../V2/ListRuntimesResponse/RuntimeStage.php | 92 + .../Cloud/Functions/V2/LocationMetadata.php | 67 + .../Cloud/Functions/V2/OperationMetadata.php | 385 ++++ .../Google/Cloud/Functions/V2/PBFunction.php | 510 +++++ .../Cloud/Functions/V2/PBFunction/State.php | 86 + .../Google/Cloud/Functions/V2/RepoSource.php | 309 ++++ .../Cloud/Functions/V2/SecretEnvVar.php | 191 ++ .../Cloud/Functions/V2/SecretVolume.php | 203 ++ .../V2/SecretVolume/SecretVersion.php | 124 ++ .../Cloud/Functions/V2/ServiceConfig.php | 810 ++++++++ .../V2/ServiceConfig/IngressSettings.php | 73 + .../V2/ServiceConfig/SecurityLevel.php | 71 + .../VpcConnectorEgressSettings.php | 67 + .../src/Google/Cloud/Functions/V2/Source.php | 111 ++ .../Cloud/Functions/V2/SourceProvenance.php | 130 ++ .../src/Google/Cloud/Functions/V2/Stage.php | 237 +++ .../Google/Cloud/Functions/V2/Stage/Name.php | 92 + .../Google/Cloud/Functions/V2/Stage/State.php | 71 + .../Cloud/Functions/V2/StateMessage.php | 135 ++ .../Functions/V2/StateMessage/Severity.php | 71 + .../Cloud/Functions/V2/StorageSource.php | 155 ++ .../Functions/V2/UpdateFunctionRequest.php | 146 ++ .../FunctionServiceClient/create_function.php | 88 + .../FunctionServiceClient/delete_function.php | 82 + .../generate_download_url.php | 76 + .../generate_upload_url.php | 94 + .../V2/FunctionServiceClient/get_function.php | 71 + .../FunctionServiceClient/get_iam_policy.php | 72 + .../FunctionServiceClient/list_functions.php | 81 + .../FunctionServiceClient/list_locations.php | 62 + .../FunctionServiceClient/list_runtimes.php | 72 + .../FunctionServiceClient/set_iam_policy.php | 77 + .../test_iam_permissions.php | 84 + .../FunctionServiceClient/update_function.php | 71 + .../src/V2/Client/FunctionServiceClient.php | 832 +++++++++ .../v2/src/V2/FunctionServiceClient.php | 34 + .../V2/Gapic/FunctionServiceGapicClient.php | 1410 ++++++++++++++ .../Functions/v2/src/V2/gapic_metadata.json | 78 + .../function_service_client_config.json | 82 + .../function_service_descriptor_config.php | 227 +++ .../function_service_rest_client_config.php | 196 ++ .../V2/Client/FunctionServiceClientTest.php | 1149 ++++++++++++ .../Unit/V2/FunctionServiceClientTest.php | 1009 ++++++++++ 113 files changed, 21597 insertions(+) create mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Operations.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/Gapic/CloudFunctionsServiceGapicClient.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php create mode 100644 owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/Gapic/FunctionServiceGapicClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php create mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php create mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php diff --git a/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php b/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php new file mode 100644 index 0000000000000000000000000000000000000000..8933e0a4c3f52d8552d2fc8b7f0ecec2ccddff9c GIT binary patch literal 9005 zcmbtaOLN=S6%Hj!mag8A718t~G@Le)Vv)6+*HE?-@Fg>*NtUGKaYi!;1YSvqKmY|m z*@~-8H=Qo~n(jN@^cQrdn`}E?bdl~d(`h=>RenNNJ@*9yq(oDR7Z!SS;&`~ zw}8~MJFbp1$phOyFmYNp?M^Gb-?4Pxuq`ire7E~0MY$qmX>IH|nvRoOwd@n@Yc0*! zcDE>l-5g=CTNDg-ckXT?q??-OC4-0PB}&3Sr?Y1odeZYXAO5^;c&cF;zM+}Mmte_* z<2C+PgYjBSi;WOPp&W>GnqamA0&OZgTvC3Nf-Ma*V?3d69%Wjr`Dts~aUNmLG_d7gjHYN{vz5h%+Oc7~7bC4>9xg*G*&hzORfojt#cVBU zZHS~@_*1hXW=@7zn^RtttZZ8cZpX3=>);0|9K>9{!;BqXB<344Y|iMK)v`y{s2Js#YA1815hlrE28zO;6}YIYE&eD6)Z*U;Jo z7U7TT&|u{2iRgM{?KWRCyJ3|+SAfIuD&69-!v$R9OoDYxqJu9A01pioL792K3GGS$v3;>$0w z4^4F(DDPOM!l$XMM4zmth$LpiGD64L^&m)8qZOY8qEWVxN8_LdHof>yTyfHwh!@3v?s$Sj7i`fS&4M--puX#g}2*>_%>AOLiPRCu9^TuLfr& z)zLh#jIxhY_8$$+zQh;=Jny6Fqqe6W;S-et(N$tq_NU(~x6v&cGqB2;1G;-D=yTIK z_XIk-$M{6LiWb-@64zoEQpz^t3F??7G{Kf2K(A4zH2WZO*<&j0R(IhEy6#~eI=gcs z;s%X~fq>JX^biFQYtqMPmh(Hd%?=dY_|0KC>`($QZkj`@Zy#YR{+3YolJqHBXxTck zIE1<~T~B|n+(B!a>l^!;?z{NF@F1mnUD!olsfOkPUTkyxHgKBV_;Bb$%~M_KTo$D7 zvexnKHtG6RjxMZN##eyz)W*Z1IV*zCHU%lx_N3p~vx_Um?ypH%2bTc~`u3p1I?x4f~m{>=vJGGpet5zz7T(eqN z3tROJ_ETq>VrkUG7;> zDtUD)SI*9l%Acdzo)~`%UCUQT@OANr9|5pfMq<{y(f*Of zxBQP7nhy74(tL=JwGK}xV0K)?KT%ES)Jz)hvm5UZ$mB4~6u>W~E)!z;DVm8qkZz(x zqmbLKmzvMia$%=X?m4gpARy}nh?J+wvj&{iBAVlmsIaesp#p`mm0R`7ML@v?~MbEiwWIgR+ihA`hVEj6nf| z2ArJ7)WG&MLYS%(sz+}mE~7E}F*||Ap?W}nC)dz)q^?D<0ZiwyNBTf^Uzmj^nHEBB zCm1dOkK79;<*&ejj3qC0z@<$aQ%Ca;c`OaXc?(T&&K_JjNV_>GR>C4ltbnI>SPz>> z(OBs|Anmx&nT0molc;jkMEQ>~w3Kr(bj>0g>-ZNPxKm4;XhI|&GbFqEtujKp8S%WY zohkFAh2xtL2}*rAwJ|6bBJDFtp%M8vpcgA+y?TXNv*5TGYbhPv6Uc>=tJi-|2*wh! zgQP9&_v)d9@0;0s)HmxF!@cO;gB%FGd&HnBT`5DeBSd=QOg=#4j^;vw@)Kdr#o9WEcC#hhlE!mq-uKc2I+fG&~AG6N14 z!jI9Fs4(u!D`*|rk=avEJdLlV~=q9!!bpqk4MQ9=;p?dKL5c!ZRTj%9$Jqme+_OY%K* z?M(WvyIPzroug2pYrl)ZQHGlcHkXiof^Ox?)$P1m+^*zEp;H@8rMcbPsUb8DT}x@F z0HtvXU9J|3W$13^MUCH*Carb2iptq%|!+9&iJ8W-gI-zaos7g3X3X3tSF)c&oVO8<$W*=XgG z2DvD@RVaHy*cKXgrh=ir{L5F$+r4wf#b8;yPTINqjj|v>_>RCyYSpHkrp_0u=U5hU zel5h*sC5ul0Wwi)!YzgG!D!4o&?0m2!ion*i6|d)C)VioQb1q|?uzKj)eTvlSRv z9m{uRyp-2FE;U8Q$ zdz*o}&fcF#Mz?as?-ct&^IIioPF^zy3P!~ShM7_D?d0@3<;5_=_QtS+V02k0?;g@G z$yncokEdx}%{{=f~yiVN^c}lL%JwEsN+q zCjlo+Q0_^nq7a(r=;iMPu%#nW#OR`8Y=C8fxV#aw1WV;L<2_gsR}7mA z@@wO$Y~6dLrP;a?Z@dO89Dh%xIp(5lT|e3`S_?^*blflim|&jBfcHsgE=lB~VT1LQ z$yDRM5^X-r+IQ#Lwe`j(SRJG!3Khk&M6Vg!;8DI?eL=tB*j&k~@~|AIcF0^+wL=0P z-xj_Do_0L$?4BuU%Jw&5|niyvD8Kf+{xL z&+aU8@#F`1CVvIR9P^iUV(P`!l9DW+Ug>K!#~1d~u|1+QzY4^N{9EVgoogle.cloud.functions.v1.CallFunctionRequest + */ +class CallFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function to be called. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function to be called. + * @type string $data + * Required. Input to be passed to the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function to be called. + * + * 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 function to be called. + * + * 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; + } + + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, True); + $this->data = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php new file mode 100644 index 000000000000..bb7004f8e9d2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php @@ -0,0 +1,143 @@ +google.cloud.functions.v1.CallFunctionResponse + */ +class CallFunctionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + */ + protected $execution_id = ''; + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + */ + protected $result = ''; + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + */ + protected $error = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $execution_id + * Execution id of function invocation. + * @type string $result + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * @type string $error + * Either system or user-function generated error. Set if execution + * was not successful. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + * @return string + */ + public function getExecutionId() + { + return $this->execution_id; + } + + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + * @param string $var + * @return $this + */ + public function setExecutionId($var) + { + GPBUtil::checkString($var, True); + $this->execution_id = $var; + + return $this; + } + + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + * @param string $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkString($var, True); + $this->result = $var; + + return $this; + } + + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + * @return string + */ + public function getError() + { + return $this->error; + } + + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + * @param string $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkString($var, True); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php new file mode 100644 index 000000000000..dcb6a3476b51 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php @@ -0,0 +1,1639 @@ +google.cloud.functions.v1.CloudFunction + */ +class CloudFunction extends \Google\Protobuf\Internal\Message +{ + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status = 0; + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + */ + protected $entry_point = ''; + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + */ + protected $runtime = ''; + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + */ + protected $timeout = null; + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + */ + protected $available_memory_mb = 0; + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + */ + protected $service_account_email = ''; + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $version_id = 0; + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + */ + private $labels; + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + */ + private $environment_variables; + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + */ + private $build_environment_variables; + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @deprecated + */ + protected $network = ''; + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + */ + protected $max_instances = 0; + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + */ + protected $min_instances = 0; + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + */ + protected $vpc_connector = ''; + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + */ + protected $vpc_connector_egress_settings = 0; + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + */ + protected $ingress_settings = 0; + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + */ + protected $build_worker_pool = ''; + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $build_id = ''; + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $build_name = ''; + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + */ + private $secret_environment_variables; + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + */ + private $secret_volumes; + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $source_token = ''; + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + */ + protected $docker_repository = ''; + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + */ + protected $docker_registry = 0; + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + */ + protected $build_service_account = ''; + protected $source_code; + protected $trigger; + protected $runtime_update_policy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * @type string $description + * User-provided description of a function. + * @type string $source_archive_url + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * @type \Google\Cloud\Functions\V1\SourceRepository $source_repository + * **Beta Feature** + * The source repository where a function is hosted. + * @type string $source_upload_url + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * @type \Google\Cloud\Functions\V1\HttpsTrigger $https_trigger + * An HTTPS endpoint type of source that can be triggered via URL. + * @type \Google\Cloud\Functions\V1\EventTrigger $event_trigger + * A source that fires events in response to a condition in another service. + * @type int $status + * Output only. Status of the function deployment. + * @type string $entry_point + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * @type string $runtime + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * @type \Google\Protobuf\Duration $timeout + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * @type int $available_memory_mb + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * @type string $service_account_email + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last update timestamp of a Cloud Function. + * @type int|string $version_id + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this Cloud Function. + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * Environment variables that shall be available during function execution. + * @type array|\Google\Protobuf\Internal\MapField $build_environment_variables + * Build environment variables that shall be available during build time. + * @type string $network + * Deprecated: use vpc_connector + * @type int $max_instances + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * @type int $min_instances + * A lower bound for the number function instances that may coexist at a + * given time. + * @type string $vpc_connector + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * @type int $vpc_connector_egress_settings + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * @type int $ingress_settings + * The ingress settings for the function, controlling what traffic can reach + * it. + * @type string $kms_key_name + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * @type string $build_worker_pool + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * @type string $build_id + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * @type string $build_name + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * @type array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables + * Secret environment variables configuration. + * @type array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes + * Secret volumes configuration. + * @type string $source_token + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * @type string $docker_repository + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * @type int $docker_registry + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * @type \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $automatic_update_policy + * @type \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $on_deploy_update_policy + * @type string $build_service_account + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * + * Generated from protobuf field string source_archive_url = 3; + * @return string + */ + public function getSourceArchiveUrl() + { + return $this->readOneof(3); + } + + public function hasSourceArchiveUrl() + { + return $this->hasOneof(3); + } + + /** + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * + * Generated from protobuf field string source_archive_url = 3; + * @param string $var + * @return $this + */ + public function setSourceArchiveUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * **Beta Feature** + * The source repository where a function is hosted. + * + * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; + * @return \Google\Cloud\Functions\V1\SourceRepository|null + */ + public function getSourceRepository() + { + return $this->readOneof(4); + } + + public function hasSourceRepository() + { + return $this->hasOneof(4); + } + + /** + * **Beta Feature** + * The source repository where a function is hosted. + * + * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; + * @param \Google\Cloud\Functions\V1\SourceRepository $var + * @return $this + */ + public function setSourceRepository($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\SourceRepository::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * + * Generated from protobuf field string source_upload_url = 16; + * @return string + */ + public function getSourceUploadUrl() + { + return $this->readOneof(16); + } + + public function hasSourceUploadUrl() + { + return $this->hasOneof(16); + } + + /** + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * + * Generated from protobuf field string source_upload_url = 16; + * @param string $var + * @return $this + */ + public function setSourceUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * An HTTPS endpoint type of source that can be triggered via URL. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; + * @return \Google\Cloud\Functions\V1\HttpsTrigger|null + */ + public function getHttpsTrigger() + { + return $this->readOneof(5); + } + + public function hasHttpsTrigger() + { + return $this->hasOneof(5); + } + + /** + * An HTTPS endpoint type of source that can be triggered via URL. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; + * @param \Google\Cloud\Functions\V1\HttpsTrigger $var + * @return $this + */ + public function setHttpsTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\HttpsTrigger::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A source that fires events in response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; + * @return \Google\Cloud\Functions\V1\EventTrigger|null + */ + public function getEventTrigger() + { + return $this->readOneof(6); + } + + public function hasEventTrigger() + { + return $this->hasOneof(6); + } + + /** + * A source that fires events in response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; + * @param \Google\Cloud\Functions\V1\EventTrigger $var + * @return $this + */ + public function setEventTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\EventTrigger::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunctionStatus::class); + $this->status = $var; + + return $this; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + * @return string + */ + public function getRuntime() + { + return $this->runtime; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + * @param string $var + * @return $this + */ + public function setRuntime($var) + { + GPBUtil::checkString($var, True); + $this->runtime = $var; + + return $this; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + * @return int + */ + public function getAvailableMemoryMb() + { + return $this->available_memory_mb; + } + + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + * @param int $var + * @return $this + */ + public function setAvailableMemoryMb($var) + { + GPBUtil::checkInt32($var); + $this->available_memory_mb = $var; + + return $this; + } + + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; + } + + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + * @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; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBuildEnvironmentVariables() + { + return $this->build_environment_variables; + } + + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBuildEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->build_environment_variables = $arr; + + return $this; + } + + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @return string + * @deprecated + */ + public function getNetwork() + { + @trigger_error('network is deprecated.', E_USER_DEPRECATED); + return $this->network; + } + + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setNetwork($var) + { + @trigger_error('network is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + * @return int + */ + public function getMaxInstances() + { + return $this->max_instances; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + * @param int $var + * @return $this + */ + public function setMaxInstances($var) + { + GPBUtil::checkInt32($var); + $this->max_instances = $var; + + return $this; + } + + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + * @return int + */ + public function getMinInstances() + { + return $this->min_instances; + } + + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + * @param int $var + * @return $this + */ + public function setMinInstances($var) + { + GPBUtil::checkInt32($var); + $this->min_instances = $var; + + return $this; + } + + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + * @return string + */ + public function getVpcConnector() + { + return $this->vpc_connector; + } + + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + * @param string $var + * @return $this + */ + public function setVpcConnector($var) + { + GPBUtil::checkString($var, True); + $this->vpc_connector = $var; + + return $this; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + * @return int + */ + public function getVpcConnectorEgressSettings() + { + return $this->vpc_connector_egress_settings; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + * @param int $var + * @return $this + */ + public function setVpcConnectorEgressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\VpcConnectorEgressSettings::class); + $this->vpc_connector_egress_settings = $var; + + return $this; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + * @return int + */ + public function getIngressSettings() + { + return $this->ingress_settings; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + * @param int $var + * @return $this + */ + public function setIngressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\IngressSettings::class); + $this->ingress_settings = $var; + + return $this; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + * @return string + */ + public function getBuildWorkerPool() + { + return $this->build_worker_pool; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + * @param string $var + * @return $this + */ + public function setBuildWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->build_worker_pool = $var; + + return $this; + } + + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBuildId() + { + return $this->build_id; + } + + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBuildId($var) + { + GPBUtil::checkString($var, True); + $this->build_id = $var; + + return $this; + } + + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretEnvironmentVariables() + { + return $this->secret_environment_variables; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + * @param array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretEnvironmentVariables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretEnvVar::class); + $this->secret_environment_variables = $arr; + + return $this; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretVolumes() + { + return $this->secret_volumes; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + * @param array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretVolumes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume::class); + $this->secret_volumes = $arr; + + return $this; + } + + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + * @return string + */ + public function getDockerRepository() + { + return $this->docker_repository; + } + + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDockerRepository($var) + { + GPBUtil::checkString($var, True); + $this->docker_repository = $var; + + return $this; + } + + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + * @return int + */ + public function getDockerRegistry() + { + return $this->docker_registry; + } + + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + * @param int $var + * @return $this + */ + public function setDockerRegistry($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\DockerRegistry::class); + $this->docker_registry = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; + * @return \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy|null + */ + public function getAutomaticUpdatePolicy() + { + return $this->readOneof(40); + } + + public function hasAutomaticUpdatePolicy() + { + return $this->hasOneof(40); + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; + * @param \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $var + * @return $this + */ + public function setAutomaticUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy::class); + $this->writeOneof(40, $var); + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @return \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy|null + */ + public function getOnDeployUpdatePolicy() + { + return $this->readOneof(41); + } + + public function hasOnDeployUpdatePolicy() + { + return $this->hasOneof(41); + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @param \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $var + * @return $this + */ + public function setOnDeployUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy::class); + $this->writeOneof(41, $var); + + return $this; + } + + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @return string + */ + public function getBuildServiceAccount() + { + return $this->build_service_account; + } + + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @param string $var + * @return $this + */ + public function setBuildServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->build_service_account = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceCode() + { + return $this->whichOneof("source_code"); + } + + /** + * @return string + */ + public function getTrigger() + { + return $this->whichOneof("trigger"); + } + + /** + * @return string + */ + public function getRuntimeUpdatePolicy() + { + return $this->whichOneof("runtime_update_policy"); + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php new file mode 100644 index 000000000000..02f5ae78823a --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php @@ -0,0 +1,37 @@ +google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy + */ +class AutomaticUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutomaticUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_AutomaticUpdatePolicy::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php new file mode 100644 index 000000000000..0dc3a8279ff9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php @@ -0,0 +1,69 @@ +google.cloud.functions.v1.CloudFunction.DockerRegistry + */ +class DockerRegistry +{ + /** + * Unspecified. + * + * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; + */ + const DOCKER_REGISTRY_UNSPECIFIED = 0; + /** + * Docker images will be stored in multi-regional Container Registry + * repositories named `gcf`. + * + * Generated from protobuf enum CONTAINER_REGISTRY = 1; + */ + const CONTAINER_REGISTRY = 1; + /** + * Docker images will be stored in regional Artifact Registry repositories. + * By default, GCF will create and use repositories named `gcf-artifacts` + * in every region in which a function is deployed. But the repository to + * use can also be specified by the user using the `docker_repository` + * field. + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 2; + */ + const ARTIFACT_REGISTRY = 2; + + private static $valueToName = [ + self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', + self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DockerRegistry::class, \Google\Cloud\Functions\V1\CloudFunction_DockerRegistry::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php new file mode 100644 index 000000000000..f01e9ad97124 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php @@ -0,0 +1,73 @@ +google.cloud.functions.v1.CloudFunction.IngressSettings + */ +class IngressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const INGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Allow HTTP traffic from public and private sources. + * + * Generated from protobuf enum ALLOW_ALL = 1; + */ + const ALLOW_ALL = 1; + /** + * Allow HTTP traffic from only private VPC sources. + * + * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; + */ + const ALLOW_INTERNAL_ONLY = 2; + /** + * Allow HTTP traffic from private VPC sources and through GCLB. + * + * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; + */ + const ALLOW_INTERNAL_AND_GCLB = 3; + + private static $valueToName = [ + self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', + self::ALLOW_ALL => 'ALLOW_ALL', + self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', + self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IngressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_IngressSettings::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php new file mode 100644 index 000000000000..1183812ad6bb --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php @@ -0,0 +1,74 @@ +google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy + */ +class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $runtime_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $runtime_version + * Output only. Contains the runtime version which was used during latest + * function deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRuntimeVersion() + { + return $this->runtime_version; + } + + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRuntimeVersion($var) + { + GPBUtil::checkString($var, True); + $this->runtime_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OnDeployUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_OnDeployUpdatePolicy::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php new file mode 100644 index 000000000000..a357c173fb54 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php @@ -0,0 +1,67 @@ +google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings + */ +class VpcConnectorEgressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Use the VPC Access Connector only for private IP space from RFC1918. + * + * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; + */ + const PRIVATE_RANGES_ONLY = 1; + /** + * Force the use of VPC Access Connector for all egress traffic from the + * function. + * + * Generated from protobuf enum ALL_TRAFFIC = 2; + */ + const ALL_TRAFFIC = 2; + + private static $valueToName = [ + self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', + self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', + self::ALL_TRAFFIC => 'ALL_TRAFFIC', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_VpcConnectorEgressSettings::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php new file mode 100644 index 000000000000..50cab779a116 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php @@ -0,0 +1,83 @@ +google.cloud.functions.v1.CloudFunctionStatus + */ +class CloudFunctionStatus +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + */ + const CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + /** + * Function has been successfully deployed and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Function deployment failed and the function isn’t serving. + * + * Generated from protobuf enum OFFLINE = 2; + */ + const OFFLINE = 2; + /** + * Function is being created or updated. + * + * Generated from protobuf enum DEPLOY_IN_PROGRESS = 3; + */ + const DEPLOY_IN_PROGRESS = 3; + /** + * Function is being deleted. + * + * Generated from protobuf enum DELETE_IN_PROGRESS = 4; + */ + const DELETE_IN_PROGRESS = 4; + /** + * Function deployment failed and the function serving state is undefined. + * The function should be updated or deleted to move it out of this state. + * + * Generated from protobuf enum UNKNOWN = 5; + */ + const UNKNOWN = 5; + + private static $valueToName = [ + self::CLOUD_FUNCTION_STATUS_UNSPECIFIED => 'CLOUD_FUNCTION_STATUS_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::OFFLINE => 'OFFLINE', + self::DEPLOY_IN_PROGRESS => 'DEPLOY_IN_PROGRESS', + self::DELETE_IN_PROGRESS => 'DELETE_IN_PROGRESS', + self::UNKNOWN => 'UNKNOWN', + ]; + + 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php new file mode 100644 index 000000000000..cb11a65978b1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php @@ -0,0 +1,115 @@ +google.cloud.functions.v1.CreateFunctionRequest + */ +class CreateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $location = ''; + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @type \Google\Cloud\Functions\V1\CloudFunction $function + * Required. Function to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V1\CloudFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V1\CloudFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->function = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php new file mode 100644 index 000000000000..9fa98e38b5ea --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php @@ -0,0 +1,67 @@ +google.cloud.functions.v1.DeleteFunctionRequest + */ +class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which should be deleted. + * + * 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. The name of the function which should be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which should be deleted. + * + * 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 function which should be deleted. + * + * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php new file mode 100644 index 000000000000..a85d3f80fc84 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php @@ -0,0 +1,292 @@ +google.cloud.functions.v1.EventTrigger + */ +class EventTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + */ + protected $event_type = ''; + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + */ + protected $resource = ''; + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + */ + protected $service = ''; + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + */ + protected $failure_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $event_type + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * @type string $resource + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * @type string $service + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * @type \Google\Cloud\Functions\V1\FailurePolicy $failure_policy + * Specifies policy for failed executions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + * @return string + */ + public function getEventType() + { + return $this->event_type; + } + + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + * @param string $var + * @return $this + */ + public function setEventType($var) + { + GPBUtil::checkString($var, True); + $this->event_type = $var; + + return $this; + } + + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + * @return \Google\Cloud\Functions\V1\FailurePolicy|null + */ + public function getFailurePolicy() + { + return $this->failure_policy; + } + + public function hasFailurePolicy() + { + return isset($this->failure_policy); + } + + public function clearFailurePolicy() + { + unset($this->failure_policy); + } + + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + * @param \Google\Cloud\Functions\V1\FailurePolicy $var + * @return $this + */ + public function setFailurePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy::class); + $this->failure_policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php new file mode 100644 index 000000000000..f81b50f6d779 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php @@ -0,0 +1,76 @@ +google.cloud.functions.v1.FailurePolicy + */ +class FailurePolicy extends \Google\Protobuf\Internal\Message +{ + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry + * If specified, then the function will be retried in case of a failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * If specified, then the function will be retried in case of a failure. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; + * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null + */ + public function getRetry() + { + return $this->readOneof(1); + } + + public function hasRetry() + { + return $this->hasOneof(1); + } + + /** + * If specified, then the function will be retried in case of a failure. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; + * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var + * @return $this + */ + public function setRetry($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy\Retry::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php new file mode 100644 index 000000000000..a2188ed7d6ef --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php @@ -0,0 +1,40 @@ +google.cloud.functions.v1.FailurePolicy.Retry + */ +class Retry extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Retry::class, \Google\Cloud\Functions\V1\FailurePolicy_Retry::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php new file mode 100644 index 000000000000..072629f3be02 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php @@ -0,0 +1,109 @@ +google.cloud.functions.v1.GenerateDownloadUrlRequest + */ +class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + */ + protected $version_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @type int|string $version_id + * The optional version of function. If not set, default, current version + * is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkUint64($var); + $this->version_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php new file mode 100644 index 000000000000..54d5d55e458f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php @@ -0,0 +1,71 @@ +google.cloud.functions.v1.GenerateDownloadUrlResponse + */ +class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + */ + protected $download_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $download_url + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @return string + */ + public function getDownloadUrl() + { + return $this->download_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @param string $var + * @return $this + */ + public function setDownloadUrl($var) + { + GPBUtil::checkString($var, True); + $this->download_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php new file mode 100644 index 000000000000..94a0f06d4816 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php @@ -0,0 +1,161 @@ +google.cloud.functions.v1.GenerateUploadUrlRequest + */ +class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * @type string $kms_key_name + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php new file mode 100644 index 000000000000..41557ee9aa0e --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php @@ -0,0 +1,75 @@ +google.cloud.functions.v1.GenerateUploadUrlResponse + */ +class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + */ + protected $upload_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $upload_url + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @return string + */ + public function getUploadUrl() + { + return $this->upload_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @param string $var + * @return $this + */ + public function setUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->upload_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php new file mode 100644 index 000000000000..72f3e59339fc --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php @@ -0,0 +1,121 @@ +google.cloud.functions.v1.GetFunctionRequest + */ +class GetFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which details should be obtained. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $version_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which details should be obtained. + * @type int|string $version_id + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which details should be obtained. + * + * 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 function which details should be obtained. + * + * 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. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php new file mode 100644 index 000000000000..24ca96c54a24 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php @@ -0,0 +1,101 @@ +google.cloud.functions.v1.HttpsTrigger + */ +class HttpsTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $url = ''; + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + */ + protected $security_level = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Output only. The deployed url for the function. + * @type int $security_level + * The security level for the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * @return int + */ + public function getSecurityLevel() + { + return $this->security_level; + } + + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * @param int $var + * @return $this + */ + public function setSecurityLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\HttpsTrigger\SecurityLevel::class); + $this->security_level = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php new file mode 100644 index 000000000000..26f38ca940f8 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php @@ -0,0 +1,70 @@ +google.cloud.functions.v1.HttpsTrigger.SecurityLevel + */ +class SecurityLevel +{ + /** + * Unspecified. + * + * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; + */ + const SECURITY_LEVEL_UNSPECIFIED = 0; + /** + * Requests for a URL that match this handler that do not use HTTPS are + * automatically redirected to the HTTPS URL with the same path. Query + * parameters are reserved for the redirect. + * + * Generated from protobuf enum SECURE_ALWAYS = 1; + */ + const SECURE_ALWAYS = 1; + /** + * Both HTTP and HTTPS requests with URLs that match the handler succeed + * without redirects. The application can examine the request to determine + * which protocol was used and respond accordingly. + * + * Generated from protobuf enum SECURE_OPTIONAL = 2; + */ + const SECURE_OPTIONAL = 2; + + private static $valueToName = [ + self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', + self::SECURE_ALWAYS => 'SECURE_ALWAYS', + self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityLevel::class, \Google\Cloud\Functions\V1\HttpsTrigger_SecurityLevel::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php new file mode 100644 index 000000000000..31a224ea16e1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php @@ -0,0 +1,167 @@ +google.cloud.functions.v1.ListFunctionsRequest + */ +class ListFunctionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @type int $page_size + * Maximum number of functions to return per call. + * @type string $page_token + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.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 functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of functions 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php new file mode 100644 index 000000000000..354f44b97f4e --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php @@ -0,0 +1,151 @@ +google.cloud.functions.v1.ListFunctionsResponse + */ +class ListFunctionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + */ + private $functions; + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. The response does not include any + * functions from these locations. + * + * 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\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $functions + * The functions that match the request. + * @type string $next_page_token + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. The response does not include any + * functions from these locations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + * @param array<\Google\Cloud\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFunctions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->functions = $arr; + + return $this; + } + + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * 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. The response does not include any + * functions from these locations. + * + * 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. The response does not include any + * functions from these locations. + * + * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php new file mode 100644 index 000000000000..0f72c0be190f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php @@ -0,0 +1,349 @@ +google.cloud.functions.v1.OperationMetadataV1 + */ +class OperationMetadataV1 extends \Google\Protobuf\Internal\Message +{ + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + */ + protected $target = ''; + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + */ + protected $type = 0; + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + */ + protected $request = null; + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + */ + protected $version_id = 0; + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + */ + protected $update_time = null; + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + */ + protected $build_id = ''; + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + */ + protected $source_token = ''; + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + */ + protected $build_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * @type int $type + * Type of operation. + * @type \Google\Protobuf\Any $request + * The original request that started the operation. + * @type int|string $version_id + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * @type \Google\Protobuf\Timestamp $update_time + * The last update timestamp of the operation. + * @type string $build_id + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * @type string $source_token + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * @type string $build_name + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Operations::initOnce(); + parent::__construct($data); + } + + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\OperationType::class); + $this->type = $var; + + return $this; + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + * @return \Google\Protobuf\Any|null + */ + public function getRequest() + { + return $this->request; + } + + public function hasRequest() + { + return isset($this->request); + } + + public function clearRequest() + { + unset($this->request); + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setRequest($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->request = $var; + + return $this; + } + + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + * @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); + } + + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + * @return string + */ + public function getBuildId() + { + return $this->build_id; + } + + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + * @param string $var + * @return $this + */ + public function setBuildId($var) + { + GPBUtil::checkString($var, True); + $this->build_id = $var; + + return $this; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php new file mode 100644 index 000000000000..665dca661df7 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php @@ -0,0 +1,68 @@ +google.cloud.functions.v1.OperationType + */ +class OperationType +{ + /** + * Unknown operation type. + * + * Generated from protobuf enum OPERATION_UNSPECIFIED = 0; + */ + const OPERATION_UNSPECIFIED = 0; + /** + * Triggered by CreateFunction call + * + * Generated from protobuf enum CREATE_FUNCTION = 1; + */ + const CREATE_FUNCTION = 1; + /** + * Triggered by UpdateFunction call + * + * Generated from protobuf enum UPDATE_FUNCTION = 2; + */ + const UPDATE_FUNCTION = 2; + /** + * Triggered by DeleteFunction call. + * + * Generated from protobuf enum DELETE_FUNCTION = 3; + */ + const DELETE_FUNCTION = 3; + + private static $valueToName = [ + self::OPERATION_UNSPECIFIED => 'OPERATION_UNSPECIFIED', + self::CREATE_FUNCTION => 'CREATE_FUNCTION', + self::UPDATE_FUNCTION => 'UPDATE_FUNCTION', + self::DELETE_FUNCTION => 'DELETE_FUNCTION', + ]; + + 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php new file mode 100644 index 000000000000..c47df271d7a9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php @@ -0,0 +1,191 @@ +google.cloud.functions.v1.SecretEnvVar + */ +class SecretEnvVar extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Name of the environment variable. + * @type string $project_id + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php new file mode 100644 index 000000000000..66e6c00d8ac1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php @@ -0,0 +1,213 @@ +google.cloud.functions.v1.SecretVolume + */ +class SecretVolume extends \Google\Protobuf\Internal\Message +{ + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + */ + protected $mount_path = ''; + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + */ + private $versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mount_path + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * @type string $project_id + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + * @return string + */ + public function getMountPath() + { + return $this->mount_path; + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + * @param string $var + * @return $this + */ + public function setMountPath($var) + { + GPBUtil::checkString($var, True); + $this->mount_path = $var; + + return $this; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersions() + { + return $this->versions; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + * @param array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume\SecretVersion::class); + $this->versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php new file mode 100644 index 000000000000..a44fd6355ac6 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php @@ -0,0 +1,124 @@ +google.cloud.functions.v1.SecretVolume.SecretVersion + */ +class SecretVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * @type string $path + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretVersion::class, \Google\Cloud\Functions\V1\SecretVolume_SecretVersion::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php new file mode 100644 index 000000000000..6f58de5fd44f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php @@ -0,0 +1,154 @@ +google.cloud.functions.v1.SourceRepository + */ +class SourceRepository extends \Google\Protobuf\Internal\Message +{ + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deployed_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * @type string $deployed_url + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDeployedUrl() + { + return $this->deployed_url; + } + + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDeployedUrl($var) + { + GPBUtil::checkString($var, True); + $this->deployed_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php new file mode 100644 index 000000000000..9d09690f55e7 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php @@ -0,0 +1,121 @@ +google.cloud.functions.v1.UpdateFunctionRequest + */ +class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V1\CloudFunction $function + * Required. New version of the function. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The list of fields in `CloudFunction` that have to be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V1\CloudFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V1\CloudFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->function = $var; + + return $this; + } + + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @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); + } + + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php new file mode 100644 index 000000000000..48ae28d54e29 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php @@ -0,0 +1,75 @@ +callFunction($formattedName, $data); + 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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + $data = '[DATA]'; + + call_function_sample($formattedName, $data); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php new file mode 100644 index 000000000000..a1bbed30bfe9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php @@ -0,0 +1,84 @@ +createFunction($formattedLocation, $function); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CloudFunction $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 +{ + $formattedLocation = CloudFunctionsServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_function_sample($formattedLocation); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php new file mode 100644 index 000000000000..8b01ac67ecd1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php @@ -0,0 +1,81 @@ +deleteFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + + delete_function_sample($formattedName); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php new file mode 100644 index 000000000000..8f47e47eabf2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php @@ -0,0 +1,57 @@ +generateDownloadUrl(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php new file mode 100644 index 000000000000..fff703d3d6d1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php @@ -0,0 +1,77 @@ +generateUploadUrl(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php new file mode 100644 index 000000000000..8cdd9c74f902 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php @@ -0,0 +1,70 @@ +getFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + + get_function_sample($formattedName); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..7d5f9df65ad5 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php @@ -0,0 +1,68 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php new file mode 100644 index 000000000000..9a163ed63d13 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php @@ -0,0 +1,58 @@ +listFunctions(); + + /** @var CloudFunction $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 cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php new file mode 100644 index 000000000000..e8bcd3814df5 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/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 cloudfunctions_v1_generated_CloudFunctionsService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..b1a06b2632ff --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php @@ -0,0 +1,70 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..f7ce83e8395c --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php @@ -0,0 +1,77 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php new file mode 100644 index 000000000000..c3a85dedaa99 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php @@ -0,0 +1,68 @@ +updateFunction($function); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CloudFunction $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()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php new file mode 100644 index 000000000000..e423650fbff2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php @@ -0,0 +1,34 @@ +cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $data = 'data'; + * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); + * } finally { + * $cloudFunctionsServiceClient->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 CloudFunctionsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.functions.v1.CloudFunctionsService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $cloudFunctionNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $locationNameTemplate; + + private static $repositoryNameTemplate; + + 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/cloud_functions_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/cloud_functions_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/cloud_functions_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/cloud_functions_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getCloudFunctionNameTemplate() + { + if (self::$cloudFunctionNameTemplate == null) { + self::$cloudFunctionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); + } + + return self::$cloudFunctionNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRepositoryNameTemplate() + { + if (self::$repositoryNameTemplate == null) { + self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); + } + + return self::$repositoryNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'cloudFunction' => self::getCloudFunctionNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'repository' => self::getRepositoryNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * cloud_function resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted cloud_function resource. + */ + public static function cloudFunctionName($project, $location, $function) + { + return self::getCloudFunctionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName($project, $location, $repository) + { + return self::getRepositoryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cloudFunction: projects/{project}/locations/{location}/functions/{function} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * + * 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 'cloudfunctions.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); + } + + /** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $data = 'data'; + * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function to be called. + * @param string $data Required. Input to be passed to the function. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\CallFunctionResponse + * + * @throws ApiException if the remote call fails + */ + public function callFunction($name, $data, array $optionalArgs = []) + { + $request = new CallFunctionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setData($data); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CallFunction', CallFunctionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedLocation = $cloudFunctionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $function = new CloudFunction(); + * $operationResponse = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); + * $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 = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $location Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @param CloudFunction $function Required. Function 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 createFunction($location, $function, array $optionalArgs = []) + { + $request = new CreateFunctionRequest(); + $requestParamHeaders = []; + $request->setLocation($location); + $request->setFunction($function); + $requestParamHeaders['location'] = $location; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $operationResponse = $cloudFunctionsServiceClient->deleteFunction($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 = $cloudFunctionsServiceClient->deleteFunction($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'deleteFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which should be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteFunction($name, array $optionalArgs = []) + { + $request = new DeleteFunctionRequest(); + $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $response = $cloudFunctionsServiceClient->generateDownloadUrl(); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @type int $versionId + * The optional version of function. If not set, default, current version + * is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\GenerateDownloadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateDownloadUrl(array $optionalArgs = []) + { + $request = new GenerateDownloadUrlRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['versionId'])) { + $request->setVersionId($optionalArgs['versionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $response = $cloudFunctionsServiceClient->generateUploadUrl(); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * @type string $kmsKeyName + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\GenerateUploadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateUploadUrl(array $optionalArgs = []) + { + $request = new GenerateUploadUrlRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['kmsKeyName'])) { + $request->setKmsKeyName($optionalArgs['kmsKeyName']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $cloudFunctionsServiceClient->getFunction($formattedName); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which details should be obtained. + * @param array $optionalArgs { + * Optional. + * + * @type int $versionId + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\CloudFunction + * + * @throws ApiException if the remote call fails + */ + public function getFunction($name, array $optionalArgs = []) + { + $request = new GetFunctionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['versionId'])) { + $request->setVersionId($optionalArgs['versionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFunction', CloudFunction::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function exists and does not have a policy + * set. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $response = $cloudFunctionsServiceClient->getIamPolicy($resource); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @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 listFunctions(array $optionalArgs = []) + { + $request = new ListFunctionsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); + } + + /** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $cloudFunctionsServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $cloudFunctionsServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates existing function. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $function = new CloudFunction(); + * $operationResponse = $cloudFunctionsServiceClient->updateFunction($function); + * $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 = $cloudFunctionsServiceClient->updateFunction($function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'updateFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param CloudFunction $function Required. New version of the function. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Required. The list of fields in `CloudFunction` that have to be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateFunction($function, array $optionalArgs = []) + { + $request = new UpdateFunctionRequest(); + $requestParamHeaders = []; + $request->setFunction($function); + $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..eeb514889328 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json @@ -0,0 +1,78 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.functions.v1", + "libraryPackage": "Google\\Cloud\\Functions\\V1", + "services": { + "CloudFunctionsService": { + "clients": { + "grpc": { + "libraryClient": "CloudFunctionsServiceGapicClient", + "rpcs": { + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json new file mode 100644 index 000000000000..fd458597923c --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json @@ -0,0 +1,105 @@ +{ + "interfaces": { + "google.cloud.functions.v1.CloudFunctionsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ], + "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 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CallFunction": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GenerateDownloadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateUploadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFunctions": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php new file mode 100644 index 000000000000..0fa06f2e23bd --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php @@ -0,0 +1,79 @@ + [ + 'google.cloud.functions.v1.CloudFunctionsService' => [ + 'CreateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListFunctions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFunctions', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + ], + ], +]; diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php new file mode 100644 index 000000000000..5cbbcec88874 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php @@ -0,0 +1,188 @@ + [ + 'google.cloud.functions.v1.CloudFunctionsService' => [ + 'CallFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:call', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{location=projects/*/locations/*}/functions', + 'body' => 'function', + 'placeholders' => [ + 'location' => [ + 'getters' => [ + 'getLocation', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'ListFunctions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{function.name=projects/*/locations/*/functions/*}', + 'body' => 'function', + 'placeholders' => [ + 'function.name' => [ + 'getters' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/operations', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php new file mode 100644 index 000000000000..8fb42777775e --- /dev/null +++ b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php @@ -0,0 +1,1091 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CloudFunctionsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CloudFunctionsServiceClient($options); + } + + /** @test */ + public function callFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $executionId = 'executionId-1217171550'; + $result = 'result-934426595'; + $error = 'error96784904'; + $expectedResponse = new CallFunctionResponse(); + $expectedResponse->setExecutionId($executionId); + $expectedResponse->setResult($result); + $expectedResponse->setError($error); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $data = 'data3076010'; + $response = $gapicClient->callFunction($formattedName, $data); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/CallFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getData(); + $this->assertProtobufEquals($data, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function callFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $data = 'data3076010'; + try { + $gapicClient->callFunction($formattedName, $data); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId = 670497310; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new CloudFunction(); + $response = $gapicClient->createFunction($formattedLocation, $function); + $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.functions.v1.CloudFunctionsService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getLocation(); + $this->assertProtobufEquals($formattedLocation, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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 + $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new CloudFunction(); + $response = $gapicClient->createFunction($formattedLocation, $function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($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.functions.v1.CloudFunctionsService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + $response = $gapicClient->generateDownloadUrl(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateDownloadUrl', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->generateDownloadUrl(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + $response = $gapicClient->generateUploadUrl(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateUploadUrl', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->generateUploadUrl(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId2 = 102817515; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId2); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->getFunction($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.functions.v1.CloudFunctionsService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->getFunction($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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/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 listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new CloudFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listFunctions(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/ListFunctions', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->listFunctions(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId = 670497310; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new CloudFunction(); + $response = $gapicClient->updateFunction($function); + $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.functions.v1.CloudFunctionsService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new CloudFunction(); + $response = $gapicClient->updateFunction($function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php b/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php new file mode 100644 index 0000000000000000000000000000000000000000..4565d6db8a5e1bec88b5c5a3db9955a231e1c528 GIT binary patch literal 11429 zcmcIq&2t-B5ntJ{W3?Q`d5JfQvtgCVl1)M)?J5v-bK`v9j&K=BD9hJI;3Bvlnt-rntk7K8#r`%xo7yH3hA3GSH-lHow=F4!ev}u-Y4YUtnUtt=cY2JTMG$nwyl(G`Pv-@F z_{pFfCO!sXDg4N#+s17XBLdOG5q_Y1K0x}}ahMAt51EH!GkuY7j8bcT8CD)_`#p!>@ z)8wm=8uT%u8yeMQ<~W;uDPR()ITxBZr+N=&Exm16US=*kjrz(51pCb}7tUH`6pHP; zyQGYYqe5utIiB7#yiAfYid{Do`vE85a@>ZLVego(V{fBMGQd<2w|UBNG+BV@foo;b zNR;I4&=?+Xd)i}TS7UZ_j(xiPT)qSs*~;*%SSh-Om&0>5UvhWxWVvtbF5Q4sbcrdL zMn=N+PQc8LZVe1>b<0!lB&6@a3|kOcgj3Cy+)}i)TC<^)Dk~MGyzmMEn3YSd%DS?U zpwBCErHb#T$O%Z6l}5Gxs8U;9m_{3)D=Sr{MSmS5DLB4XyI-q6tS!te|KM}^8C+(9 z4+8@?>`?q*cgP*w>+c#J-^)J}PkVXG>F@}ie-=FM4FN*_S-^GgS~7U_3Uk4u^rr;O zNB4{rVa`KqcTJz`C0%$c#&Dvfxu&3_KJD-Jg(AsGI4&%Rd2Ui#fw^#K2F^5Tw3YV4t`)~NcX$Q&H2)K=;X(^3geG!ZbMX*L;TB59ay4?2$xU+gIU zcG^^7B9P!7^*Ao0!G(sAY3a8K0M+O_g2f`F+OBSQwzzfCG06{JAq3`py~p3t@Il|5 zK@{a|Z=1g6ZRso~@R1<)Ml-uYj#H3yaSBe(V;Wjs*K}DxNFt|s(?*^9nrrlor_96W ziU4!2v158DtMrQm%nAvM)GgVnHGcH7Nm7N_cotO?ihc)DOd!F4ij*pRIcA@S8v5Xs z;vCF!Lg_aNSm0tcTn8f_D$XDkI7<&CYsctnFDEG}!I_ZN7Zq6g>kOo#2f{6wVaEyI zoZ`lt7-OHy7vXj0h3wOK0Ab|RkP$es7|b^jPb&;*?ylB%5IJz`CT|DY$?$XLVvJh3 z?#O*O#TBZd=?FDq)TW#Al^0SEHO~X&JxD!q+{cECQaKj4%i`7N@@07A@C80(6clI^ z4HhHuTHDcGQ*T=s{byP9e?LZ`h?aAaD83%B;O9yWPIeviQkPo0>7o9_q42c{S(h2L zDu~I4a4O{2cRUkqeV4gVvY3A^Ux#bD>zkW;#}B3x(}eMr8aF3fx((+J7yQMiMS4uM z*WrA*Ub?TSnyRc;nk{ua$h``rRIjzQE=)-u0fxL0Y;qHh z3v?sQSz^}w8Z4oyjxSV@lCyAUu0d&X5c&=sUWJxWS^w{x;R*2^#KD zpcBI{o&F&6DtoOTW-P~;u@qx=bYvYd=CTB2TYrj)sOQu0f*=lkkeT%iq2Ek<{M$T= zHbW4#?eseo^VxU;I3m`fyFZuT00}?ooetuZaUCJ%^fW`jAkc5t9LH33Xy z^yq3B8_0VUp)-Cvjx|86kU2dmhjm7P))^j^88Tcirfnmp;~L)^(Dk5AbOx?#*qzZA&Voc=*TwQOJGz=RxrPQjc znzE`Y&8F5=S`=V5$6(Z1INeYy>lC}Ha&1*zM1v8e z#!qxajNBB(VU9;W;xY=s*lC`W{!H;QV<}7zxok5}>g)cNz8HnFUWsO>@4)dOv1Q{UhzM=j_I0;2 z9wdXr_Eks=Qg)Vy8T(lPMyjzifPrWVPNpyu7OC{6X<_9rSbA(aNM*nx3=Svn!aSBJ zy+K>^oxa%-;O5dluNn*}%yNF)fyWIYyJy;wQ z(CcH}*dVuHm~*2>sgqxdF{WUJ6rb6~Q(ue75+)o2+ck8wDnw|g`ROZ3n!zrX@TG4A z3<3?kJEozlO!ZhO2`UBq&`(uV6UZ`zH3Fua$t35-foajE=r+(CnAwN)6O?j|Rk6mU zj7~+(?kH2`!_pWnKnh9sm&U@%v9tz@Wy3P|>+0o<^ydl41Qp}8zUAoMHP`wdY{Pi9 zidjaJzBNkMC+qqPM(;Sp*J(zjqKn6m6VvBxy=a!S4l z=MUs97KBxlu9$MTBrM^brp~GI#61iiFX0-)fWQybkEeNn8crbusvs&A(+cnZdW`pv zO37K|1ka_vCE&Pt9;=wsRhwSl(nUR#)~1tKQJ@v)9*=A3!ksTTFP8Uu290=6beA@a zJRWk$SWTA}I?}NP`AAYN{SfBGQaF2hdac!3l?RH3HP+Sf8Y|+|GKGNk#sj6+!s84J zgL1X;fy`@xMWrQUiFFpHR%I-%rU9_>swyP}yyb-%EZn8bN~!+fL8aM5REY0pr9V!= zsj%}EbV~__5`)wvD32W#*0KYeBDt9y{@3a5nhYXEq+Hj1_okQ8svk;lva> zLUYy8rU);KP23cr2jMX$`WaZL$!PSWErkOsKg{ThYn3W(E?_mhsi^Cfl7e=RKU!*K zbyZQ(_>rUdqN(+2wJ4YFqYL0$F=Y65R;s@tawEn*>o@q()H1n?n9;73{ zIaV{HLnqYCk5MyaSQOR}o>c6*$PtYs;?UQQ=+K`e;8XxJLnu$;iU9jY2kZT6;2{T` zrw0%T=l+mwT3LFJZQ8_E+!Hs>LYbEn*T|;{I33Is!Q&*Z)^x!5U_o)^&;!ZDlB#S; zE0TPq*ov3H_$9iC{|%YH8(j**Qu(jmY5% z`hp7!w7JV#aHfHm8^T|^d!NgXUfh_yHR&|0xr-C9|B<&jVNZ18b@0wB?W5u>kv1&O z_08Cp-14ML5Dgq;FP@NfccOmQy-BACTV^;(_>9wh`|z@5P!OJY8KP{AGl-{n{-P{O zCgv~du5<;wqKf?AkFOA4JU~CJ%uI!(HDqM*bb?Dpqgoogle.cloud.functions.v2.BuildConfig + */ +class BuildConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $build = ''; + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + */ + protected $runtime = ''; + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + */ + protected $entry_point = ''; + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + */ + protected $source = null; + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_provenance = null; + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + */ + protected $worker_pool = ''; + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + */ + private $environment_variables; + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If `docker_repository` field is specified, this field will be automatically + * set as `ARTIFACT_REGISTRY`. + * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + * This field may be overridden by the backend for eligible deployments. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + */ + protected $docker_registry = 0; + /** + * User managed repository created in Artifact Registry optionally + * with a customer managed encryption key. This is the repository to which the + * function docker image will be pushed after it is built by Cloud Build. + * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + */ + protected $docker_repository = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $build + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * @type string $runtime + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * @type string $entry_point + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * @type \Google\Cloud\Functions\V2\Source $source + * The location of the function source code. + * @type \Google\Cloud\Functions\V2\SourceProvenance $source_provenance + * Output only. A permanent fixed identifier for source. + * @type string $worker_pool + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * User-provided build-time environment variables for the function + * @type int $docker_registry + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If `docker_repository` field is specified, this field will be automatically + * set as `ARTIFACT_REGISTRY`. + * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + * This field may be overridden by the backend for eligible deployments. + * @type string $docker_repository + * User managed repository created in Artifact Registry optionally + * with a customer managed encryption key. This is the repository to which the + * function docker image will be pushed after it is built by Cloud Build. + * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBuild() + { + return $this->build; + } + + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkString($var, True); + $this->build = $var; + + return $this; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + * @return string + */ + public function getRuntime() + { + return $this->runtime; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + * @param string $var + * @return $this + */ + public function setRuntime($var) + { + GPBUtil::checkString($var, True); + $this->runtime = $var; + + return $this; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + * @return \Google\Cloud\Functions\V2\Source|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + * @param \Google\Cloud\Functions\V2\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\Source::class); + $this->source = $var; + + return $this; + } + + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Functions\V2\SourceProvenance|null + */ + public function getSourceProvenance() + { + return $this->source_provenance; + } + + public function hasSourceProvenance() + { + return isset($this->source_provenance); + } + + public function clearSourceProvenance() + { + unset($this->source_provenance); + } + + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Functions\V2\SourceProvenance $var + * @return $this + */ + public function setSourceProvenance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\SourceProvenance::class); + $this->source_provenance = $var; + + return $this; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + * @return string + */ + public function getWorkerPool() + { + return $this->worker_pool; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->worker_pool = $var; + + return $this; + } + + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If `docker_repository` field is specified, this field will be automatically + * set as `ARTIFACT_REGISTRY`. + * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + * This field may be overridden by the backend for eligible deployments. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + * @return int + */ + public function getDockerRegistry() + { + return $this->docker_registry; + } + + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If `docker_repository` field is specified, this field will be automatically + * set as `ARTIFACT_REGISTRY`. + * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + * This field may be overridden by the backend for eligible deployments. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + * @param int $var + * @return $this + */ + public function setDockerRegistry($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\BuildConfig\DockerRegistry::class); + $this->docker_registry = $var; + + return $this; + } + + /** + * User managed repository created in Artifact Registry optionally + * with a customer managed encryption key. This is the repository to which the + * function docker image will be pushed after it is built by Cloud Build. + * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getDockerRepository() + { + return $this->docker_repository; + } + + /** + * User managed repository created in Artifact Registry optionally + * with a customer managed encryption key. This is the repository to which the + * function docker image will be pushed after it is built by Cloud Build. + * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDockerRepository($var) + { + GPBUtil::checkString($var, True); + $this->docker_repository = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php new file mode 100644 index 000000000000..dc5838f431f2 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php @@ -0,0 +1,69 @@ +google.cloud.functions.v2.BuildConfig.DockerRegistry + */ +class DockerRegistry +{ + /** + * Unspecified. + * + * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; + */ + const DOCKER_REGISTRY_UNSPECIFIED = 0; + /** + * Docker images will be stored in multi-regional Container Registry + * repositories named `gcf`. + * + * Generated from protobuf enum CONTAINER_REGISTRY = 1; + */ + const CONTAINER_REGISTRY = 1; + /** + * Docker images will be stored in regional Artifact Registry repositories. + * By default, GCF will create and use repositories named `gcf-artifacts` + * in every region in which a function is deployed. But the repository to + * use can also be specified by the user using the `docker_repository` + * field. + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 2; + */ + const ARTIFACT_REGISTRY = 2; + + private static $valueToName = [ + self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', + self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DockerRegistry::class, \Google\Cloud\Functions\V2\BuildConfig_DockerRegistry::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php new file mode 100644 index 000000000000..903e08f50551 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php @@ -0,0 +1,184 @@ +google.cloud.functions.v2.CreateFunctionRequest + */ +class CreateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + */ + protected $function_id = ''; + + /** + * @param string $parent Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Functions\V2\PBFunction $function Required. Function to be created. + * @param string $functionId The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * @return \Google\Cloud\Functions\V2\CreateFunctionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Functions\V2\PBFunction $function, string $functionId): self + { + return (new self()) + ->setParent($parent) + ->setFunction($function) + ->setFunctionId($functionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @type \Google\Cloud\Functions\V2\PBFunction $function + * Required. Function to be created. + * @type string $function_id + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the function should be created, + * 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 in which the function should be created, + * 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; + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V2\PBFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V2\PBFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); + $this->function = $var; + + return $this; + } + + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + * @return string + */ + public function getFunctionId() + { + return $this->function_id; + } + + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + * @param string $var + * @return $this + */ + public function setFunctionId($var) + { + GPBUtil::checkString($var, True); + $this->function_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php new file mode 100644 index 000000000000..cd7afb9522a6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php @@ -0,0 +1,81 @@ +google.cloud.functions.v2.DeleteFunctionRequest + */ +class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which should be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the function which should be deleted. Please see + * {@see FunctionServiceClient::functionName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\DeleteFunctionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which should be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which should be deleted. + * + * 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 function which should be deleted. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php new file mode 100644 index 000000000000..a1fd8153a794 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php @@ -0,0 +1,61 @@ +google.cloud.functions.v2.Environment + */ +class Environment +{ + /** + * Unspecified + * + * Generated from protobuf enum ENVIRONMENT_UNSPECIFIED = 0; + */ + const ENVIRONMENT_UNSPECIFIED = 0; + /** + * Gen 1 + * + * Generated from protobuf enum GEN_1 = 1; + */ + const GEN_1 = 1; + /** + * Gen 2 + * + * Generated from protobuf enum GEN_2 = 2; + */ + const GEN_2 = 2; + + private static $valueToName = [ + self::ENVIRONMENT_UNSPECIFIED => 'ENVIRONMENT_UNSPECIFIED', + self::GEN_1 => 'GEN_1', + self::GEN_2 => 'GEN_2', + ]; + + 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php new file mode 100644 index 000000000000..15ec540f1dd6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php @@ -0,0 +1,147 @@ +google.cloud.functions.v2.EventFilter + */ +class EventFilter extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attribute = ''; + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $operator = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $attribute + * Required. The name of a CloudEvents attribute. + * @type string $value + * Required. The value for the attribute. + * @type string $operator + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAttribute($var) + { + GPBUtil::checkString($var, True); + $this->attribute = $var; + + return $this; + } + + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOperator($var) + { + GPBUtil::checkString($var, True); + $this->operator = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php new file mode 100644 index 000000000000..ac73f76aace5 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php @@ -0,0 +1,378 @@ +google.cloud.functions.v2.EventTrigger + */ +class EventTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $trigger = ''; + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + */ + protected $trigger_region = ''; + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event_type = ''; + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + */ + private $event_filters; + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $pubsub_topic = ''; + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_email = ''; + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retry_policy = 0; + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $channel = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $trigger + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * @type string $trigger_region + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * @type string $event_type + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * @type array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $event_filters + * Criteria used to filter events. + * @type string $pubsub_topic + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * @type string $service_account_email + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * @type int $retry_policy + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * @type string $channel + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getTrigger() + { + return $this->trigger; + } + + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTrigger($var) + { + GPBUtil::checkString($var, True); + $this->trigger = $var; + + return $this; + } + + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + * @return string + */ + public function getTriggerRegion() + { + return $this->trigger_region; + } + + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + * @param string $var + * @return $this + */ + public function setTriggerRegion($var) + { + GPBUtil::checkString($var, True); + $this->trigger_region = $var; + + return $this; + } + + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEventType() + { + return $this->event_type; + } + + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEventType($var) + { + GPBUtil::checkString($var, True); + $this->event_type = $var; + + return $this; + } + + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEventFilters() + { + return $this->event_filters; + } + + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + * @param array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEventFilters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\EventFilter::class); + $this->event_filters = $arr; + + return $this; + } + + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getPubsubTopic() + { + return $this->pubsub_topic; + } + + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPubsubTopic($var) + { + GPBUtil::checkString($var, True); + $this->pubsub_topic = $var; + + return $this; + } + + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRetryPolicy() + { + return $this->retry_policy; + } + + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRetryPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\EventTrigger\RetryPolicy::class); + $this->retry_policy = $var; + + return $this; + } + + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkString($var, True); + $this->channel = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php new file mode 100644 index 000000000000..fe9035ebeee4 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php @@ -0,0 +1,66 @@ +google.cloud.functions.v2.EventTrigger.RetryPolicy + */ +class RetryPolicy +{ + /** + * Not specified. + * + * Generated from protobuf enum RETRY_POLICY_UNSPECIFIED = 0; + */ + const RETRY_POLICY_UNSPECIFIED = 0; + /** + * Do not retry. + * + * Generated from protobuf enum RETRY_POLICY_DO_NOT_RETRY = 1; + */ + const RETRY_POLICY_DO_NOT_RETRY = 1; + /** + * Retry on any failure, retry up to 7 days with an exponential backoff + * (capped at 10 seconds). + * + * Generated from protobuf enum RETRY_POLICY_RETRY = 2; + */ + const RETRY_POLICY_RETRY = 2; + + private static $valueToName = [ + self::RETRY_POLICY_UNSPECIFIED => 'RETRY_POLICY_UNSPECIFIED', + self::RETRY_POLICY_DO_NOT_RETRY => 'RETRY_POLICY_DO_NOT_RETRY', + self::RETRY_POLICY_RETRY => 'RETRY_POLICY_RETRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RetryPolicy::class, \Google\Cloud\Functions\V2\EventTrigger_RetryPolicy::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php new file mode 100644 index 000000000000..6e003ddc46aa --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.GenerateDownloadUrlRequest + */ +class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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 function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php new file mode 100644 index 000000000000..c49cbe0ed3f5 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.GenerateDownloadUrlResponse + */ +class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + */ + protected $download_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $download_url + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @return string + */ + public function getDownloadUrl() + { + return $this->download_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @param string $var + * @return $this + */ + public function setDownloadUrl($var) + { + GPBUtil::checkString($var, True); + $this->download_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php new file mode 100644 index 000000000000..40a85803c587 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php @@ -0,0 +1,153 @@ +google.cloud.functions.v2.GenerateUploadUrlRequest + */ +class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * @type string $kms_key_name + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, 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 in which the Google Cloud Storage signed + * URL should be generated, 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; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php new file mode 100644 index 000000000000..ec4ee0a82cfa --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php @@ -0,0 +1,139 @@ +google.cloud.functions.v2.GenerateUploadUrlResponse + */ +class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + */ + protected $upload_url = ''; + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + */ + protected $storage_source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $upload_url + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * @type \Google\Cloud\Functions\V2\StorageSource $storage_source + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @return string + */ + public function getUploadUrl() + { + return $this->upload_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @param string $var + * @return $this + */ + public function setUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->upload_url = $var; + + return $this; + } + + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getStorageSource() + { + return $this->storage_source; + } + + public function hasStorageSource() + { + return isset($this->storage_source); + } + + public function clearStorageSource() + { + unset($this->storage_source); + } + + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->storage_source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php new file mode 100644 index 000000000000..7a7a6e4ab9d6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php @@ -0,0 +1,81 @@ +google.cloud.functions.v2.GetFunctionRequest + */ +class GetFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which details should be obtained. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the function which details should be obtained. Please see + * {@see FunctionServiceClient::functionName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\GetFunctionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which details should be obtained. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which details should be obtained. + * + * 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 function which details should be obtained. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php new file mode 100644 index 000000000000..993b0f979c80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php @@ -0,0 +1,278 @@ +google.cloud.functions.v2.ListFunctionsRequest + */ +class ListFunctionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. Please see + * {@see FunctionServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\ListFunctionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @type int $page_size + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @type string $page_token + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @type string $filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type string $order_by + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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; + } + + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php new file mode 100644 index 000000000000..edfa21aa7abe --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php @@ -0,0 +1,143 @@ +google.cloud.functions.v2.ListFunctionsResponse + */ +class ListFunctionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + */ + private $functions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. The response does not include any + * functions from these locations. + * + * 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\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $functions + * The functions that match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. The response does not include any + * functions from these locations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + * @param array<\Google\Cloud\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFunctions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\PBFunction::class); + $this->functions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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. The response does not include any + * functions from these locations. + * + * 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. The response does not include any + * functions from these locations. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php new file mode 100644 index 000000000000..7b4e50584294 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php @@ -0,0 +1,124 @@ +google.cloud.functions.v2.ListRuntimesRequest + */ +class ListRuntimesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the runtimes 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 = ''; + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\ListRuntimesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * @type string $filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the runtimes 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 runtimes 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; + } + + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php new file mode 100644 index 000000000000..b833f9d472e1 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.ListRuntimesResponse + */ +class ListRuntimesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + */ + private $runtimes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $runtimes + * The runtimes that match the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRuntimes() + { + return $this->runtimes; + } + + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + * @param array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRuntimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime::class); + $this->runtimes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php new file mode 100644 index 000000000000..3a6de70b406f --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php @@ -0,0 +1,207 @@ +google.cloud.functions.v2.ListRuntimesResponse.Runtime + */ +class Runtime extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + */ + protected $display_name = ''; + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + */ + protected $stage = 0; + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + */ + private $warnings; + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + */ + protected $environment = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * @type string $display_name + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * @type int $stage + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * @type array|\Google\Protobuf\Internal\RepeatedField $warnings + * Warning messages, e.g., a deprecation warning. + * @type int $environment + * The environment for the runtime. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + * @return int + */ + public function getStage() + { + return $this->stage; + } + + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + * @param int $var + * @return $this + */ + public function setStage($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ListRuntimesResponse\RuntimeStage::class); + $this->stage = $var; + + return $this; + } + + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWarnings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->warnings = $arr; + + return $this; + } + + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Runtime::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_Runtime::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php new file mode 100644 index 000000000000..60d76ac6285e --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php @@ -0,0 +1,92 @@ +google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage + */ +class RuntimeStage +{ + /** + * Not specified. + * + * Generated from protobuf enum RUNTIME_STAGE_UNSPECIFIED = 0; + */ + const RUNTIME_STAGE_UNSPECIFIED = 0; + /** + * The runtime is in development. + * + * Generated from protobuf enum DEVELOPMENT = 1; + */ + const DEVELOPMENT = 1; + /** + * The runtime is in the Alpha stage. + * + * Generated from protobuf enum ALPHA = 2; + */ + const ALPHA = 2; + /** + * The runtime is in the Beta stage. + * + * Generated from protobuf enum BETA = 3; + */ + const BETA = 3; + /** + * The runtime is generally available. + * + * Generated from protobuf enum GA = 4; + */ + const GA = 4; + /** + * The runtime is deprecated. + * + * Generated from protobuf enum DEPRECATED = 5; + */ + const DEPRECATED = 5; + /** + * The runtime is no longer supported. + * + * Generated from protobuf enum DECOMMISSIONED = 6; + */ + const DECOMMISSIONED = 6; + + private static $valueToName = [ + self::RUNTIME_STAGE_UNSPECIFIED => 'RUNTIME_STAGE_UNSPECIFIED', + self::DEVELOPMENT => 'DEVELOPMENT', + self::ALPHA => 'ALPHA', + self::BETA => 'BETA', + self::GA => 'GA', + self::DEPRECATED => 'DEPRECATED', + self::DECOMMISSIONED => 'DECOMMISSIONED', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RuntimeStage::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_RuntimeStage::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php new file mode 100644 index 000000000000..f6f8e06ea974 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + */ + private $environments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $environments + * The Cloud Function environments this location supports. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnvironments() + { + return $this->environments; + } + + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnvironments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Functions\V2\Environment::class); + $this->environments = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php new file mode 100644 index 000000000000..064db1c709af --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php @@ -0,0 +1,385 @@ +google.cloud.functions.v2.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + */ + protected $status_detail = ''; + /** + * 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 cancel_requested = 6; + */ + protected $cancel_requested = false; + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + */ + protected $api_version = ''; + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + */ + protected $request_resource = null; + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + */ + private $stages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * @type string $status_detail + * Human-readable status of the operation, if any. + * @type bool $cancel_requested + * 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 + * API version used to start the operation. + * @type \Google\Protobuf\Any $request_resource + * The original request that started the operation. + * @type array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $stages + * Mechanism for reporting in-progress stages + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @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); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @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); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @return string + */ + public function getStatusDetail() + { + return $this->status_detail; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @param string $var + * @return $this + */ + public function setStatusDetail($var) + { + GPBUtil::checkString($var, True); + $this->status_detail = $var; + + return $this; + } + + /** + * 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 cancel_requested = 6; + * @return bool + */ + public function getCancelRequested() + { + return $this->cancel_requested; + } + + /** + * 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 cancel_requested = 6; + * @param bool $var + * @return $this + */ + public function setCancelRequested($var) + { + GPBUtil::checkBool($var); + $this->cancel_requested = $var; + + return $this; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + * @return \Google\Protobuf\Any|null + */ + public function getRequestResource() + { + return $this->request_resource; + } + + public function hasRequestResource() + { + return isset($this->request_resource); + } + + public function clearRequestResource() + { + unset($this->request_resource); + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setRequestResource($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->request_resource = $var; + + return $this; + } + + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStages() + { + return $this->stages; + } + + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + * @param array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\Stage::class); + $this->stages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php new file mode 100644 index 000000000000..6221980da99d --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php @@ -0,0 +1,510 @@ +google.cloud.functions.v2.Function + */ +class PBFunction extends \Google\Protobuf\Internal\Message +{ + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + */ + protected $build_config = null; + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + */ + protected $service_config = null; + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + */ + protected $event_trigger = null; + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $state_messages; + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + */ + protected $environment = 0; + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $url = ''; + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * @type string $description + * User-provided description of a function. + * @type \Google\Cloud\Functions\V2\BuildConfig $build_config + * Describes the Build step of the function that builds a container from the + * given source. + * @type \Google\Cloud\Functions\V2\ServiceConfig $service_config + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * @type \Google\Cloud\Functions\V2\EventTrigger $event_trigger + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * @type int $state + * Output only. State of the function. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last update timestamp of a Cloud Function. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this Cloud Function. + * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages + * Output only. State Messages for this Cloud Function. + * @type int $environment + * Describe whether the function is 1st Gen or 2nd Gen. + * @type string $url + * Output only. The deployed url for the function. + * @type string $kms_key_name + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + * @return \Google\Cloud\Functions\V2\BuildConfig|null + */ + public function getBuildConfig() + { + return $this->build_config; + } + + public function hasBuildConfig() + { + return isset($this->build_config); + } + + public function clearBuildConfig() + { + unset($this->build_config); + } + + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + * @param \Google\Cloud\Functions\V2\BuildConfig $var + * @return $this + */ + public function setBuildConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\BuildConfig::class); + $this->build_config = $var; + + return $this; + } + + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + * @return \Google\Cloud\Functions\V2\ServiceConfig|null + */ + public function getServiceConfig() + { + return $this->service_config; + } + + public function hasServiceConfig() + { + return isset($this->service_config); + } + + public function clearServiceConfig() + { + unset($this->service_config); + } + + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + * @param \Google\Cloud\Functions\V2\ServiceConfig $var + * @return $this + */ + public function setServiceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\ServiceConfig::class); + $this->service_config = $var; + + return $this; + } + + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + * @return \Google\Cloud\Functions\V2\EventTrigger|null + */ + public function getEventTrigger() + { + return $this->event_trigger; + } + + public function hasEventTrigger() + { + return isset($this->event_trigger); + } + + public function clearEventTrigger() + { + unset($this->event_trigger); + } + + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + * @param \Google\Cloud\Functions\V2\EventTrigger $var + * @return $this + */ + public function setEventTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\EventTrigger::class); + $this->event_trigger = $var; + + return $this; + } + + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\PBFunction\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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 last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + * @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; + } + + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStateMessages() + { + return $this->state_messages; + } + + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStateMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); + $this->state_messages = $arr; + + return $this; + } + + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php new file mode 100644 index 000000000000..f6e8c8a0e5cd --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php @@ -0,0 +1,86 @@ +google.cloud.functions.v2.Function.State + */ +class State +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Function has been successfully deployed and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Function deployment failed and the function is not serving. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * Function is being created or updated. + * + * Generated from protobuf enum DEPLOYING = 3; + */ + const DEPLOYING = 3; + /** + * Function is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * Function deployment failed and the function serving state is undefined. + * The function should be updated or deleted to move it out of this state. + * + * Generated from protobuf enum UNKNOWN = 5; + */ + const UNKNOWN = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::DEPLOYING => 'DEPLOYING', + self::DELETING => 'DELETING', + self::UNKNOWN => 'UNKNOWN', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Functions\V2\Function_State::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php new file mode 100644 index 000000000000..5326f62530e6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php @@ -0,0 +1,309 @@ +google.cloud.functions.v2.RepoSource + */ +class RepoSource extends \Google\Protobuf\Internal\Message +{ + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + */ + protected $repo_name = ''; + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + */ + protected $dir = ''; + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + */ + protected $invert_regex = false; + protected $revision; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $branch_name + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * @type string $tag_name + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * @type string $commit_sha + * Explicit commit SHA to build. + * @type string $project_id + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * @type string $repo_name + * Name of the Cloud Source Repository. + * @type string $dir + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * @type bool $invert_regex + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string branch_name = 3; + * @return string + */ + public function getBranchName() + { + return $this->readOneof(3); + } + + public function hasBranchName() + { + return $this->hasOneof(3); + } + + /** + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string branch_name = 3; + * @param string $var + * @return $this + */ + public function setBranchName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string tag_name = 4; + * @return string + */ + public function getTagName() + { + return $this->readOneof(4); + } + + public function hasTagName() + { + return $this->hasOneof(4); + } + + /** + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string tag_name = 4; + * @param string $var + * @return $this + */ + public function setTagName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Explicit commit SHA to build. + * + * Generated from protobuf field string commit_sha = 5; + * @return string + */ + public function getCommitSha() + { + return $this->readOneof(5); + } + + public function hasCommitSha() + { + return $this->hasOneof(5); + } + + /** + * Explicit commit SHA to build. + * + * Generated from protobuf field string commit_sha = 5; + * @param string $var + * @return $this + */ + public function setCommitSha($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + * @return string + */ + public function getRepoName() + { + return $this->repo_name; + } + + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + * @param string $var + * @return $this + */ + public function setRepoName($var) + { + GPBUtil::checkString($var, True); + $this->repo_name = $var; + + return $this; + } + + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + * @return string + */ + public function getDir() + { + return $this->dir; + } + + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + * @param string $var + * @return $this + */ + public function setDir($var) + { + GPBUtil::checkString($var, True); + $this->dir = $var; + + return $this; + } + + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + * @return bool + */ + public function getInvertRegex() + { + return $this->invert_regex; + } + + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + * @param bool $var + * @return $this + */ + public function setInvertRegex($var) + { + GPBUtil::checkBool($var); + $this->invert_regex = $var; + + return $this; + } + + /** + * @return string + */ + public function getRevision() + { + return $this->whichOneof("revision"); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php new file mode 100644 index 000000000000..d14b7f6d187b --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php @@ -0,0 +1,191 @@ +google.cloud.functions.v2.SecretEnvVar + */ +class SecretEnvVar extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Name of the environment variable. + * @type string $project_id + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php new file mode 100644 index 000000000000..505db9251bf8 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php @@ -0,0 +1,203 @@ +google.cloud.functions.v2.SecretVolume + */ +class SecretVolume extends \Google\Protobuf\Internal\Message +{ + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + */ + protected $mount_path = ''; + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + */ + private $versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mount_path + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * @type string $project_id + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + * @return string + */ + public function getMountPath() + { + return $this->mount_path; + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + * @param string $var + * @return $this + */ + public function setMountPath($var) + { + GPBUtil::checkString($var, True); + $this->mount_path = $var; + + return $this; + } + + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersions() + { + return $this->versions; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + * @param array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume\SecretVersion::class); + $this->versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php new file mode 100644 index 000000000000..fe99c1e3ddd3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php @@ -0,0 +1,124 @@ +google.cloud.functions.v2.SecretVolume.SecretVersion + */ +class SecretVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * @type string $path + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretVersion::class, \Google\Cloud\Functions\V2\SecretVolume_SecretVersion::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php new file mode 100644 index 000000000000..b333f681bb86 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php @@ -0,0 +1,810 @@ +google.cloud.functions.v2.ServiceConfig + */ +class ServiceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + */ + protected $timeout_seconds = 0; + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + */ + protected $available_memory = ''; + /** + * [Preview] The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + */ + protected $available_cpu = ''; + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + */ + private $environment_variables; + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + */ + protected $max_instance_count = 0; + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + */ + protected $min_instance_count = 0; + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + */ + protected $vpc_connector = ''; + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + */ + protected $vpc_connector_egress_settings = 0; + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + */ + protected $ingress_settings = 0; + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uri = ''; + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + */ + protected $service_account_email = ''; + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + */ + protected $all_traffic_on_latest_revision = false; + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + */ + private $secret_environment_variables; + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + */ + private $secret_volumes; + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision = ''; + /** + * [Preview] Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + */ + protected $max_instance_request_concurrency = 0; + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + */ + protected $security_level = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * @type int $timeout_seconds + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * @type string $available_memory + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * @type string $available_cpu + * [Preview] The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * Environment variables that shall be available during function execution. + * @type int $max_instance_count + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * @type int $min_instance_count + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * @type string $vpc_connector + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * @type int $vpc_connector_egress_settings + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * @type int $ingress_settings + * The ingress settings for the function, controlling what traffic can reach + * it. + * @type string $uri + * Output only. URI of the Service deployed. + * @type string $service_account_email + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * @type bool $all_traffic_on_latest_revision + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * @type array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables + * Secret environment variables configuration. + * @type array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes + * Secret volumes configuration. + * @type string $revision + * Output only. The name of service revision. + * @type int $max_instance_request_concurrency + * [Preview] Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * @type int $security_level + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + * @return int + */ + public function getTimeoutSeconds() + { + return $this->timeout_seconds; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + * @param int $var + * @return $this + */ + public function setTimeoutSeconds($var) + { + GPBUtil::checkInt32($var); + $this->timeout_seconds = $var; + + return $this; + } + + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + * @return string + */ + public function getAvailableMemory() + { + return $this->available_memory; + } + + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + * @param string $var + * @return $this + */ + public function setAvailableMemory($var) + { + GPBUtil::checkString($var, True); + $this->available_memory = $var; + + return $this; + } + + /** + * [Preview] The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + * @return string + */ + public function getAvailableCpu() + { + return $this->available_cpu; + } + + /** + * [Preview] The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + * @param string $var + * @return $this + */ + public function setAvailableCpu($var) + { + GPBUtil::checkString($var, True); + $this->available_cpu = $var; + + return $this; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + * @return int + */ + public function getMaxInstanceCount() + { + return $this->max_instance_count; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + * @param int $var + * @return $this + */ + public function setMaxInstanceCount($var) + { + GPBUtil::checkInt32($var); + $this->max_instance_count = $var; + + return $this; + } + + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + * @return int + */ + public function getMinInstanceCount() + { + return $this->min_instance_count; + } + + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + * @param int $var + * @return $this + */ + public function setMinInstanceCount($var) + { + GPBUtil::checkInt32($var); + $this->min_instance_count = $var; + + return $this; + } + + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getVpcConnector() + { + return $this->vpc_connector; + } + + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVpcConnector($var) + { + GPBUtil::checkString($var, True); + $this->vpc_connector = $var; + + return $this; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + * @return int + */ + public function getVpcConnectorEgressSettings() + { + return $this->vpc_connector_egress_settings; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + * @param int $var + * @return $this + */ + public function setVpcConnectorEgressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\VpcConnectorEgressSettings::class); + $this->vpc_connector_egress_settings = $var; + + return $this; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + * @return int + */ + public function getIngressSettings() + { + return $this->ingress_settings; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + * @param int $var + * @return $this + */ + public function setIngressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\IngressSettings::class); + $this->ingress_settings = $var; + + return $this; + } + + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + * @return bool + */ + public function getAllTrafficOnLatestRevision() + { + return $this->all_traffic_on_latest_revision; + } + + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + * @param bool $var + * @return $this + */ + public function setAllTrafficOnLatestRevision($var) + { + GPBUtil::checkBool($var); + $this->all_traffic_on_latest_revision = $var; + + return $this; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretEnvironmentVariables() + { + return $this->secret_environment_variables; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + * @param array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretEnvironmentVariables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretEnvVar::class); + $this->secret_environment_variables = $arr; + + return $this; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretVolumes() + { + return $this->secret_volumes; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + * @param array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretVolumes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume::class); + $this->secret_volumes = $arr; + + return $this; + } + + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + + /** + * [Preview] Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + * @return int + */ + public function getMaxInstanceRequestConcurrency() + { + return $this->max_instance_request_concurrency; + } + + /** + * [Preview] Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + * @param int $var + * @return $this + */ + public function setMaxInstanceRequestConcurrency($var) + { + GPBUtil::checkInt32($var); + $this->max_instance_request_concurrency = $var; + + return $this; + } + + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + * @return int + */ + public function getSecurityLevel() + { + return $this->security_level; + } + + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + * @param int $var + * @return $this + */ + public function setSecurityLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\SecurityLevel::class); + $this->security_level = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php new file mode 100644 index 000000000000..0dfd22d07834 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php @@ -0,0 +1,73 @@ +google.cloud.functions.v2.ServiceConfig.IngressSettings + */ +class IngressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const INGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Allow HTTP traffic from public and private sources. + * + * Generated from protobuf enum ALLOW_ALL = 1; + */ + const ALLOW_ALL = 1; + /** + * Allow HTTP traffic from only private VPC sources. + * + * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; + */ + const ALLOW_INTERNAL_ONLY = 2; + /** + * Allow HTTP traffic from private VPC sources and through GCLB. + * + * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; + */ + const ALLOW_INTERNAL_AND_GCLB = 3; + + private static $valueToName = [ + self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', + self::ALLOW_ALL => 'ALLOW_ALL', + self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', + self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IngressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_IngressSettings::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php new file mode 100644 index 000000000000..5fb4b8b79894 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.ServiceConfig.SecurityLevel + */ +class SecurityLevel +{ + /** + * Unspecified. + * + * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; + */ + const SECURITY_LEVEL_UNSPECIFIED = 0; + /** + * Requests for a URL that match this handler that do not use HTTPS are + * automatically redirected to the HTTPS URL with the same path. Query + * parameters are reserved for the redirect. + * + * Generated from protobuf enum SECURE_ALWAYS = 1; + */ + const SECURE_ALWAYS = 1; + /** + * Both HTTP and HTTPS requests with URLs that match the handler succeed + * without redirects. The application can examine the request to determine + * which protocol was used and respond accordingly. + * + * Generated from protobuf enum SECURE_OPTIONAL = 2; + */ + const SECURE_OPTIONAL = 2; + + private static $valueToName = [ + self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', + self::SECURE_ALWAYS => 'SECURE_ALWAYS', + self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityLevel::class, \Google\Cloud\Functions\V2\ServiceConfig_SecurityLevel::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php new file mode 100644 index 000000000000..77a3f98e3ae3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings + */ +class VpcConnectorEgressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Use the VPC Access Connector only for private IP space from RFC1918. + * + * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; + */ + const PRIVATE_RANGES_ONLY = 1; + /** + * Force the use of VPC Access Connector for all egress traffic from the + * function. + * + * Generated from protobuf enum ALL_TRAFFIC = 2; + */ + const ALL_TRAFFIC = 2; + + private static $valueToName = [ + self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', + self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', + self::ALL_TRAFFIC => 'ALL_TRAFFIC', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_VpcConnectorEgressSettings::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php new file mode 100644 index 000000000000..c2bf044c6339 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php @@ -0,0 +1,111 @@ +google.cloud.functions.v2.Source + */ +class Source extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\StorageSource $storage_source + * If provided, get the source from this location in Google Cloud Storage. + * @type \Google\Cloud\Functions\V2\RepoSource $repo_source + * If provided, get the source from this location in a Cloud Source + * Repository. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * If provided, get the source from this location in Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getStorageSource() + { + return $this->readOneof(1); + } + + public function hasStorageSource() + { + return $this->hasOneof(1); + } + + /** + * If provided, get the source from this location in Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If provided, get the source from this location in a Cloud Source + * Repository. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; + * @return \Google\Cloud\Functions\V2\RepoSource|null + */ + public function getRepoSource() + { + return $this->readOneof(2); + } + + public function hasRepoSource() + { + return $this->hasOneof(2); + } + + /** + * If provided, get the source from this location in a Cloud Source + * Repository. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; + * @param \Google\Cloud\Functions\V2\RepoSource $var + * @return $this + */ + public function setRepoSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php new file mode 100644 index 000000000000..f49a857e6dae --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php @@ -0,0 +1,130 @@ +google.cloud.functions.v2.SourceProvenance + */ +class SourceProvenance extends \Google\Protobuf\Internal\Message +{ + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + */ + protected $resolved_storage_source = null; + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + */ + protected $resolved_repo_source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\StorageSource $resolved_storage_source + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * @type \Google\Cloud\Functions\V2\RepoSource $resolved_repo_source + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getResolvedStorageSource() + { + return $this->resolved_storage_source; + } + + public function hasResolvedStorageSource() + { + return isset($this->resolved_storage_source); + } + + public function clearResolvedStorageSource() + { + unset($this->resolved_storage_source); + } + + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setResolvedStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->resolved_storage_source = $var; + + return $this; + } + + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + * @return \Google\Cloud\Functions\V2\RepoSource|null + */ + public function getResolvedRepoSource() + { + return $this->resolved_repo_source; + } + + public function hasResolvedRepoSource() + { + return isset($this->resolved_repo_source); + } + + public function clearResolvedRepoSource() + { + unset($this->resolved_repo_source); + } + + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + * @param \Google\Cloud\Functions\V2\RepoSource $var + * @return $this + */ + public function setResolvedRepoSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); + $this->resolved_repo_source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php new file mode 100644 index 000000000000..e965c5a3023b --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php @@ -0,0 +1,237 @@ +google.cloud.functions.v2.Stage + */ +class Stage extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + */ + protected $name = 0; + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + */ + protected $state = 0; + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + */ + protected $resource = ''; + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + */ + protected $resource_uri = ''; + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + */ + private $state_messages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $name + * Name of the Stage. This will be unique for each Stage. + * @type string $message + * Message describing the Stage + * @type int $state + * Current state of the Stage + * @type string $resource + * Resource of the Stage + * @type string $resource_uri + * Link to the current Stage resource + * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages + * State messages from the current Stage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + * @return int + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + * @param int $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\Name::class); + $this->name = $var; + + return $this; + } + + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\State::class); + $this->state = $var; + + return $this; + } + + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + * @return string + */ + public function getResourceUri() + { + return $this->resource_uri; + } + + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + * @param string $var + * @return $this + */ + public function setResourceUri($var) + { + GPBUtil::checkString($var, True); + $this->resource_uri = $var; + + return $this; + } + + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStateMessages() + { + return $this->state_messages; + } + + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStateMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); + $this->state_messages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php new file mode 100644 index 000000000000..6dbaa6f06046 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php @@ -0,0 +1,92 @@ +google.cloud.functions.v2.Stage.Name + */ +class Name +{ + /** + * Not specified. Invalid name. + * + * Generated from protobuf enum NAME_UNSPECIFIED = 0; + */ + const NAME_UNSPECIFIED = 0; + /** + * Artifact Regsitry Stage + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 1; + */ + const ARTIFACT_REGISTRY = 1; + /** + * Build Stage + * + * Generated from protobuf enum BUILD = 2; + */ + const BUILD = 2; + /** + * Service Stage + * + * Generated from protobuf enum SERVICE = 3; + */ + const SERVICE = 3; + /** + * Trigger Stage + * + * Generated from protobuf enum TRIGGER = 4; + */ + const TRIGGER = 4; + /** + * Service Rollback Stage + * + * Generated from protobuf enum SERVICE_ROLLBACK = 5; + */ + const SERVICE_ROLLBACK = 5; + /** + * Trigger Rollback Stage + * + * Generated from protobuf enum TRIGGER_ROLLBACK = 6; + */ + const TRIGGER_ROLLBACK = 6; + + private static $valueToName = [ + self::NAME_UNSPECIFIED => 'NAME_UNSPECIFIED', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + self::BUILD => 'BUILD', + self::SERVICE => 'SERVICE', + self::TRIGGER => 'TRIGGER', + self::SERVICE_ROLLBACK => 'SERVICE_ROLLBACK', + self::TRIGGER_ROLLBACK => 'TRIGGER_ROLLBACK', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Name::class, \Google\Cloud\Functions\V2\Stage_Name::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php new file mode 100644 index 000000000000..5a0be65fc0dc --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.Stage.State + */ +class State +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Stage has not started. + * + * Generated from protobuf enum NOT_STARTED = 1; + */ + const NOT_STARTED = 1; + /** + * Stage is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * Stage has completed. + * + * Generated from protobuf enum COMPLETE = 3; + */ + const COMPLETE = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::NOT_STARTED => 'NOT_STARTED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::COMPLETE => 'COMPLETE', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Functions\V2\Stage_State::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php new file mode 100644 index 000000000000..9e318e5af10f --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php @@ -0,0 +1,135 @@ +google.cloud.functions.v2.StateMessage + */ +class StateMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + */ + protected $severity = 0; + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * The message. + * + * Generated from protobuf field string message = 3; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $severity + * Severity of the state message. + * @type string $type + * One-word CamelCase type of the state message. + * @type string $message + * The message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\StateMessage\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The message. + * + * Generated from protobuf field string message = 3; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * The message. + * + * Generated from protobuf field string message = 3; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php new file mode 100644 index 000000000000..d201473a95e0 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.StateMessage.Severity + */ +class Severity +{ + /** + * Not specified. Invalid severity. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * ERROR-level severity. + * + * Generated from protobuf enum ERROR = 1; + */ + const ERROR = 1; + /** + * WARNING-level severity. + * + * Generated from protobuf enum WARNING = 2; + */ + const WARNING = 2; + /** + * INFO-level severity. + * + * Generated from protobuf enum INFO = 3; + */ + const INFO = 3; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::ERROR => 'ERROR', + self::WARNING => 'WARNING', + self::INFO => 'INFO', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\Functions\V2\StateMessage_Severity::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php new file mode 100644 index 000000000000..b9d4608a89d2 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php @@ -0,0 +1,155 @@ +google.cloud.functions.v2.StorageSource + */ +class StorageSource extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + */ + protected $bucket = ''; + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + */ + protected $object = ''; + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + */ + protected $generation = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $bucket + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * @type string $object + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * @type int|string $generation + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + * @return string + */ + public function getBucket() + { + return $this->bucket; + } + + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + * @param string $var + * @return $this + */ + public function setBucket($var) + { + GPBUtil::checkString($var, True); + $this->bucket = $var; + + return $this; + } + + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + * @return string + */ + public function getObject() + { + return $this->object; + } + + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + * @param string $var + * @return $this + */ + public function setObject($var) + { + GPBUtil::checkString($var, True); + $this->object = $var; + + return $this; + } + + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + * @return int|string + */ + public function getGeneration() + { + return $this->generation; + } + + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + * @param int|string $var + * @return $this + */ + public function setGeneration($var) + { + GPBUtil::checkInt64($var); + $this->generation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php new file mode 100644 index 000000000000..5ca8510a4ef8 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php @@ -0,0 +1,146 @@ +google.cloud.functions.v2.UpdateFunctionRequest + */ +class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Functions\V2\PBFunction $function Required. New version of the function. + * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * + * @return \Google\Cloud\Functions\V2\UpdateFunctionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Functions\V2\PBFunction $function, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setFunction($function) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\PBFunction $function + * Required. New version of the function. + * @type \Google\Protobuf\FieldMask $update_mask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V2\PBFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V2\PBFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); + $this->function = $var; + + return $this; + } + + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @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); + } + + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php new file mode 100644 index 000000000000..9973077ba5d3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php @@ -0,0 +1,88 @@ +setParent($formattedParent) + ->setFunction($function); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->createFunction($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_function_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php new file mode 100644 index 000000000000..d4b706eed552 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php @@ -0,0 +1,82 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->deleteFunction($request); + $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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + delete_function_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php new file mode 100644 index 000000000000..8c67ca295d6e --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var GenerateDownloadUrlResponse $response */ + $response = $functionServiceClient->generateDownloadUrl($request); + 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + generate_download_url_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php new file mode 100644 index 000000000000..ab1292854a03 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php @@ -0,0 +1,94 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var GenerateUploadUrlResponse $response */ + $response = $functionServiceClient->generateUploadUrl($request); + 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 +{ + $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + generate_upload_url_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php new file mode 100644 index 000000000000..eee78f27db80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PBFunction $response */ + $response = $functionServiceClient->getFunction($request); + 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + get_function_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..6a84bd75b393 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $functionServiceClient->getIamPolicy($request); + 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 cloudfunctions_v2_generated_FunctionService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php new file mode 100644 index 000000000000..2211ba2247b3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $functionServiceClient->listFunctions($request); + + /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_functions_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php new file mode 100644 index 000000000000..287d79cf8c32 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @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 cloudfunctions_v2_generated_FunctionService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php new file mode 100644 index 000000000000..aca8dd8c813e --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php @@ -0,0 +1,72 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var ListRuntimesResponse $response */ + $response = $functionServiceClient->listRuntimes($request); + 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 +{ + $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_runtimes_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..97295556fbfc --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $functionServiceClient->setIamPolicy($request); + 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 cloudfunctions_v2_generated_FunctionService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..93d2ca86cb79 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $functionServiceClient->testIamPermissions($request); + 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 cloudfunctions_v2_generated_FunctionService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php new file mode 100644 index 000000000000..600989041e80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php @@ -0,0 +1,71 @@ +setFunction($function); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->updateFunction($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBFunction $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()); + } +} +// [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php new file mode 100644 index 000000000000..b651a22fcc2a --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php @@ -0,0 +1,832 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/function_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * Formats a string containing the fully-qualified path to represent a build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName(string $project, string $location, string $build): string + { + return self::getPathTemplate('build')->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName(string $project, string $location, string $channel): string + { + return self::getPathTemplate('channel')->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName(string $project, string $location, string $connector): string + { + return self::getPathTemplate('connector')->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('cryptoKey')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName(string $project, string $location, string $function): string + { + return self::getPathTemplate('function')->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * 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(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName(string $project, string $location, string $repository): string + { + return self::getPathTemplate('repository')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $location, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName(string $project, string $topic): string + { + return self::getPathTemplate('topic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a trigger + * resource. + * + * @param string $project + * @param string $location + * @param string $trigger + * + * @return string The formatted trigger resource. + */ + public static function triggerName(string $project, string $location, string $trigger): string + { + return self::getPathTemplate('trigger')->render([ + 'project' => $project, + 'location' => $location, + 'trigger' => $trigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName(string $project, string $location, string $workerPool): string + { + return self::getPathTemplate('workerPool')->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - function: projects/{project}/locations/{location}/functions/{function} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - service: projects/{project}/locations/{location}/services/{service} + * - topic: projects/{project}/topics/{topic} + * - trigger: projects/{project}/locations/{location}/triggers/{trigger} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'cloudfunctions.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * The async variant is {@see FunctionServiceClient::createFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/create_function.php + * + * @param CreateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFunction(CreateFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateFunction', $request, $callOptions)->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * The async variant is {@see FunctionServiceClient::deleteFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/delete_function.php + * + * @param DeleteFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteFunction(DeleteFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteFunction', $request, $callOptions)->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * The async variant is {@see FunctionServiceClient::generateDownloadUrlAsync()} . + * + * @example samples/V2/FunctionServiceClient/generate_download_url.php + * + * @param GenerateDownloadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateDownloadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $callOptions = []): GenerateDownloadUrlResponse + { + return $this->startApiCall('GenerateDownloadUrl', $request, $callOptions)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * The async variant is {@see FunctionServiceClient::generateUploadUrlAsync()} . + * + * @example samples/V2/FunctionServiceClient/generate_upload_url.php + * + * @param GenerateUploadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateUploadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateUploadUrl(GenerateUploadUrlRequest $request, array $callOptions = []): GenerateUploadUrlResponse + { + return $this->startApiCall('GenerateUploadUrl', $request, $callOptions)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * The async variant is {@see FunctionServiceClient::getFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/get_function.php + * + * @param GetFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PBFunction + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFunction(GetFunctionRequest $request, array $callOptions = []): PBFunction + { + return $this->startApiCall('GetFunction', $request, $callOptions)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * The async variant is {@see FunctionServiceClient::listFunctionsAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_functions.php + * + * @param ListFunctionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFunctions(ListFunctionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFunctions', $request, $callOptions); + } + + /** + * Returns a list of runtimes that are supported for the requested project. + * + * The async variant is {@see FunctionServiceClient::listRuntimesAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_runtimes.php + * + * @param ListRuntimesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ListRuntimesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listRuntimes(ListRuntimesRequest $request, array $callOptions = []): ListRuntimesResponse + { + return $this->startApiCall('ListRuntimes', $request, $callOptions)->wait(); + } + + /** + * Updates existing function. + * + * The async variant is {@see FunctionServiceClient::updateFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/update_function.php + * + * @param UpdateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateFunction(UpdateFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateFunction', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see FunctionServiceClient::listLocationsAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see FunctionServiceClient::getIamPolicyAsync()} . + * + * @example samples/V2/FunctionServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see FunctionServiceClient::setIamPolicyAsync()} . + * + * @example samples/V2/FunctionServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->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. + * + * The async variant is {@see FunctionServiceClient::testIamPermissionsAsync()} . + * + * @example samples/V2/FunctionServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php new file mode 100644 index 000000000000..8b0aa3f05d5e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php @@ -0,0 +1,34 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); + * $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 = $functionServiceClient->createFunction($formattedParent, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Functions\V2\Client\FunctionServiceClient}. + */ +class FunctionServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.functions.v2.FunctionService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $buildNameTemplate; + + private static $channelNameTemplate; + + private static $connectorNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $functionNameTemplate; + + private static $locationNameTemplate; + + private static $repositoryNameTemplate; + + private static $serviceNameTemplate; + + private static $topicNameTemplate; + + private static $triggerNameTemplate; + + private static $workerPoolNameTemplate; + + 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/function_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getBuildNameTemplate() + { + if (self::$buildNameTemplate == null) { + self::$buildNameTemplate = new PathTemplate('projects/{project}/locations/{location}/builds/{build}'); + } + + return self::$buildNameTemplate; + } + + private static function getChannelNameTemplate() + { + if (self::$channelNameTemplate == null) { + self::$channelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}'); + } + + return self::$channelNameTemplate; + } + + private static function getConnectorNameTemplate() + { + if (self::$connectorNameTemplate == null) { + self::$connectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/connectors/{connector}'); + } + + return self::$connectorNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getFunctionNameTemplate() + { + if (self::$functionNameTemplate == null) { + self::$functionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); + } + + return self::$functionNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRepositoryNameTemplate() + { + if (self::$repositoryNameTemplate == null) { + self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); + } + + return self::$repositoryNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getTopicNameTemplate() + { + if (self::$topicNameTemplate == null) { + self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$topicNameTemplate; + } + + private static function getTriggerNameTemplate() + { + if (self::$triggerNameTemplate == null) { + self::$triggerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/triggers/{trigger}'); + } + + return self::$triggerNameTemplate; + } + + private static function getWorkerPoolNameTemplate() + { + if (self::$workerPoolNameTemplate == null) { + self::$workerPoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workerPools/{worker_pool}'); + } + + return self::$workerPoolNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'build' => self::getBuildNameTemplate(), + 'channel' => self::getChannelNameTemplate(), + 'connector' => self::getConnectorNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'function' => self::getFunctionNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'repository' => self::getRepositoryNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'topic' => self::getTopicNameTemplate(), + 'trigger' => self::getTriggerNameTemplate(), + 'workerPool' => self::getWorkerPoolNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName($project, $location, $build) + { + return self::getBuildNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName($project, $location, $channel) + { + return self::getChannelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName($project, $location, $connector) + { + return self::getConnectorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName($project, $location, $function) + { + return self::getFunctionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * 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 repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName($project, $location, $repository) + { + return self::getRepositoryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName($project, $topic) + { + return self::getTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a trigger + * resource. + * + * @param string $project + * @param string $location + * @param string $trigger + * + * @return string The formatted trigger resource. + */ + public static function triggerName($project, $location, $trigger) + { + return self::getTriggerNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'trigger' => $trigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName($project, $location, $workerPool) + { + return self::getWorkerPoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - function: projects/{project}/locations/{location}/functions/{function} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - service: projects/{project}/locations/{location}/services/{service} + * - topic: projects/{project}/topics/{topic} + * - trigger: projects/{project}/locations/{location}/triggers/{trigger} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'cloudfunctions.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 function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); + * $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 = $functionServiceClient->createFunction($formattedParent, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @param PBFunction $function Required. Function to be created. + * @param array $optionalArgs { + * Optional. + * + * @type string $functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createFunction($parent, $function, array $optionalArgs = []) + { + $request = new CreateFunctionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFunction($function); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['functionId'])) { + $request->setFunctionId($optionalArgs['functionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $operationResponse = $functionServiceClient->deleteFunction($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 = $functionServiceClient->deleteFunction($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'deleteFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which should be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteFunction($name, array $optionalArgs = []) + { + $request = new DeleteFunctionRequest(); + $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $functionServiceClient->generateDownloadUrl($formattedName); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\GenerateDownloadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateDownloadUrl($name, array $optionalArgs = []) + { + $request = new GenerateDownloadUrlRequest(); + $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('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $functionServiceClient->generateUploadUrl($formattedParent); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * @param array $optionalArgs { + * Optional. + * + * @type string $kmsKeyName + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\GenerateUploadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateUploadUrl($parent, array $optionalArgs = []) + { + $request = new GenerateUploadUrlRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['kmsKeyName'])) { + $request->setKmsKeyName($optionalArgs['kmsKeyName']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $functionServiceClient->getFunction($formattedName); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which details should be obtained. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\PBFunction + * + * @throws ApiException if the remote call fails + */ + public function getFunction($name, array $optionalArgs = []) + { + $request = new GetFunctionRequest(); + $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('GetFunction', PBFunction::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 string $filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type string $orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listFunctions($parent, array $optionalArgs = []) + { + $request = new ListFunctionsRequest(); + $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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); + } + + /** + * Returns a list of runtimes that are supported for the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $functionServiceClient->listRuntimes($formattedParent); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\ListRuntimesResponse + * + * @throws ApiException if the remote call fails + */ + public function listRuntimes($parent, array $optionalArgs = []) + { + $request = new ListRuntimesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ListRuntimes', ListRuntimesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates existing function. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->updateFunction($function); + * $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 = $functionServiceClient->updateFunction($function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'updateFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param PBFunction $function Required. New version of the function. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateFunction($function, array $optionalArgs = []) + { + $request = new UpdateFunctionRequest(); + $requestParamHeaders = []; + $request->setFunction($function); + $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $functionServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $functionServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $response = $functionServiceClient->getIamPolicy($resource); + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $functionServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $functionServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $functionServiceClient->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/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json new file mode 100644 index 000000000000..9e109ca2916e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json @@ -0,0 +1,78 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.functions.v2", + "libraryPackage": "Google\\Cloud\\Functions\\V2", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceGapicClient", + "rpcs": { + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json new file mode 100644 index 000000000000..bfc64e4b21e5 --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json @@ -0,0 +1,82 @@ +{ + "interfaces": { + "google.cloud.functions.v2.FunctionService": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateDownloadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateUploadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFunctions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListRuntimes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php new file mode 100644 index 000000000000..b0f8d88bbb90 --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php @@ -0,0 +1,227 @@ + [ + 'google.cloud.functions.v2.FunctionService' => [ + 'CreateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'function.name', + 'fieldAccessors' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\GenerateDownloadUrlResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\GenerateUploadUrlResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\PBFunction', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListFunctions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFunctions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\ListFunctionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\ListRuntimesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'build' => 'projects/{project}/locations/{location}/builds/{build}', + 'channel' => 'projects/{project}/locations/{location}/channels/{channel}', + 'connector' => 'projects/{project}/locations/{location}/connectors/{connector}', + 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', + 'function' => 'projects/{project}/locations/{location}/functions/{function}', + 'location' => 'projects/{project}/locations/{location}', + 'repository' => 'projects/{project}/locations/{location}/repositories/{repository}', + 'service' => 'projects/{project}/locations/{location}/services/{service}', + 'topic' => 'projects/{project}/topics/{topic}', + 'trigger' => 'projects/{project}/locations/{location}/triggers/{trigger}', + 'workerPool' => 'projects/{project}/locations/{location}/workerPools/{worker_pool}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php new file mode 100644 index 000000000000..44d8f539758e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php @@ -0,0 +1,196 @@ + [ + 'google.cloud.functions.v2.FunctionService' => [ + 'CreateFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', + 'body' => 'function', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFunctions' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimes' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/runtimes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{function.name=projects/*/locations/*/functions/*}', + 'body' => 'function', + 'placeholders' => [ + 'function.name' => [ + 'getters' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php new file mode 100644 index 000000000000..4e17ac09f50f --- /dev/null +++ b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php @@ -0,0 +1,1149 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FunctionServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FunctionServiceClient($options); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunction($request); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new DeleteFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFunction($request); + $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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new DeleteFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GenerateDownloadUrlRequest()) + ->setName($formattedName); + $response = $gapicClient->generateDownloadUrl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GenerateDownloadUrlRequest()) + ->setName($formattedName); + try { + $gapicClient->generateDownloadUrl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GenerateUploadUrlRequest()) + ->setParent($formattedParent); + $response = $gapicClient->generateUploadUrl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new GenerateUploadUrlRequest()) + ->setParent($formattedParent); + try { + $gapicClient->generateUploadUrl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GetFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->getFunction($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GetFunctionRequest()) + ->setName($formattedName); + try { + $gapicClient->getFunction($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new PBFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFunctionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listFunctions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new ListFunctionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listFunctions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListRuntimesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRuntimesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRuntimes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new ListRuntimesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRuntimes($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new PBFunction(); + $request = (new UpdateFunctionRequest()) + ->setFunction($function); + $response = $gapicClient->updateFunction($request); + $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new PBFunction(); + $request = (new UpdateFunctionRequest()) + ->setFunction($function); + $response = $gapicClient->updateFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->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); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $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'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $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(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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 = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $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 = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFunctionAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunctionAsync($request)->wait(); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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()); + } +} diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php new file mode 100644 index 000000000000..870c34941734 --- /dev/null +++ b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php @@ -0,0 +1,1009 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FunctionServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FunctionServiceClient($options); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $response = $gapicClient->createFunction($formattedParent, $function); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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]'); + $function = new PBFunction(); + $response = $gapicClient->createFunction($formattedParent, $function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->generateDownloadUrl($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.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->generateDownloadUrl($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 generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->generateUploadUrl($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->generateUploadUrl($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 getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->getFunction($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.functions.v2.FunctionService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->getFunction($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 listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new PBFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listFunctions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->listFunctions($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 listRuntimesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListRuntimesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listRuntimes($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->listRuntimes($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 updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new PBFunction(); + $response = $gapicClient->updateFunction($function); + $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new PBFunction(); + $response = $gapicClient->updateFunction($function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->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()); + } +} From d986cf28b75e67b0a80543bcb0a4224cb14f46ea Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 8 Aug 2024 01:18:31 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- Functions/metadata/V1/Functions.php | Bin 8974 -> 9005 bytes Functions/src/V1/CloudFunction.php | 100 +- .../V1/CloudFunction/OnDeployUpdatePolicy.php | 8 +- Functions/src/V1/HttpsTrigger.php | 8 +- Functions/src/V1/SourceRepository.php | 12 +- .../V1/CloudFunctionsServiceClientTest.php | 6 + .../Google/Cloud/Functions/V1/Functions.php | Bin 9005 -> 0 bytes .../Google/Cloud/Functions/V1/Operations.php | Bin 1271 -> 0 bytes .../Functions/V1/CallFunctionRequest.php | 101 - .../Functions/V1/CallFunctionResponse.php | 143 -- .../Cloud/Functions/V1/CloudFunction.php | 1639 ----------------- .../CloudFunction/AutomaticUpdatePolicy.php | 37 - .../V1/CloudFunction/DockerRegistry.php | 69 - .../V1/CloudFunction/IngressSettings.php | 73 - .../V1/CloudFunction/OnDeployUpdatePolicy.php | 74 - .../VpcConnectorEgressSettings.php | 67 - .../Functions/V1/CloudFunctionStatus.php | 83 - .../Functions/V1/CreateFunctionRequest.php | 115 -- .../Functions/V1/DeleteFunctionRequest.php | 67 - .../Cloud/Functions/V1/EventTrigger.php | 292 --- .../Cloud/Functions/V1/FailurePolicy.php | 76 - .../Functions/V1/FailurePolicy/Retry.php | 40 - .../V1/GenerateDownloadUrlRequest.php | 109 -- .../V1/GenerateDownloadUrlResponse.php | 71 - .../Functions/V1/GenerateUploadUrlRequest.php | 161 -- .../V1/GenerateUploadUrlResponse.php | 75 - .../Cloud/Functions/V1/GetFunctionRequest.php | 121 -- .../Cloud/Functions/V1/HttpsTrigger.php | 101 - .../V1/HttpsTrigger/SecurityLevel.php | 70 - .../Functions/V1/ListFunctionsRequest.php | 167 -- .../Functions/V1/ListFunctionsResponse.php | 151 -- .../Functions/V1/OperationMetadataV1.php | 349 ---- .../Cloud/Functions/V1/OperationType.php | 68 - .../Cloud/Functions/V1/SecretEnvVar.php | 191 -- .../Cloud/Functions/V1/SecretVolume.php | 213 --- .../V1/SecretVolume/SecretVersion.php | 124 -- .../Cloud/Functions/V1/SourceRepository.php | 154 -- .../Functions/V1/UpdateFunctionRequest.php | 121 -- .../call_function.php | 75 - .../create_function.php | 84 - .../delete_function.php | 81 - .../generate_download_url.php | 57 - .../generate_upload_url.php | 77 - .../get_function.php | 70 - .../get_iam_policy.php | 68 - .../list_functions.php | 58 - .../list_locations.php | 58 - .../set_iam_policy.php | 70 - .../test_iam_permissions.php | 77 - .../update_function.php | 68 - .../v1/src/V1/CloudFunctionsServiceClient.php | 34 - .../CloudFunctionsServiceGapicClient.php | 1154 ------------ .../Functions/v1/src/V1/gapic_metadata.json | 78 - ...cloud_functions_service_client_config.json | 105 -- ...ud_functions_service_descriptor_config.php | 79 - ...d_functions_service_rest_client_config.php | 188 -- .../V1/CloudFunctionsServiceClientTest.php | 1091 ----------- .../Google/Cloud/Functions/V2/Functions.php | Bin 11429 -> 0 bytes .../Google/Cloud/Functions/V2/BuildConfig.php | 500 ----- .../V2/BuildConfig/DockerRegistry.php | 69 - .../Functions/V2/CreateFunctionRequest.php | 184 -- .../Functions/V2/DeleteFunctionRequest.php | 81 - .../Google/Cloud/Functions/V2/Environment.php | 61 - .../Google/Cloud/Functions/V2/EventFilter.php | 147 -- .../Cloud/Functions/V2/EventTrigger.php | 378 ---- .../Functions/V2/EventTrigger/RetryPolicy.php | 66 - .../V2/GenerateDownloadUrlRequest.php | 71 - .../V2/GenerateDownloadUrlResponse.php | 71 - .../Functions/V2/GenerateUploadUrlRequest.php | 153 -- .../V2/GenerateUploadUrlResponse.php | 139 -- .../Cloud/Functions/V2/GetFunctionRequest.php | 81 - .../Functions/V2/ListFunctionsRequest.php | 278 --- .../Functions/V2/ListFunctionsResponse.php | 143 -- .../Functions/V2/ListRuntimesRequest.php | 124 -- .../Functions/V2/ListRuntimesResponse.php | 67 - .../V2/ListRuntimesResponse/Runtime.php | 207 --- .../V2/ListRuntimesResponse/RuntimeStage.php | 92 - .../Cloud/Functions/V2/LocationMetadata.php | 67 - .../Cloud/Functions/V2/OperationMetadata.php | 385 ---- .../Google/Cloud/Functions/V2/PBFunction.php | 510 ----- .../Cloud/Functions/V2/PBFunction/State.php | 86 - .../Google/Cloud/Functions/V2/RepoSource.php | 309 ---- .../Cloud/Functions/V2/SecretEnvVar.php | 191 -- .../Cloud/Functions/V2/SecretVolume.php | 203 -- .../V2/SecretVolume/SecretVersion.php | 124 -- .../Cloud/Functions/V2/ServiceConfig.php | 810 -------- .../V2/ServiceConfig/IngressSettings.php | 73 - .../V2/ServiceConfig/SecurityLevel.php | 71 - .../VpcConnectorEgressSettings.php | 67 - .../src/Google/Cloud/Functions/V2/Source.php | 111 -- .../Cloud/Functions/V2/SourceProvenance.php | 130 -- .../src/Google/Cloud/Functions/V2/Stage.php | 237 --- .../Google/Cloud/Functions/V2/Stage/Name.php | 92 - .../Google/Cloud/Functions/V2/Stage/State.php | 71 - .../Cloud/Functions/V2/StateMessage.php | 135 -- .../Functions/V2/StateMessage/Severity.php | 71 - .../Cloud/Functions/V2/StorageSource.php | 155 -- .../Functions/V2/UpdateFunctionRequest.php | 146 -- .../FunctionServiceClient/create_function.php | 88 - .../FunctionServiceClient/delete_function.php | 82 - .../generate_download_url.php | 76 - .../generate_upload_url.php | 94 - .../V2/FunctionServiceClient/get_function.php | 71 - .../FunctionServiceClient/get_iam_policy.php | 72 - .../FunctionServiceClient/list_functions.php | 81 - .../FunctionServiceClient/list_locations.php | 62 - .../FunctionServiceClient/list_runtimes.php | 72 - .../FunctionServiceClient/set_iam_policy.php | 77 - .../test_iam_permissions.php | 84 - .../FunctionServiceClient/update_function.php | 71 - .../src/V2/Client/FunctionServiceClient.php | 832 --------- .../v2/src/V2/FunctionServiceClient.php | 34 - .../V2/Gapic/FunctionServiceGapicClient.php | 1410 -------------- .../Functions/v2/src/V2/gapic_metadata.json | 78 - .../function_service_client_config.json | 82 - .../function_service_descriptor_config.php | 227 --- .../function_service_rest_client_config.php | 196 -- .../V2/Client/FunctionServiceClientTest.php | 1149 ------------ .../Unit/V2/FunctionServiceClientTest.php | 1009 ---------- 119 files changed, 88 insertions(+), 21643 deletions(-) delete mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Operations.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/Gapic/CloudFunctionsServiceGapicClient.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php delete mode 100644 owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/Gapic/FunctionServiceGapicClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php delete mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php delete mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php diff --git a/Functions/metadata/V1/Functions.php b/Functions/metadata/V1/Functions.php index 12f705aea42f0f97cf445e7d750665e7c829a330..8933e0a4c3f52d8552d2fc8b7f0ecec2ccddff9c 100644 GIT binary patch delta 71 zcmeBkTkE!AF$>Fn8!pX>-kO^)u+%X!Zr|+Brp2x-B+Dh5RGOKS5?`EJRF;{X8lRY) boL`z(BB8CosKF^E&LujDS9J3v-WpK=Pwy4x delta 40 wcmZ4M*5|fiF$>EA8!pX>-kO^)u+%X!&e-hFrp3-8CC()}iC1*.google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; */ private $docker_registry = 0; + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + */ + private $build_service_account = ''; protected $source_code; protected $trigger; protected $runtime_update_policy; @@ -411,12 +419,12 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * Input only. An identifier for Firebase function sources. Disclaimer: This * field is only supported for Firebase function deployments. * @type string $docker_repository - * User managed repository created in Artifact Registry optionally with a - * customer managed encryption key. If specified, deployments will use - * Artifact Registry. If unspecified and the deployment is eligible to use - * Artifact Registry, GCF will create and use a repository named - * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -428,9 +436,11 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * If `docker_repository` field is specified, this field should either be left * unspecified or set to `ARTIFACT_REGISTRY`. * @type \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $automatic_update_policy - * See the comment next to this message for more details. * @type \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $on_deploy_update_policy - * See the comment next to this message for more details. + * @type string $build_service_account + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. * } */ public function __construct($data = NULL) { @@ -1440,12 +1450,12 @@ public function setSourceToken($var) } /** - * User managed repository created in Artifact Registry optionally with a - * customer managed encryption key. If specified, deployments will use - * Artifact Registry. If unspecified and the deployment is eligible to use - * Artifact Registry, GCF will create and use a repository named - * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -1461,12 +1471,12 @@ public function getDockerRepository() } /** - * User managed repository created in Artifact Registry optionally with a - * customer managed encryption key. If specified, deployments will use - * Artifact Registry. If unspecified and the deployment is eligible to use - * Artifact Registry, GCF will create and use a repository named - * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -1518,8 +1528,6 @@ public function setDockerRegistry($var) } /** - * See the comment next to this message for more details. - * * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; * @return \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy|null */ @@ -1534,8 +1542,6 @@ public function hasAutomaticUpdatePolicy() } /** - * See the comment next to this message for more details. - * * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; * @param \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $var * @return $this @@ -1549,8 +1555,6 @@ public function setAutomaticUpdatePolicy($var) } /** - * See the comment next to this message for more details. - * * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; * @return \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy|null */ @@ -1565,8 +1569,6 @@ public function hasOnDeployUpdatePolicy() } /** - * See the comment next to this message for more details. - * * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; * @param \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $var * @return $this @@ -1579,6 +1581,36 @@ public function setOnDeployUpdatePolicy($var) return $this; } + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @return string + */ + public function getBuildServiceAccount() + { + return $this->build_service_account; + } + + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @param string $var + * @return $this + */ + public function setBuildServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->build_service_account = $var; + + return $this; + } + /** * @return string */ diff --git a/Functions/src/V1/CloudFunction/OnDeployUpdatePolicy.php b/Functions/src/V1/CloudFunction/OnDeployUpdatePolicy.php index 748e0a1622db..71e7e573eca4 100644 --- a/Functions/src/V1/CloudFunction/OnDeployUpdatePolicy.php +++ b/Functions/src/V1/CloudFunction/OnDeployUpdatePolicy.php @@ -16,7 +16,7 @@ class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message { /** - * Output only. contains the runtime version which was used during latest + * Output only. Contains the runtime version which was used during latest * function deployment. * * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; @@ -30,7 +30,7 @@ class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $runtime_version - * Output only. contains the runtime version which was used during latest + * Output only. Contains the runtime version which was used during latest * function deployment. * } */ @@ -40,7 +40,7 @@ public function __construct($data = NULL) { } /** - * Output only. contains the runtime version which was used during latest + * Output only. Contains the runtime version which was used during latest * function deployment. * * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; @@ -52,7 +52,7 @@ public function getRuntimeVersion() } /** - * Output only. contains the runtime version which was used during latest + * Output only. Contains the runtime version which was used during latest * function deployment. * * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/Functions/src/V1/HttpsTrigger.php b/Functions/src/V1/HttpsTrigger.php index 1fafae709ebe..617101cfe760 100644 --- a/Functions/src/V1/HttpsTrigger.php +++ b/Functions/src/V1/HttpsTrigger.php @@ -16,7 +16,7 @@ class HttpsTrigger extends \Google\Protobuf\Internal\Message { /** - * Output only. The deployed URL for the function. + * Output only. The deployed url for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -35,7 +35,7 @@ class HttpsTrigger extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $url - * Output only. The deployed URL for the function. + * Output only. The deployed url for the function. * @type int $security_level * The security level for the function. * } @@ -46,7 +46,7 @@ public function __construct($data = NULL) { } /** - * Output only. The deployed URL for the function. + * Output only. The deployed url for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return string @@ -57,7 +57,7 @@ public function getUrl() } /** - * Output only. The deployed URL for the function. + * Output only. The deployed url for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param string $var diff --git a/Functions/src/V1/SourceRepository.php b/Functions/src/V1/SourceRepository.php index 470d86b1e531..aad0d966fd9c 100644 --- a/Functions/src/V1/SourceRepository.php +++ b/Functions/src/V1/SourceRepository.php @@ -27,7 +27,8 @@ class SourceRepository extends \Google\Protobuf\Internal\Message * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. * * Generated from protobuf field string url = 1; */ @@ -58,7 +59,8 @@ class SourceRepository extends \Google\Protobuf\Internal\Message * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. * @type string $deployed_url * Output only. The URL pointing to the hosted repository where the function * were defined at the time of deployment. It always points to a specific @@ -81,7 +83,8 @@ public function __construct($data = NULL) { * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. * * Generated from protobuf field string url = 1; * @return string @@ -102,7 +105,8 @@ public function getUrl() * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. * * Generated from protobuf field string url = 1; * @param string $var diff --git a/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php index 38c87818babc..e33cb03bdc93 100644 --- a/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php +++ b/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php @@ -179,6 +179,7 @@ public function createFunctionTest() $buildName = 'buildName-470597188'; $sourceToken = 'sourceToken1671283925'; $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; $expectedResponse = new CloudFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); @@ -198,6 +199,7 @@ public function createFunctionTest() $expectedResponse->setBuildName($buildName); $expectedResponse->setSourceToken($sourceToken); $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -549,6 +551,7 @@ public function getFunctionTest() $buildName = 'buildName-470597188'; $sourceToken = 'sourceToken1671283925'; $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; $expectedResponse = new CloudFunction(); $expectedResponse->setName($name2); $expectedResponse->setDescription($description); @@ -568,6 +571,7 @@ public function getFunctionTest() $expectedResponse->setBuildName($buildName); $expectedResponse->setSourceToken($sourceToken); $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); @@ -907,6 +911,7 @@ public function updateFunctionTest() $buildName = 'buildName-470597188'; $sourceToken = 'sourceToken1671283925'; $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; $expectedResponse = new CloudFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); @@ -926,6 +931,7 @@ public function updateFunctionTest() $expectedResponse->setBuildName($buildName); $expectedResponse->setSourceToken($sourceToken); $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php b/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php deleted file mode 100644 index 8933e0a4c3f52d8552d2fc8b7f0ecec2ccddff9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9005 zcmbtaOLN=S6%Hj!mag8A718t~G@Le)Vv)6+*HE?-@Fg>*NtUGKaYi!;1YSvqKmY|m z*@~-8H=Qo~n(jN@^cQrdn`}E?bdl~d(`h=>RenNNJ@*9yq(oDR7Z!SS;&`~ zw}8~MJFbp1$phOyFmYNp?M^Gb-?4Pxuq`ire7E~0MY$qmX>IH|nvRoOwd@n@Yc0*! zcDE>l-5g=CTNDg-ckXT?q??-OC4-0PB}&3Sr?Y1odeZYXAO5^;c&cF;zM+}Mmte_* z<2C+PgYjBSi;WOPp&W>GnqamA0&OZgTvC3Nf-Ma*V?3d69%Wjr`Dts~aUNmLG_d7gjHYN{vz5h%+Oc7~7bC4>9xg*G*&hzORfojt#cVBU zZHS~@_*1hXW=@7zn^RtttZZ8cZpX3=>);0|9K>9{!;BqXB<344Y|iMK)v`y{s2Js#YA1815hlrE28zO;6}YIYE&eD6)Z*U;Jo z7U7TT&|u{2iRgM{?KWRCyJ3|+SAfIuD&69-!v$R9OoDYxqJu9A01pioL792K3GGS$v3;>$0w z4^4F(DDPOM!l$XMM4zmth$LpiGD64L^&m)8qZOY8qEWVxN8_LdHof>yTyfHwh!@3v?s$Sj7i`fS&4M--puX#g}2*>_%>AOLiPRCu9^TuLfr& z)zLh#jIxhY_8$$+zQh;=Jny6Fqqe6W;S-et(N$tq_NU(~x6v&cGqB2;1G;-D=yTIK z_XIk-$M{6LiWb-@64zoEQpz^t3F??7G{Kf2K(A4zH2WZO*<&j0R(IhEy6#~eI=gcs z;s%X~fq>JX^biFQYtqMPmh(Hd%?=dY_|0KC>`($QZkj`@Zy#YR{+3YolJqHBXxTck zIE1<~T~B|n+(B!a>l^!;?z{NF@F1mnUD!olsfOkPUTkyxHgKBV_;Bb$%~M_KTo$D7 zvexnKHtG6RjxMZN##eyz)W*Z1IV*zCHU%lx_N3p~vx_Um?ypH%2bTc~`u3p1I?x4f~m{>=vJGGpet5zz7T(eqN z3tROJ_ETq>VrkUG7;> zDtUD)SI*9l%Acdzo)~`%UCUQT@OANr9|5pfMq<{y(f*Of zxBQP7nhy74(tL=JwGK}xV0K)?KT%ES)Jz)hvm5UZ$mB4~6u>W~E)!z;DVm8qkZz(x zqmbLKmzvMia$%=X?m4gpARy}nh?J+wvj&{iBAVlmsIaesp#p`mm0R`7ML@v?~MbEiwWIgR+ihA`hVEj6nf| z2ArJ7)WG&MLYS%(sz+}mE~7E}F*||Ap?W}nC)dz)q^?D<0ZiwyNBTf^Uzmj^nHEBB zCm1dOkK79;<*&ejj3qC0z@<$aQ%Ca;c`OaXc?(T&&K_JjNV_>GR>C4ltbnI>SPz>> z(OBs|Anmx&nT0molc;jkMEQ>~w3Kr(bj>0g>-ZNPxKm4;XhI|&GbFqEtujKp8S%WY zohkFAh2xtL2}*rAwJ|6bBJDFtp%M8vpcgA+y?TXNv*5TGYbhPv6Uc>=tJi-|2*wh! zgQP9&_v)d9@0;0s)HmxF!@cO;gB%FGd&HnBT`5DeBSd=QOg=#4j^;vw@)Kdr#o9WEcC#hhlE!mq-uKc2I+fG&~AG6N14 z!jI9Fs4(u!D`*|rk=avEJdLlV~=q9!!bpqk4MQ9=;p?dKL5c!ZRTj%9$Jqme+_OY%K* z?M(WvyIPzroug2pYrl)ZQHGlcHkXiof^Ox?)$P1m+^*zEp;H@8rMcbPsUb8DT}x@F z0HtvXU9J|3W$13^MUCH*Carb2iptq%|!+9&iJ8W-gI-zaos7g3X3X3tSF)c&oVO8<$W*=XgG z2DvD@RVaHy*cKXgrh=ir{L5F$+r4wf#b8;yPTINqjj|v>_>RCyYSpHkrp_0u=U5hU zel5h*sC5ul0Wwi)!YzgG!D!4o&?0m2!ion*i6|d)C)VioQb1q|?uzKj)eTvlSRv z9m{uRyp-2FE;U8Q$ zdz*o}&fcF#Mz?as?-ct&^IIioPF^zy3P!~ShM7_D?d0@3<;5_=_QtS+V02k0?;g@G z$yncokEdx}%{{=f~yiVN^c}lL%JwEsN+q zCjlo+Q0_^nq7a(r=;iMPu%#nW#OR`8Y=C8fxV#aw1WV;L<2_gsR}7mA z@@wO$Y~6dLrP;a?Z@dO89Dh%xIp(5lT|e3`S_?^*blflim|&jBfcHsgE=lB~VT1LQ z$yDRM5^X-r+IQ#Lwe`j(SRJG!3Khk&M6Vg!;8DI?eL=tB*j&k~@~|AIcF0^+wL=0P z-xj_Do_0L$?4BuU%Jw&5|niyvD8Kf+{xL z&+aU8@#F`1CVvIR9P^iUV(P`!l9DW+Ug>K!#~1d~u|1+QzY4^N{9EVgoogle.cloud.functions.v1.CallFunctionRequest - */ -class CallFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function to be called. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $data = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function to be called. - * @type string $data - * Required. Input to be passed to the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function to be called. - * - * 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 function to be called. - * - * 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; - } - - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getData() - { - return $this->data; - } - - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setData($var) - { - GPBUtil::checkString($var, True); - $this->data = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php deleted file mode 100644 index bb7004f8e9d2..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.functions.v1.CallFunctionResponse - */ -class CallFunctionResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - */ - protected $execution_id = ''; - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - */ - protected $result = ''; - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - */ - protected $error = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $execution_id - * Execution id of function invocation. - * @type string $result - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * @type string $error - * Either system or user-function generated error. Set if execution - * was not successful. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - * @return string - */ - public function getExecutionId() - { - return $this->execution_id; - } - - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - * @param string $var - * @return $this - */ - public function setExecutionId($var) - { - GPBUtil::checkString($var, True); - $this->execution_id = $var; - - return $this; - } - - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - * @return string - */ - public function getResult() - { - return $this->result; - } - - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - * @param string $var - * @return $this - */ - public function setResult($var) - { - GPBUtil::checkString($var, True); - $this->result = $var; - - return $this; - } - - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - * @return string - */ - public function getError() - { - return $this->error; - } - - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - * @param string $var - * @return $this - */ - public function setError($var) - { - GPBUtil::checkString($var, True); - $this->error = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php deleted file mode 100644 index dcb6a3476b51..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php +++ /dev/null @@ -1,1639 +0,0 @@ -google.cloud.functions.v1.CloudFunction - */ -class CloudFunction extends \Google\Protobuf\Internal\Message -{ - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $status = 0; - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - */ - protected $entry_point = ''; - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - */ - protected $runtime = ''; - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - */ - protected $timeout = null; - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - */ - protected $available_memory_mb = 0; - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - */ - protected $service_account_email = ''; - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $version_id = 0; - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - */ - private $labels; - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - */ - private $environment_variables; - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - */ - private $build_environment_variables; - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @deprecated - */ - protected $network = ''; - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - */ - protected $max_instances = 0; - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - */ - protected $min_instances = 0; - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - */ - protected $vpc_connector = ''; - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - */ - protected $vpc_connector_egress_settings = 0; - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - */ - protected $ingress_settings = 0; - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - */ - protected $build_worker_pool = ''; - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $build_id = ''; - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $build_name = ''; - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - */ - private $secret_environment_variables; - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - */ - private $secret_volumes; - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $source_token = ''; - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - */ - protected $docker_repository = ''; - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - */ - protected $docker_registry = 0; - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - */ - protected $build_service_account = ''; - protected $source_code; - protected $trigger; - protected $runtime_update_policy; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * @type string $description - * User-provided description of a function. - * @type string $source_archive_url - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * @type \Google\Cloud\Functions\V1\SourceRepository $source_repository - * **Beta Feature** - * The source repository where a function is hosted. - * @type string $source_upload_url - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * @type \Google\Cloud\Functions\V1\HttpsTrigger $https_trigger - * An HTTPS endpoint type of source that can be triggered via URL. - * @type \Google\Cloud\Functions\V1\EventTrigger $event_trigger - * A source that fires events in response to a condition in another service. - * @type int $status - * Output only. Status of the function deployment. - * @type string $entry_point - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * @type string $runtime - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * @type \Google\Protobuf\Duration $timeout - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * @type int $available_memory_mb - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * @type string $service_account_email - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The last update timestamp of a Cloud Function. - * @type int|string $version_id - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels associated with this Cloud Function. - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * Environment variables that shall be available during function execution. - * @type array|\Google\Protobuf\Internal\MapField $build_environment_variables - * Build environment variables that shall be available during build time. - * @type string $network - * Deprecated: use vpc_connector - * @type int $max_instances - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * @type int $min_instances - * A lower bound for the number function instances that may coexist at a - * given time. - * @type string $vpc_connector - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * @type int $vpc_connector_egress_settings - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * @type int $ingress_settings - * The ingress settings for the function, controlling what traffic can reach - * it. - * @type string $kms_key_name - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * @type string $build_worker_pool - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * @type string $build_id - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * @type string $build_name - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * @type array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables - * Secret environment variables configuration. - * @type array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes - * Secret volumes configuration. - * @type string $source_token - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * @type string $docker_repository - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * @type int $docker_registry - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * @type \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $automatic_update_policy - * @type \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $on_deploy_update_policy - * @type string $build_service_account - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * - * Generated from protobuf field string source_archive_url = 3; - * @return string - */ - public function getSourceArchiveUrl() - { - return $this->readOneof(3); - } - - public function hasSourceArchiveUrl() - { - return $this->hasOneof(3); - } - - /** - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * - * Generated from protobuf field string source_archive_url = 3; - * @param string $var - * @return $this - */ - public function setSourceArchiveUrl($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * **Beta Feature** - * The source repository where a function is hosted. - * - * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; - * @return \Google\Cloud\Functions\V1\SourceRepository|null - */ - public function getSourceRepository() - { - return $this->readOneof(4); - } - - public function hasSourceRepository() - { - return $this->hasOneof(4); - } - - /** - * **Beta Feature** - * The source repository where a function is hosted. - * - * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; - * @param \Google\Cloud\Functions\V1\SourceRepository $var - * @return $this - */ - public function setSourceRepository($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\SourceRepository::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * - * Generated from protobuf field string source_upload_url = 16; - * @return string - */ - public function getSourceUploadUrl() - { - return $this->readOneof(16); - } - - public function hasSourceUploadUrl() - { - return $this->hasOneof(16); - } - - /** - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * - * Generated from protobuf field string source_upload_url = 16; - * @param string $var - * @return $this - */ - public function setSourceUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(16, $var); - - return $this; - } - - /** - * An HTTPS endpoint type of source that can be triggered via URL. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; - * @return \Google\Cloud\Functions\V1\HttpsTrigger|null - */ - public function getHttpsTrigger() - { - return $this->readOneof(5); - } - - public function hasHttpsTrigger() - { - return $this->hasOneof(5); - } - - /** - * An HTTPS endpoint type of source that can be triggered via URL. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; - * @param \Google\Cloud\Functions\V1\HttpsTrigger $var - * @return $this - */ - public function setHttpsTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\HttpsTrigger::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * A source that fires events in response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; - * @return \Google\Cloud\Functions\V1\EventTrigger|null - */ - public function getEventTrigger() - { - return $this->readOneof(6); - } - - public function hasEventTrigger() - { - return $this->hasOneof(6); - } - - /** - * A source that fires events in response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; - * @param \Google\Cloud\Functions\V1\EventTrigger $var - * @return $this - */ - public function setEventTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\EventTrigger::class); - $this->writeOneof(6, $var); - - return $this; - } - - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getStatus() - { - return $this->status; - } - - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setStatus($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunctionStatus::class); - $this->status = $var; - - return $this; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - * @return string - */ - public function getEntryPoint() - { - return $this->entry_point; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - * @param string $var - * @return $this - */ - public function setEntryPoint($var) - { - GPBUtil::checkString($var, True); - $this->entry_point = $var; - - return $this; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - * @return string - */ - public function getRuntime() - { - return $this->runtime; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - * @param string $var - * @return $this - */ - public function setRuntime($var) - { - GPBUtil::checkString($var, True); - $this->runtime = $var; - - return $this; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - * @return \Google\Protobuf\Duration|null - */ - public function getTimeout() - { - return $this->timeout; - } - - public function hasTimeout() - { - return isset($this->timeout); - } - - public function clearTimeout() - { - unset($this->timeout); - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setTimeout($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->timeout = $var; - - return $this; - } - - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - * @return int - */ - public function getAvailableMemoryMb() - { - return $this->available_memory_mb; - } - - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - * @param int $var - * @return $this - */ - public function setAvailableMemoryMb($var) - { - GPBUtil::checkInt32($var); - $this->available_memory_mb = $var; - - return $this; - } - - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; - } - - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - * @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; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - * @return \Google\Protobuf\Internal\MapField - */ - public function getBuildEnvironmentVariables() - { - return $this->build_environment_variables; - } - - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setBuildEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->build_environment_variables = $arr; - - return $this; - } - - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @return string - * @deprecated - */ - public function getNetwork() - { - @trigger_error('network is deprecated.', E_USER_DEPRECATED); - return $this->network; - } - - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @param string $var - * @return $this - * @deprecated - */ - public function setNetwork($var) - { - @trigger_error('network is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->network = $var; - - return $this; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - * @return int - */ - public function getMaxInstances() - { - return $this->max_instances; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - * @param int $var - * @return $this - */ - public function setMaxInstances($var) - { - GPBUtil::checkInt32($var); - $this->max_instances = $var; - - return $this; - } - - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - * @return int - */ - public function getMinInstances() - { - return $this->min_instances; - } - - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - * @param int $var - * @return $this - */ - public function setMinInstances($var) - { - GPBUtil::checkInt32($var); - $this->min_instances = $var; - - return $this; - } - - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - * @return string - */ - public function getVpcConnector() - { - return $this->vpc_connector; - } - - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - * @param string $var - * @return $this - */ - public function setVpcConnector($var) - { - GPBUtil::checkString($var, True); - $this->vpc_connector = $var; - - return $this; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - * @return int - */ - public function getVpcConnectorEgressSettings() - { - return $this->vpc_connector_egress_settings; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - * @param int $var - * @return $this - */ - public function setVpcConnectorEgressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\VpcConnectorEgressSettings::class); - $this->vpc_connector_egress_settings = $var; - - return $this; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - * @return int - */ - public function getIngressSettings() - { - return $this->ingress_settings; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - * @param int $var - * @return $this - */ - public function setIngressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\IngressSettings::class); - $this->ingress_settings = $var; - - return $this; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - * @return string - */ - public function getBuildWorkerPool() - { - return $this->build_worker_pool; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - * @param string $var - * @return $this - */ - public function setBuildWorkerPool($var) - { - GPBUtil::checkString($var, True); - $this->build_worker_pool = $var; - - return $this; - } - - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getBuildId() - { - return $this->build_id; - } - - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setBuildId($var) - { - GPBUtil::checkString($var, True); - $this->build_id = $var; - - return $this; - } - - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getBuildName() - { - return $this->build_name; - } - - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setBuildName($var) - { - GPBUtil::checkString($var, True); - $this->build_name = $var; - - return $this; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretEnvironmentVariables() - { - return $this->secret_environment_variables; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - * @param array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretEnvironmentVariables($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretEnvVar::class); - $this->secret_environment_variables = $arr; - - return $this; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretVolumes() - { - return $this->secret_volumes; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - * @param array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretVolumes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume::class); - $this->secret_volumes = $arr; - - return $this; - } - - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return string - */ - public function getSourceToken() - { - return $this->source_token; - } - - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setSourceToken($var) - { - GPBUtil::checkString($var, True); - $this->source_token = $var; - - return $this; - } - - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - * @return string - */ - public function getDockerRepository() - { - return $this->docker_repository; - } - - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDockerRepository($var) - { - GPBUtil::checkString($var, True); - $this->docker_repository = $var; - - return $this; - } - - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - * @return int - */ - public function getDockerRegistry() - { - return $this->docker_registry; - } - - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - * @param int $var - * @return $this - */ - public function setDockerRegistry($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\DockerRegistry::class); - $this->docker_registry = $var; - - return $this; - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; - * @return \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy|null - */ - public function getAutomaticUpdatePolicy() - { - return $this->readOneof(40); - } - - public function hasAutomaticUpdatePolicy() - { - return $this->hasOneof(40); - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; - * @param \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $var - * @return $this - */ - public function setAutomaticUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy::class); - $this->writeOneof(40, $var); - - return $this; - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @return \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy|null - */ - public function getOnDeployUpdatePolicy() - { - return $this->readOneof(41); - } - - public function hasOnDeployUpdatePolicy() - { - return $this->hasOneof(41); - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @param \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $var - * @return $this - */ - public function setOnDeployUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy::class); - $this->writeOneof(41, $var); - - return $this; - } - - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - * @return string - */ - public function getBuildServiceAccount() - { - return $this->build_service_account; - } - - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - * @param string $var - * @return $this - */ - public function setBuildServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->build_service_account = $var; - - return $this; - } - - /** - * @return string - */ - public function getSourceCode() - { - return $this->whichOneof("source_code"); - } - - /** - * @return string - */ - public function getTrigger() - { - return $this->whichOneof("trigger"); - } - - /** - * @return string - */ - public function getRuntimeUpdatePolicy() - { - return $this->whichOneof("runtime_update_policy"); - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php deleted file mode 100644 index 02f5ae78823a..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php +++ /dev/null @@ -1,37 +0,0 @@ -google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy - */ -class AutomaticUpdatePolicy extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AutomaticUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_AutomaticUpdatePolicy::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php deleted file mode 100644 index 0dc3a8279ff9..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.functions.v1.CloudFunction.DockerRegistry - */ -class DockerRegistry -{ - /** - * Unspecified. - * - * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; - */ - const DOCKER_REGISTRY_UNSPECIFIED = 0; - /** - * Docker images will be stored in multi-regional Container Registry - * repositories named `gcf`. - * - * Generated from protobuf enum CONTAINER_REGISTRY = 1; - */ - const CONTAINER_REGISTRY = 1; - /** - * Docker images will be stored in regional Artifact Registry repositories. - * By default, GCF will create and use repositories named `gcf-artifacts` - * in every region in which a function is deployed. But the repository to - * use can also be specified by the user using the `docker_repository` - * field. - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 2; - */ - const ARTIFACT_REGISTRY = 2; - - private static $valueToName = [ - self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', - self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DockerRegistry::class, \Google\Cloud\Functions\V1\CloudFunction_DockerRegistry::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php deleted file mode 100644 index f01e9ad97124..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.functions.v1.CloudFunction.IngressSettings - */ -class IngressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const INGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Allow HTTP traffic from public and private sources. - * - * Generated from protobuf enum ALLOW_ALL = 1; - */ - const ALLOW_ALL = 1; - /** - * Allow HTTP traffic from only private VPC sources. - * - * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; - */ - const ALLOW_INTERNAL_ONLY = 2; - /** - * Allow HTTP traffic from private VPC sources and through GCLB. - * - * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; - */ - const ALLOW_INTERNAL_AND_GCLB = 3; - - private static $valueToName = [ - self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', - self::ALLOW_ALL => 'ALLOW_ALL', - self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', - self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IngressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_IngressSettings::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php deleted file mode 100644 index 1183812ad6bb..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php +++ /dev/null @@ -1,74 +0,0 @@ -google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy - */ -class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $runtime_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $runtime_version - * Output only. Contains the runtime version which was used during latest - * function deployment. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRuntimeVersion() - { - return $this->runtime_version; - } - - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRuntimeVersion($var) - { - GPBUtil::checkString($var, True); - $this->runtime_version = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(OnDeployUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_OnDeployUpdatePolicy::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php deleted file mode 100644 index a357c173fb54..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings - */ -class VpcConnectorEgressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Use the VPC Access Connector only for private IP space from RFC1918. - * - * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; - */ - const PRIVATE_RANGES_ONLY = 1; - /** - * Force the use of VPC Access Connector for all egress traffic from the - * function. - * - * Generated from protobuf enum ALL_TRAFFIC = 2; - */ - const ALL_TRAFFIC = 2; - - private static $valueToName = [ - self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', - self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', - self::ALL_TRAFFIC => 'ALL_TRAFFIC', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_VpcConnectorEgressSettings::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php deleted file mode 100644 index 50cab779a116..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php +++ /dev/null @@ -1,83 +0,0 @@ -google.cloud.functions.v1.CloudFunctionStatus - */ -class CloudFunctionStatus -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - */ - const CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - /** - * Function has been successfully deployed and is serving. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Function deployment failed and the function isn’t serving. - * - * Generated from protobuf enum OFFLINE = 2; - */ - const OFFLINE = 2; - /** - * Function is being created or updated. - * - * Generated from protobuf enum DEPLOY_IN_PROGRESS = 3; - */ - const DEPLOY_IN_PROGRESS = 3; - /** - * Function is being deleted. - * - * Generated from protobuf enum DELETE_IN_PROGRESS = 4; - */ - const DELETE_IN_PROGRESS = 4; - /** - * Function deployment failed and the function serving state is undefined. - * The function should be updated or deleted to move it out of this state. - * - * Generated from protobuf enum UNKNOWN = 5; - */ - const UNKNOWN = 5; - - private static $valueToName = [ - self::CLOUD_FUNCTION_STATUS_UNSPECIFIED => 'CLOUD_FUNCTION_STATUS_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::OFFLINE => 'OFFLINE', - self::DEPLOY_IN_PROGRESS => 'DEPLOY_IN_PROGRESS', - self::DELETE_IN_PROGRESS => 'DELETE_IN_PROGRESS', - self::UNKNOWN => 'UNKNOWN', - ]; - - 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php deleted file mode 100644 index cb11a65978b1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php +++ /dev/null @@ -1,115 +0,0 @@ -google.cloud.functions.v1.CreateFunctionRequest - */ -class CreateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $location = ''; - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $location - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @type \Google\Cloud\Functions\V1\CloudFunction $function - * Required. Function to be created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setLocation($var) - { - GPBUtil::checkString($var, True); - $this->location = $var; - - return $this; - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V1\CloudFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V1\CloudFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->function = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php deleted file mode 100644 index 9fa98e38b5ea..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v1.DeleteFunctionRequest - */ -class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which should be deleted. - * - * 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. The name of the function which should be deleted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which should be deleted. - * - * 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 function which should be deleted. - * - * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php deleted file mode 100644 index a85d3f80fc84..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php +++ /dev/null @@ -1,292 +0,0 @@ -google.cloud.functions.v1.EventTrigger - */ -class EventTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - */ - protected $event_type = ''; - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - */ - protected $resource = ''; - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - */ - protected $service = ''; - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - */ - protected $failure_policy = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $event_type - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * @type string $resource - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * @type string $service - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * @type \Google\Cloud\Functions\V1\FailurePolicy $failure_policy - * Specifies policy for failed executions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - * @return string - */ - public function getEventType() - { - return $this->event_type; - } - - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - * @param string $var - * @return $this - */ - public function setEventType($var) - { - GPBUtil::checkString($var, True); - $this->event_type = $var; - - return $this; - } - - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - * @return string - */ - public function getResource() - { - return $this->resource; - } - - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - * @param string $var - * @return $this - */ - public function setResource($var) - { - GPBUtil::checkString($var, True); - $this->resource = $var; - - return $this; - } - - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - * @return string - */ - public function getService() - { - return $this->service; - } - - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - * @param string $var - * @return $this - */ - public function setService($var) - { - GPBUtil::checkString($var, True); - $this->service = $var; - - return $this; - } - - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - * @return \Google\Cloud\Functions\V1\FailurePolicy|null - */ - public function getFailurePolicy() - { - return $this->failure_policy; - } - - public function hasFailurePolicy() - { - return isset($this->failure_policy); - } - - public function clearFailurePolicy() - { - unset($this->failure_policy); - } - - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - * @param \Google\Cloud\Functions\V1\FailurePolicy $var - * @return $this - */ - public function setFailurePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy::class); - $this->failure_policy = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php deleted file mode 100644 index f81b50f6d779..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php +++ /dev/null @@ -1,76 +0,0 @@ -google.cloud.functions.v1.FailurePolicy - */ -class FailurePolicy extends \Google\Protobuf\Internal\Message -{ - protected $action; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry - * If specified, then the function will be retried in case of a failure. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * If specified, then the function will be retried in case of a failure. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; - * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null - */ - public function getRetry() - { - return $this->readOneof(1); - } - - public function hasRetry() - { - return $this->hasOneof(1); - } - - /** - * If specified, then the function will be retried in case of a failure. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; - * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var - * @return $this - */ - public function setRetry($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy\Retry::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getAction() - { - return $this->whichOneof("action"); - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php deleted file mode 100644 index a2188ed7d6ef..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php +++ /dev/null @@ -1,40 +0,0 @@ -google.cloud.functions.v1.FailurePolicy.Retry - */ -class Retry extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Retry::class, \Google\Cloud\Functions\V1\FailurePolicy_Retry::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php deleted file mode 100644 index 072629f3be02..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.functions.v1.GenerateDownloadUrlRequest - */ -class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - */ - protected $version_id = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @type int|string $version_id - * The optional version of function. If not set, default, current version - * is used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkUint64($var); - $this->version_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php deleted file mode 100644 index 54d5d55e458f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v1.GenerateDownloadUrlResponse - */ -class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - */ - protected $download_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $download_url - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @return string - */ - public function getDownloadUrl() - { - return $this->download_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @param string $var - * @return $this - */ - public function setDownloadUrl($var) - { - GPBUtil::checkString($var, True); - $this->download_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php deleted file mode 100644 index 94a0f06d4816..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php +++ /dev/null @@ -1,161 +0,0 @@ -google.cloud.functions.v1.GenerateUploadUrlRequest - */ -class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - */ - protected $parent = ''; - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * @type string $kms_key_name - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php deleted file mode 100644 index 41557ee9aa0e..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php +++ /dev/null @@ -1,75 +0,0 @@ -google.cloud.functions.v1.GenerateUploadUrlResponse - */ -class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - */ - protected $upload_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $upload_url - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @return string - */ - public function getUploadUrl() - { - return $this->upload_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @param string $var - * @return $this - */ - public function setUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->upload_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php deleted file mode 100644 index 72f3e59339fc..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.functions.v1.GetFunctionRequest - */ -class GetFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which details should be obtained. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $version_id = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which details should be obtained. - * @type int|string $version_id - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which details should be obtained. - * - * 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 function which details should be obtained. - * - * 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. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php deleted file mode 100644 index 24ca96c54a24..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.functions.v1.HttpsTrigger - */ -class HttpsTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $url = ''; - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - */ - protected $security_level = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $url - * Output only. The deployed url for the function. - * @type int $security_level - * The security level for the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - * @return int - */ - public function getSecurityLevel() - { - return $this->security_level; - } - - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - * @param int $var - * @return $this - */ - public function setSecurityLevel($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\HttpsTrigger\SecurityLevel::class); - $this->security_level = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php deleted file mode 100644 index 26f38ca940f8..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php +++ /dev/null @@ -1,70 +0,0 @@ -google.cloud.functions.v1.HttpsTrigger.SecurityLevel - */ -class SecurityLevel -{ - /** - * Unspecified. - * - * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; - */ - const SECURITY_LEVEL_UNSPECIFIED = 0; - /** - * Requests for a URL that match this handler that do not use HTTPS are - * automatically redirected to the HTTPS URL with the same path. Query - * parameters are reserved for the redirect. - * - * Generated from protobuf enum SECURE_ALWAYS = 1; - */ - const SECURE_ALWAYS = 1; - /** - * Both HTTP and HTTPS requests with URLs that match the handler succeed - * without redirects. The application can examine the request to determine - * which protocol was used and respond accordingly. - * - * Generated from protobuf enum SECURE_OPTIONAL = 2; - */ - const SECURE_OPTIONAL = 2; - - private static $valueToName = [ - self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', - self::SECURE_ALWAYS => 'SECURE_ALWAYS', - self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecurityLevel::class, \Google\Cloud\Functions\V1\HttpsTrigger_SecurityLevel::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php deleted file mode 100644 index 31a224ea16e1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php +++ /dev/null @@ -1,167 +0,0 @@ -google.cloud.functions.v1.ListFunctionsRequest - */ -class ListFunctionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Maximum number of functions to return per call. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @type int $page_size - * Maximum number of functions to return per call. - * @type string $page_token - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.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 functions to return per call. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of functions 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php deleted file mode 100644 index 354f44b97f4e..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php +++ /dev/null @@ -1,151 +0,0 @@ -google.cloud.functions.v1.ListFunctionsResponse - */ -class ListFunctionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - */ - private $functions; - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Locations that could not be reached. The response does not include any - * functions from these locations. - * - * 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\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $functions - * The functions that match the request. - * @type string $next_page_token - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. The response does not include any - * functions from these locations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - * @param array<\Google\Cloud\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setFunctions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->functions = $arr; - - return $this; - } - - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * 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. The response does not include any - * functions from these locations. - * - * 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. The response does not include any - * functions from these locations. - * - * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php deleted file mode 100644 index 0f72c0be190f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php +++ /dev/null @@ -1,349 +0,0 @@ -google.cloud.functions.v1.OperationMetadataV1 - */ -class OperationMetadataV1 extends \Google\Protobuf\Internal\Message -{ - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - */ - protected $target = ''; - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - */ - protected $type = 0; - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - */ - protected $request = null; - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - */ - protected $version_id = 0; - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - */ - protected $update_time = null; - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - */ - protected $build_id = ''; - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - */ - protected $source_token = ''; - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - */ - protected $build_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $target - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * @type int $type - * Type of operation. - * @type \Google\Protobuf\Any $request - * The original request that started the operation. - * @type int|string $version_id - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * @type \Google\Protobuf\Timestamp $update_time - * The last update timestamp of the operation. - * @type string $build_id - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * @type string $source_token - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * @type string $build_name - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Operations::initOnce(); - parent::__construct($data); - } - - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\OperationType::class); - $this->type = $var; - - return $this; - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - * @return \Google\Protobuf\Any|null - */ - public function getRequest() - { - return $this->request; - } - - public function hasRequest() - { - return isset($this->request); - } - - public function clearRequest() - { - unset($this->request); - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - * @param \Google\Protobuf\Any $var - * @return $this - */ - public function setRequest($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); - $this->request = $var; - - return $this; - } - - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - * @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); - } - - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - * @return string - */ - public function getBuildId() - { - return $this->build_id; - } - - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - * @param string $var - * @return $this - */ - public function setBuildId($var) - { - GPBUtil::checkString($var, True); - $this->build_id = $var; - - return $this; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - * @return string - */ - public function getSourceToken() - { - return $this->source_token; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - * @param string $var - * @return $this - */ - public function setSourceToken($var) - { - GPBUtil::checkString($var, True); - $this->source_token = $var; - - return $this; - } - - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - * @return string - */ - public function getBuildName() - { - return $this->build_name; - } - - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - * @param string $var - * @return $this - */ - public function setBuildName($var) - { - GPBUtil::checkString($var, True); - $this->build_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php deleted file mode 100644 index 665dca661df7..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php +++ /dev/null @@ -1,68 +0,0 @@ -google.cloud.functions.v1.OperationType - */ -class OperationType -{ - /** - * Unknown operation type. - * - * Generated from protobuf enum OPERATION_UNSPECIFIED = 0; - */ - const OPERATION_UNSPECIFIED = 0; - /** - * Triggered by CreateFunction call - * - * Generated from protobuf enum CREATE_FUNCTION = 1; - */ - const CREATE_FUNCTION = 1; - /** - * Triggered by UpdateFunction call - * - * Generated from protobuf enum UPDATE_FUNCTION = 2; - */ - const UPDATE_FUNCTION = 2; - /** - * Triggered by DeleteFunction call. - * - * Generated from protobuf enum DELETE_FUNCTION = 3; - */ - const DELETE_FUNCTION = 3; - - private static $valueToName = [ - self::OPERATION_UNSPECIFIED => 'OPERATION_UNSPECIFIED', - self::CREATE_FUNCTION => 'CREATE_FUNCTION', - self::UPDATE_FUNCTION => 'UPDATE_FUNCTION', - self::DELETE_FUNCTION => 'DELETE_FUNCTION', - ]; - - 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php deleted file mode 100644 index c47df271d7a9..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php +++ /dev/null @@ -1,191 +0,0 @@ -google.cloud.functions.v1.SecretEnvVar - */ -class SecretEnvVar extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - */ - protected $key = ''; - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - */ - protected $version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $key - * Name of the environment variable. - * @type string $project_id - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @param string $var - * @return $this - */ - public function setKey($var) - { - GPBUtil::checkString($var, True); - $this->key = $var; - - return $this; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php deleted file mode 100644 index 66e6c00d8ac1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php +++ /dev/null @@ -1,213 +0,0 @@ -google.cloud.functions.v1.SecretVolume - */ -class SecretVolume extends \Google\Protobuf\Internal\Message -{ - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - */ - protected $mount_path = ''; - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - */ - private $versions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $mount_path - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * @type string $project_id - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - * @return string - */ - public function getMountPath() - { - return $this->mount_path; - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - * @param string $var - * @return $this - */ - public function setMountPath($var) - { - GPBUtil::checkString($var, True); - $this->mount_path = $var; - - return $this; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getVersions() - { - return $this->versions; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - * @param array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setVersions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume\SecretVersion::class); - $this->versions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php deleted file mode 100644 index a44fd6355ac6..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v1.SecretVolume.SecretVersion - */ -class SecretVersion extends \Google\Protobuf\Internal\Message -{ - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - */ - protected $version = ''; - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - */ - protected $path = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * @type string $path - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @param string $var - * @return $this - */ - public function setPath($var) - { - GPBUtil::checkString($var, True); - $this->path = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecretVersion::class, \Google\Cloud\Functions\V1\SecretVolume_SecretVersion::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php deleted file mode 100644 index 6f58de5fd44f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php +++ /dev/null @@ -1,154 +0,0 @@ -google.cloud.functions.v1.SourceRepository - */ -class SourceRepository extends \Google\Protobuf\Internal\Message -{ - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - */ - protected $url = ''; - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $deployed_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $url - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * @type string $deployed_url - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getDeployedUrl() - { - return $this->deployed_url; - } - - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setDeployedUrl($var) - { - GPBUtil::checkString($var, True); - $this->deployed_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php deleted file mode 100644 index 9d09690f55e7..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.functions.v1.UpdateFunctionRequest - */ -class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - */ - protected $update_mask = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V1\CloudFunction $function - * Required. New version of the function. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. The list of fields in `CloudFunction` that have to be updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V1\CloudFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V1\CloudFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->function = $var; - - return $this; - } - - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @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); - } - - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php deleted file mode 100644 index 48ae28d54e29..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php +++ /dev/null @@ -1,75 +0,0 @@ -callFunction($formattedName, $data); - 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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - $data = '[DATA]'; - - call_function_sample($formattedName, $data); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php deleted file mode 100644 index a1bbed30bfe9..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php +++ /dev/null @@ -1,84 +0,0 @@ -createFunction($formattedLocation, $function); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var CloudFunction $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 -{ - $formattedLocation = CloudFunctionsServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - create_function_sample($formattedLocation); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php deleted file mode 100644 index 8b01ac67ecd1..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php +++ /dev/null @@ -1,81 +0,0 @@ -deleteFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - - delete_function_sample($formattedName); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php deleted file mode 100644 index 8f47e47eabf2..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php +++ /dev/null @@ -1,57 +0,0 @@ -generateDownloadUrl(); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php deleted file mode 100644 index fff703d3d6d1..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php +++ /dev/null @@ -1,77 +0,0 @@ -generateUploadUrl(); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php deleted file mode 100644 index 8cdd9c74f902..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php +++ /dev/null @@ -1,70 +0,0 @@ -getFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - - get_function_sample($formattedName); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php deleted file mode 100644 index 7d5f9df65ad5..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php +++ /dev/null @@ -1,68 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php deleted file mode 100644 index 9a163ed63d13..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php +++ /dev/null @@ -1,58 +0,0 @@ -listFunctions(); - - /** @var CloudFunction $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 cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php deleted file mode 100644 index e8bcd3814df5..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php +++ /dev/null @@ -1,58 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php deleted file mode 100644 index b1a06b2632ff..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php +++ /dev/null @@ -1,70 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php deleted file mode 100644 index f7ce83e8395c..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php +++ /dev/null @@ -1,77 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php deleted file mode 100644 index c3a85dedaa99..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php +++ /dev/null @@ -1,68 +0,0 @@ -updateFunction($function); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var CloudFunction $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()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php deleted file mode 100644 index e423650fbff2..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $data = 'data'; - * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); - * } finally { - * $cloudFunctionsServiceClient->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 CloudFunctionsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.functions.v1.CloudFunctionsService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $cloudFunctionNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $locationNameTemplate; - - private static $repositoryNameTemplate; - - 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/cloud_functions_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/cloud_functions_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/cloud_functions_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/cloud_functions_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getCloudFunctionNameTemplate() - { - if (self::$cloudFunctionNameTemplate == null) { - self::$cloudFunctionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); - } - - return self::$cloudFunctionNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getRepositoryNameTemplate() - { - if (self::$repositoryNameTemplate == null) { - self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); - } - - return self::$repositoryNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'cloudFunction' => self::getCloudFunctionNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'repository' => self::getRepositoryNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * cloud_function resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted cloud_function resource. - */ - public static function cloudFunctionName($project, $location, $function) - { - return self::getCloudFunctionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) - { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName($project, $location, $repository) - { - return self::getRepositoryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - cloudFunction: projects/{project}/locations/{location}/functions/{function} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - * 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 'cloudfunctions.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); - } - - /** - * Synchronously invokes a deployed Cloud Function. To be used for testing - * purposes as very limited traffic is allowed. For more information on - * the actual limits, refer to - * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $data = 'data'; - * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function to be called. - * @param string $data Required. Input to be passed to the function. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\CallFunctionResponse - * - * @throws ApiException if the remote call fails - */ - public function callFunction($name, $data, array $optionalArgs = []) - { - $request = new CallFunctionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setData($data); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CallFunction', CallFunctionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedLocation = $cloudFunctionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $function = new CloudFunction(); - * $operationResponse = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); - * $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 = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $location Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @param CloudFunction $function Required. Function 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 createFunction($location, $function, array $optionalArgs = []) - { - $request = new CreateFunctionRequest(); - $requestParamHeaders = []; - $request->setLocation($location); - $request->setFunction($function); - $requestParamHeaders['location'] = $location; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $operationResponse = $cloudFunctionsServiceClient->deleteFunction($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 = $cloudFunctionsServiceClient->deleteFunction($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'deleteFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which should be deleted. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFunction($name, array $optionalArgs = []) - { - $request = new DeleteFunctionRequest(); - $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * minutes after generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $response = $cloudFunctionsServiceClient->generateDownloadUrl(); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @type int $versionId - * The optional version of function. If not set, default, current version - * is used. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\GenerateDownloadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateDownloadUrl(array $optionalArgs = []) - { - $request = new GenerateDownloadUrlRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['versionId'])) { - $request->setVersionId($optionalArgs['versionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * Source file size should not exceed 100MB limit. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * * `x-goog-content-length-range: 0,104857600` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $response = $cloudFunctionsServiceClient->generateUploadUrl(); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * @type string $kmsKeyName - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\GenerateUploadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateUploadUrl(array $optionalArgs = []) - { - $request = new GenerateUploadUrlRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['parent'])) { - $request->setParent($optionalArgs['parent']); - $requestParamHeaders['parent'] = $optionalArgs['parent']; - } - - if (isset($optionalArgs['kmsKeyName'])) { - $request->setKmsKeyName($optionalArgs['kmsKeyName']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $cloudFunctionsServiceClient->getFunction($formattedName); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which details should be obtained. - * @param array $optionalArgs { - * Optional. - * - * @type int $versionId - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\CloudFunction - * - * @throws ApiException if the remote call fails - */ - public function getFunction($name, array $optionalArgs = []) - { - $request = new GetFunctionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['versionId'])) { - $request->setVersionId($optionalArgs['versionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetFunction', CloudFunction::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the IAM access control policy for a function. - * Returns an empty policy if the function exists and does not have a policy - * set. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $response = $cloudFunctionsServiceClient->getIamPolicy($resource); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $parent - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @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 listFunctions(array $optionalArgs = []) - { - $request = new ListFunctionsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['parent'])) { - $request->setParent($optionalArgs['parent']); - $requestParamHeaders['parent'] = $optionalArgs['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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); - } - - /** - * Sets the IAM access control policy on the specified function. - * Replaces any existing policy. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $cloudFunctionsServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Tests the specified permissions against the IAM access control policy - * for a function. - * If the function does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $cloudFunctionsServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates existing function. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $function = new CloudFunction(); - * $operationResponse = $cloudFunctionsServiceClient->updateFunction($function); - * $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 = $cloudFunctionsServiceClient->updateFunction($function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'updateFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param CloudFunction $function Required. New version of the function. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Required. The list of fields in `CloudFunction` that have to be updated. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFunction($function, array $optionalArgs = []) - { - $request = new UpdateFunctionRequest(); - $requestParamHeaders = []; - $request->setFunction($function); - $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); - } -} diff --git a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json deleted file mode 100644 index eeb514889328..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.functions.v1", - "libraryPackage": "Google\\Cloud\\Functions\\V1", - "services": { - "CloudFunctionsService": { - "clients": { - "grpc": { - "libraryClient": "CloudFunctionsServiceGapicClient", - "rpcs": { - "CallFunction": { - "methods": [ - "callFunction" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json deleted file mode 100644 index fd458597923c..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v1.CloudFunctionsService": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_1_codes": [ - "UNAVAILABLE", - "DEADLINE_EXCEEDED" - ], - "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 - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 600000, - "total_timeout_millis": 600000 - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 600000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CallFunction": { - "timeout_millis": 600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "CreateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "DeleteFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GenerateDownloadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateUploadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListFunctions": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "UpdateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListLocations": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php deleted file mode 100644 index 0fa06f2e23bd..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php +++ /dev/null @@ -1,79 +0,0 @@ - [ - 'google.cloud.functions.v1.CloudFunctionsService' => [ - 'CreateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'UpdateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListFunctions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getFunctions', - ], - ], - 'ListLocations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getLocations', - ], - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - ], - ], -]; diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php deleted file mode 100644 index 5cbbcec88874..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php +++ /dev/null @@ -1,188 +0,0 @@ - [ - 'google.cloud.functions.v1.CloudFunctionsService' => [ - 'CallFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:call', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CreateFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{location=projects/*/locations/*}/functions', - 'body' => 'function', - 'placeholders' => [ - 'location' => [ - 'getters' => [ - 'getLocation', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'ListFunctions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{function.name=projects/*/locations/*/functions/*}', - 'body' => 'function', - 'placeholders' => [ - 'function.name' => [ - 'getters' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.location.Locations' => [ - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/operations', - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php deleted file mode 100644 index 8fb42777775e..000000000000 --- a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php +++ /dev/null @@ -1,1091 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return CloudFunctionsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new CloudFunctionsServiceClient($options); - } - - /** @test */ - public function callFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $executionId = 'executionId-1217171550'; - $result = 'result-934426595'; - $error = 'error96784904'; - $expectedResponse = new CallFunctionResponse(); - $expectedResponse->setExecutionId($executionId); - $expectedResponse->setResult($result); - $expectedResponse->setError($error); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $data = 'data3076010'; - $response = $gapicClient->callFunction($formattedName, $data); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/CallFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getData(); - $this->assertProtobufEquals($data, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function callFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $data = 'data3076010'; - try { - $gapicClient->callFunction($formattedName, $data); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId = 670497310; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new CloudFunction(); - $response = $gapicClient->createFunction($formattedLocation, $function); - $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.functions.v1.CloudFunctionsService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLocation(); - $this->assertProtobufEquals($formattedLocation, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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 - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new CloudFunction(); - $response = $gapicClient->createFunction($formattedLocation, $function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($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.functions.v1.CloudFunctionsService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - $response = $gapicClient->generateDownloadUrl(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateDownloadUrl', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->generateDownloadUrl(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - $response = $gapicClient->generateUploadUrl(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateUploadUrl', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->generateUploadUrl(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId2 = 102817515; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId2); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->getFunction($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.functions.v1.CloudFunctionsService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->getFunction($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 getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/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 listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new CloudFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listFunctions(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/ListFunctions', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->listFunctions(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId = 670497310; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new CloudFunction(); - $response = $gapicClient->updateFunction($function); - $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.functions.v1.CloudFunctionsService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new CloudFunction(); - $response = $gapicClient->updateFunction($function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php b/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php deleted file mode 100644 index 4565d6db8a5e1bec88b5c5a3db9955a231e1c528..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11429 zcmcIq&2t-B5ntJ{W3?Q`d5JfQvtgCVl1)M)?J5v-bK`v9j&K=BD9hJI;3Bvlnt-rntk7K8#r`%xo7yH3hA3GSH-lHow=F4!ev}u-Y4YUtnUtt=cY2JTMG$nwyl(G`Pv-@F z_{pFfCO!sXDg4N#+s17XBLdOG5q_Y1K0x}}ahMAt51EH!GkuY7j8bcT8CD)_`#p!>@ z)8wm=8uT%u8yeMQ<~W;uDPR()ITxBZr+N=&Exm16US=*kjrz(51pCb}7tUH`6pHP; zyQGYYqe5utIiB7#yiAfYid{Do`vE85a@>ZLVego(V{fBMGQd<2w|UBNG+BV@foo;b zNR;I4&=?+Xd)i}TS7UZ_j(xiPT)qSs*~;*%SSh-Om&0>5UvhWxWVvtbF5Q4sbcrdL zMn=N+PQc8LZVe1>b<0!lB&6@a3|kOcgj3Cy+)}i)TC<^)Dk~MGyzmMEn3YSd%DS?U zpwBCErHb#T$O%Z6l}5Gxs8U;9m_{3)D=Sr{MSmS5DLB4XyI-q6tS!te|KM}^8C+(9 z4+8@?>`?q*cgP*w>+c#J-^)J}PkVXG>F@}ie-=FM4FN*_S-^GgS~7U_3Uk4u^rr;O zNB4{rVa`KqcTJz`C0%$c#&Dvfxu&3_KJD-Jg(AsGI4&%Rd2Ui#fw^#K2F^5Tw3YV4t`)~NcX$Q&H2)K=;X(^3geG!ZbMX*L;TB59ay4?2$xU+gIU zcG^^7B9P!7^*Ao0!G(sAY3a8K0M+O_g2f`F+OBSQwzzfCG06{JAq3`py~p3t@Il|5 zK@{a|Z=1g6ZRso~@R1<)Ml-uYj#H3yaSBe(V;Wjs*K}DxNFt|s(?*^9nrrlor_96W ziU4!2v158DtMrQm%nAvM)GgVnHGcH7Nm7N_cotO?ihc)DOd!F4ij*pRIcA@S8v5Xs z;vCF!Lg_aNSm0tcTn8f_D$XDkI7<&CYsctnFDEG}!I_ZN7Zq6g>kOo#2f{6wVaEyI zoZ`lt7-OHy7vXj0h3wOK0Ab|RkP$es7|b^jPb&;*?ylB%5IJz`CT|DY$?$XLVvJh3 z?#O*O#TBZd=?FDq)TW#Al^0SEHO~X&JxD!q+{cECQaKj4%i`7N@@07A@C80(6clI^ z4HhHuTHDcGQ*T=s{byP9e?LZ`h?aAaD83%B;O9yWPIeviQkPo0>7o9_q42c{S(h2L zDu~I4a4O{2cRUkqeV4gVvY3A^Ux#bD>zkW;#}B3x(}eMr8aF3fx((+J7yQMiMS4uM z*WrA*Ub?TSnyRc;nk{ua$h``rRIjzQE=)-u0fxL0Y;qHh z3v?sQSz^}w8Z4oyjxSV@lCyAUu0d&X5c&=sUWJxWS^w{x;R*2^#KD zpcBI{o&F&6DtoOTW-P~;u@qx=bYvYd=CTB2TYrj)sOQu0f*=lkkeT%iq2Ek<{M$T= zHbW4#?eseo^VxU;I3m`fyFZuT00}?ooetuZaUCJ%^fW`jAkc5t9LH33Xy z^yq3B8_0VUp)-Cvjx|86kU2dmhjm7P))^j^88Tcirfnmp;~L)^(Dk5AbOx?#*qzZA&Voc=*TwQOJGz=RxrPQjc znzE`Y&8F5=S`=V5$6(Z1INeYy>lC}Ha&1*zM1v8e z#!qxajNBB(VU9;W;xY=s*lC`W{!H;QV<}7zxok5}>g)cNz8HnFUWsO>@4)dOv1Q{UhzM=j_I0;2 z9wdXr_Eks=Qg)Vy8T(lPMyjzifPrWVPNpyu7OC{6X<_9rSbA(aNM*nx3=Svn!aSBJ zy+K>^oxa%-;O5dluNn*}%yNF)fyWIYyJy;wQ z(CcH}*dVuHm~*2>sgqxdF{WUJ6rb6~Q(ue75+)o2+ck8wDnw|g`ROZ3n!zrX@TG4A z3<3?kJEozlO!ZhO2`UBq&`(uV6UZ`zH3Fua$t35-foajE=r+(CnAwN)6O?j|Rk6mU zj7~+(?kH2`!_pWnKnh9sm&U@%v9tz@Wy3P|>+0o<^ydl41Qp}8zUAoMHP`wdY{Pi9 zidjaJzBNkMC+qqPM(;Sp*J(zjqKn6m6VvBxy=a!S4l z=MUs97KBxlu9$MTBrM^brp~GI#61iiFX0-)fWQybkEeNn8crbusvs&A(+cnZdW`pv zO37K|1ka_vCE&Pt9;=wsRhwSl(nUR#)~1tKQJ@v)9*=A3!ksTTFP8Uu290=6beA@a zJRWk$SWTA}I?}NP`AAYN{SfBGQaF2hdac!3l?RH3HP+Sf8Y|+|GKGNk#sj6+!s84J zgL1X;fy`@xMWrQUiFFpHR%I-%rU9_>swyP}yyb-%EZn8bN~!+fL8aM5REY0pr9V!= zsj%}EbV~__5`)wvD32W#*0KYeBDt9y{@3a5nhYXEq+Hj1_okQ8svk;lva> zLUYy8rU);KP23cr2jMX$`WaZL$!PSWErkOsKg{ThYn3W(E?_mhsi^Cfl7e=RKU!*K zbyZQ(_>rUdqN(+2wJ4YFqYL0$F=Y65R;s@tawEn*>o@q()H1n?n9;73{ zIaV{HLnqYCk5MyaSQOR}o>c6*$PtYs;?UQQ=+K`e;8XxJLnu$;iU9jY2kZT6;2{T` zrw0%T=l+mwT3LFJZQ8_E+!Hs>LYbEn*T|;{I33Is!Q&*Z)^x!5U_o)^&;!ZDlB#S; zE0TPq*ov3H_$9iC{|%YH8(j**Qu(jmY5% z`hp7!w7JV#aHfHm8^T|^d!NgXUfh_yHR&|0xr-C9|B<&jVNZ18b@0wB?W5u>kv1&O z_08Cp-14ML5Dgq;FP@NfccOmQy-BACTV^;(_>9wh`|z@5P!OJY8KP{AGl-{n{-P{O zCgv~du5<;wqKf?AkFOA4JU~CJ%uI!(HDqM*bb?Dpqgoogle.cloud.functions.v2.BuildConfig - */ -class BuildConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $build = ''; - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - */ - protected $runtime = ''; - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - */ - protected $entry_point = ''; - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - */ - protected $source = null; - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $source_provenance = null; - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - */ - protected $worker_pool = ''; - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - */ - private $environment_variables; - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - */ - protected $docker_registry = 0; - /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - */ - protected $docker_repository = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $build - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * @type string $runtime - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * @type string $entry_point - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * @type \Google\Cloud\Functions\V2\Source $source - * The location of the function source code. - * @type \Google\Cloud\Functions\V2\SourceProvenance $source_provenance - * Output only. A permanent fixed identifier for source. - * @type string $worker_pool - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * User-provided build-time environment variables for the function - * @type int $docker_registry - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. - * @type string $docker_repository - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getBuild() - { - return $this->build; - } - - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setBuild($var) - { - GPBUtil::checkString($var, True); - $this->build = $var; - - return $this; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - * @return string - */ - public function getRuntime() - { - return $this->runtime; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - * @param string $var - * @return $this - */ - public function setRuntime($var) - { - GPBUtil::checkString($var, True); - $this->runtime = $var; - - return $this; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - * @return string - */ - public function getEntryPoint() - { - return $this->entry_point; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - * @param string $var - * @return $this - */ - public function setEntryPoint($var) - { - GPBUtil::checkString($var, True); - $this->entry_point = $var; - - return $this; - } - - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - * @return \Google\Cloud\Functions\V2\Source|null - */ - public function getSource() - { - return $this->source; - } - - public function hasSource() - { - return isset($this->source); - } - - public function clearSource() - { - unset($this->source); - } - - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - * @param \Google\Cloud\Functions\V2\Source $var - * @return $this - */ - public function setSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\Source::class); - $this->source = $var; - - return $this; - } - - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Functions\V2\SourceProvenance|null - */ - public function getSourceProvenance() - { - return $this->source_provenance; - } - - public function hasSourceProvenance() - { - return isset($this->source_provenance); - } - - public function clearSourceProvenance() - { - unset($this->source_provenance); - } - - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Functions\V2\SourceProvenance $var - * @return $this - */ - public function setSourceProvenance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\SourceProvenance::class); - $this->source_provenance = $var; - - return $this; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - * @return string - */ - public function getWorkerPool() - { - return $this->worker_pool; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setWorkerPool($var) - { - GPBUtil::checkString($var, True); - $this->worker_pool = $var; - - return $this; - } - - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - * @return int - */ - public function getDockerRegistry() - { - return $this->docker_registry; - } - - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - * @param int $var - * @return $this - */ - public function setDockerRegistry($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\BuildConfig\DockerRegistry::class); - $this->docker_registry = $var; - - return $this; - } - - /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - * @return string - */ - public function getDockerRepository() - { - return $this->docker_repository; - } - - /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDockerRepository($var) - { - GPBUtil::checkString($var, True); - $this->docker_repository = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php deleted file mode 100644 index dc5838f431f2..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.functions.v2.BuildConfig.DockerRegistry - */ -class DockerRegistry -{ - /** - * Unspecified. - * - * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; - */ - const DOCKER_REGISTRY_UNSPECIFIED = 0; - /** - * Docker images will be stored in multi-regional Container Registry - * repositories named `gcf`. - * - * Generated from protobuf enum CONTAINER_REGISTRY = 1; - */ - const CONTAINER_REGISTRY = 1; - /** - * Docker images will be stored in regional Artifact Registry repositories. - * By default, GCF will create and use repositories named `gcf-artifacts` - * in every region in which a function is deployed. But the repository to - * use can also be specified by the user using the `docker_repository` - * field. - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 2; - */ - const ARTIFACT_REGISTRY = 2; - - private static $valueToName = [ - self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', - self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DockerRegistry::class, \Google\Cloud\Functions\V2\BuildConfig_DockerRegistry::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php deleted file mode 100644 index 903e08f50551..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php +++ /dev/null @@ -1,184 +0,0 @@ -google.cloud.functions.v2.CreateFunctionRequest - */ -class CreateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - */ - protected $function_id = ''; - - /** - * @param string $parent Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. - * @param \Google\Cloud\Functions\V2\PBFunction $function Required. Function to be created. - * @param string $functionId The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * @return \Google\Cloud\Functions\V2\CreateFunctionRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Functions\V2\PBFunction $function, string $functionId): self - { - return (new self()) - ->setParent($parent) - ->setFunction($function) - ->setFunctionId($functionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @type \Google\Cloud\Functions\V2\PBFunction $function - * Required. Function to be created. - * @type string $function_id - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the function should be created, - * 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 in which the function should be created, - * 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; - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V2\PBFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V2\PBFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); - $this->function = $var; - - return $this; - } - - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - * @return string - */ - public function getFunctionId() - { - return $this->function_id; - } - - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - * @param string $var - * @return $this - */ - public function setFunctionId($var) - { - GPBUtil::checkString($var, True); - $this->function_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php deleted file mode 100644 index cd7afb9522a6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.functions.v2.DeleteFunctionRequest - */ -class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which should be deleted. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the function which should be deleted. Please see - * {@see FunctionServiceClient::functionName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\DeleteFunctionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which should be deleted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which should be deleted. - * - * 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 function which should be deleted. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php deleted file mode 100644 index a1fd8153a794..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php +++ /dev/null @@ -1,61 +0,0 @@ -google.cloud.functions.v2.Environment - */ -class Environment -{ - /** - * Unspecified - * - * Generated from protobuf enum ENVIRONMENT_UNSPECIFIED = 0; - */ - const ENVIRONMENT_UNSPECIFIED = 0; - /** - * Gen 1 - * - * Generated from protobuf enum GEN_1 = 1; - */ - const GEN_1 = 1; - /** - * Gen 2 - * - * Generated from protobuf enum GEN_2 = 2; - */ - const GEN_2 = 2; - - private static $valueToName = [ - self::ENVIRONMENT_UNSPECIFIED => 'ENVIRONMENT_UNSPECIFIED', - self::GEN_1 => 'GEN_1', - self::GEN_2 => 'GEN_2', - ]; - - 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php deleted file mode 100644 index 15ec540f1dd6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.functions.v2.EventFilter - */ -class EventFilter extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $attribute = ''; - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $value = ''; - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $operator = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $attribute - * Required. The name of a CloudEvents attribute. - * @type string $value - * Required. The value for the attribute. - * @type string $operator - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getAttribute() - { - return $this->attribute; - } - - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setAttribute($var) - { - GPBUtil::checkString($var, True); - $this->attribute = $var; - - return $this; - } - - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setValue($var) - { - GPBUtil::checkString($var, True); - $this->value = $var; - - return $this; - } - - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getOperator() - { - return $this->operator; - } - - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setOperator($var) - { - GPBUtil::checkString($var, True); - $this->operator = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php deleted file mode 100644 index ac73f76aace5..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php +++ /dev/null @@ -1,378 +0,0 @@ -google.cloud.functions.v2.EventTrigger - */ -class EventTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $trigger = ''; - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - */ - protected $trigger_region = ''; - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $event_type = ''; - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - */ - private $event_filters; - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $pubsub_topic = ''; - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service_account_email = ''; - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $retry_policy = 0; - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $channel = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $trigger - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * @type string $trigger_region - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * @type string $event_type - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * @type array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $event_filters - * Criteria used to filter events. - * @type string $pubsub_topic - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * @type string $service_account_email - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * @type int $retry_policy - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * @type string $channel - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getTrigger() - { - return $this->trigger; - } - - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTrigger($var) - { - GPBUtil::checkString($var, True); - $this->trigger = $var; - - return $this; - } - - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - * @return string - */ - public function getTriggerRegion() - { - return $this->trigger_region; - } - - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - * @param string $var - * @return $this - */ - public function setTriggerRegion($var) - { - GPBUtil::checkString($var, True); - $this->trigger_region = $var; - - return $this; - } - - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getEventType() - { - return $this->event_type; - } - - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setEventType($var) - { - GPBUtil::checkString($var, True); - $this->event_type = $var; - - return $this; - } - - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEventFilters() - { - return $this->event_filters; - } - - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - * @param array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEventFilters($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\EventFilter::class); - $this->event_filters = $arr; - - return $this; - } - - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getPubsubTopic() - { - return $this->pubsub_topic; - } - - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setPubsubTopic($var) - { - GPBUtil::checkString($var, True); - $this->pubsub_topic = $var; - - return $this; - } - - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getRetryPolicy() - { - return $this->retry_policy; - } - - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setRetryPolicy($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\EventTrigger\RetryPolicy::class); - $this->retry_policy = $var; - - return $this; - } - - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getChannel() - { - return $this->channel; - } - - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setChannel($var) - { - GPBUtil::checkString($var, True); - $this->channel = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php deleted file mode 100644 index fe9035ebeee4..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php +++ /dev/null @@ -1,66 +0,0 @@ -google.cloud.functions.v2.EventTrigger.RetryPolicy - */ -class RetryPolicy -{ - /** - * Not specified. - * - * Generated from protobuf enum RETRY_POLICY_UNSPECIFIED = 0; - */ - const RETRY_POLICY_UNSPECIFIED = 0; - /** - * Do not retry. - * - * Generated from protobuf enum RETRY_POLICY_DO_NOT_RETRY = 1; - */ - const RETRY_POLICY_DO_NOT_RETRY = 1; - /** - * Retry on any failure, retry up to 7 days with an exponential backoff - * (capped at 10 seconds). - * - * Generated from protobuf enum RETRY_POLICY_RETRY = 2; - */ - const RETRY_POLICY_RETRY = 2; - - private static $valueToName = [ - self::RETRY_POLICY_UNSPECIFIED => 'RETRY_POLICY_UNSPECIFIED', - self::RETRY_POLICY_DO_NOT_RETRY => 'RETRY_POLICY_DO_NOT_RETRY', - self::RETRY_POLICY_RETRY => 'RETRY_POLICY_RETRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(RetryPolicy::class, \Google\Cloud\Functions\V2\EventTrigger_RetryPolicy::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php deleted file mode 100644 index 6e003ddc46aa..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.GenerateDownloadUrlRequest - */ -class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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 function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php deleted file mode 100644 index c49cbe0ed3f5..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.GenerateDownloadUrlResponse - */ -class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - */ - protected $download_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $download_url - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @return string - */ - public function getDownloadUrl() - { - return $this->download_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @param string $var - * @return $this - */ - public function setDownloadUrl($var) - { - GPBUtil::checkString($var, True); - $this->download_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php deleted file mode 100644 index 40a85803c587..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php +++ /dev/null @@ -1,153 +0,0 @@ -google.cloud.functions.v2.GenerateUploadUrlRequest - */ -class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * @type string $kms_key_name - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, 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 in which the Google Cloud Storage signed - * URL should be generated, 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; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php deleted file mode 100644 index ec4ee0a82cfa..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php +++ /dev/null @@ -1,139 +0,0 @@ -google.cloud.functions.v2.GenerateUploadUrlResponse - */ -class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - */ - protected $upload_url = ''; - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - */ - protected $storage_source = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $upload_url - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * @type \Google\Cloud\Functions\V2\StorageSource $storage_source - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @return string - */ - public function getUploadUrl() - { - return $this->upload_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @param string $var - * @return $this - */ - public function setUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->upload_url = $var; - - return $this; - } - - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getStorageSource() - { - return $this->storage_source; - } - - public function hasStorageSource() - { - return isset($this->storage_source); - } - - public function clearStorageSource() - { - unset($this->storage_source); - } - - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->storage_source = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php deleted file mode 100644 index 7a7a6e4ab9d6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.functions.v2.GetFunctionRequest - */ -class GetFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which details should be obtained. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the function which details should be obtained. Please see - * {@see FunctionServiceClient::functionName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\GetFunctionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which details should be obtained. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which details should be obtained. - * - * 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 function which details should be obtained. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php deleted file mode 100644 index 993b0f979c80..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php +++ /dev/null @@ -1,278 +0,0 @@ -google.cloud.functions.v2.ListFunctionsRequest - */ -class ListFunctionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - */ - protected $filter = ''; - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - */ - protected $order_by = ''; - - /** - * @param string $parent Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. Please see - * {@see FunctionServiceClient::locationName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\ListFunctionsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @type int $page_size - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @type string $page_token - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @type string $filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type string $order_by - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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; - } - - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - * @param string $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkString($var, True); - $this->order_by = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php deleted file mode 100644 index edfa21aa7abe..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.functions.v2.ListFunctionsResponse - */ -class ListFunctionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - */ - private $functions; - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Locations that could not be reached. The response does not include any - * functions from these locations. - * - * 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\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $functions - * The functions that match the request. - * @type string $next_page_token - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. The response does not include any - * functions from these locations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - * @param array<\Google\Cloud\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setFunctions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\PBFunction::class); - $this->functions = $arr; - - return $this; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * 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. The response does not include any - * functions from these locations. - * - * 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. The response does not include any - * functions from these locations. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php deleted file mode 100644 index 7b4e50584294..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v2.ListRuntimesRequest - */ -class ListRuntimesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location from which the runtimes 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 = ''; - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - - /** - * @param string $parent Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\ListRuntimesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * @type string $filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location from which the runtimes 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 runtimes 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; - } - - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php deleted file mode 100644 index b833f9d472e1..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse - */ -class ListRuntimesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - */ - private $runtimes; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $runtimes - * The runtimes that match the request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getRuntimes() - { - return $this->runtimes; - } - - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - * @param array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setRuntimes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime::class); - $this->runtimes = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php deleted file mode 100644 index 3a6de70b406f..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php +++ /dev/null @@ -1,207 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse.Runtime - */ -class Runtime extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - */ - protected $display_name = ''; - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - */ - protected $stage = 0; - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - */ - private $warnings; - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - */ - protected $environment = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * @type string $display_name - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * @type int $stage - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * @type array|\Google\Protobuf\Internal\RepeatedField $warnings - * Warning messages, e.g., a deprecation warning. - * @type int $environment - * The environment for the runtime. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - * @return int - */ - public function getStage() - { - return $this->stage; - } - - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - * @param int $var - * @return $this - */ - public function setStage($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ListRuntimesResponse\RuntimeStage::class); - $this->stage = $var; - - return $this; - } - - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWarnings() - { - return $this->warnings; - } - - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWarnings($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->warnings = $arr; - - return $this; - } - - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - * @return int - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - * @param int $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); - $this->environment = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Runtime::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_Runtime::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php deleted file mode 100644 index 60d76ac6285e..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php +++ /dev/null @@ -1,92 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage - */ -class RuntimeStage -{ - /** - * Not specified. - * - * Generated from protobuf enum RUNTIME_STAGE_UNSPECIFIED = 0; - */ - const RUNTIME_STAGE_UNSPECIFIED = 0; - /** - * The runtime is in development. - * - * Generated from protobuf enum DEVELOPMENT = 1; - */ - const DEVELOPMENT = 1; - /** - * The runtime is in the Alpha stage. - * - * Generated from protobuf enum ALPHA = 2; - */ - const ALPHA = 2; - /** - * The runtime is in the Beta stage. - * - * Generated from protobuf enum BETA = 3; - */ - const BETA = 3; - /** - * The runtime is generally available. - * - * Generated from protobuf enum GA = 4; - */ - const GA = 4; - /** - * The runtime is deprecated. - * - * Generated from protobuf enum DEPRECATED = 5; - */ - const DEPRECATED = 5; - /** - * The runtime is no longer supported. - * - * Generated from protobuf enum DECOMMISSIONED = 6; - */ - const DECOMMISSIONED = 6; - - private static $valueToName = [ - self::RUNTIME_STAGE_UNSPECIFIED => 'RUNTIME_STAGE_UNSPECIFIED', - self::DEVELOPMENT => 'DEVELOPMENT', - self::ALPHA => 'ALPHA', - self::BETA => 'BETA', - self::GA => 'GA', - self::DEPRECATED => 'DEPRECATED', - self::DECOMMISSIONED => 'DECOMMISSIONED', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(RuntimeStage::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_RuntimeStage::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php deleted file mode 100644 index f6f8e06ea974..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.LocationMetadata - */ -class LocationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - */ - private $environments; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $environments - * The Cloud Function environments this location supports. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEnvironments() - { - return $this->environments; - } - - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEnvironments($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Functions\V2\Environment::class); - $this->environments = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php deleted file mode 100644 index 064db1c709af..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php +++ /dev/null @@ -1,385 +0,0 @@ -google.cloud.functions.v2.OperationMetadata - */ -class OperationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - protected $create_time = null; - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - */ - protected $end_time = null; - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - */ - protected $target = ''; - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - */ - protected $verb = ''; - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - */ - protected $status_detail = ''; - /** - * 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 cancel_requested = 6; - */ - protected $cancel_requested = false; - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - */ - protected $api_version = ''; - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - */ - protected $request_resource = null; - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - */ - private $stages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $create_time - * The time the operation was created. - * @type \Google\Protobuf\Timestamp $end_time - * The time the operation finished running. - * @type string $target - * Server-defined resource path for the target of the operation. - * @type string $verb - * Name of the verb executed by the operation. - * @type string $status_detail - * Human-readable status of the operation, if any. - * @type bool $cancel_requested - * 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 - * API version used to start the operation. - * @type \Google\Protobuf\Any $request_resource - * The original request that started the operation. - * @type array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $stages - * Mechanism for reporting in-progress stages - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @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); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @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); - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @return string - */ - public function getVerb() - { - return $this->verb; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @param string $var - * @return $this - */ - public function setVerb($var) - { - GPBUtil::checkString($var, True); - $this->verb = $var; - - return $this; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @return string - */ - public function getStatusDetail() - { - return $this->status_detail; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @param string $var - * @return $this - */ - public function setStatusDetail($var) - { - GPBUtil::checkString($var, True); - $this->status_detail = $var; - - return $this; - } - - /** - * 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 cancel_requested = 6; - * @return bool - */ - public function getCancelRequested() - { - return $this->cancel_requested; - } - - /** - * 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 cancel_requested = 6; - * @param bool $var - * @return $this - */ - public function setCancelRequested($var) - { - GPBUtil::checkBool($var); - $this->cancel_requested = $var; - - return $this; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - * @return string - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - * @param string $var - * @return $this - */ - public function setApiVersion($var) - { - GPBUtil::checkString($var, True); - $this->api_version = $var; - - return $this; - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - * @return \Google\Protobuf\Any|null - */ - public function getRequestResource() - { - return $this->request_resource; - } - - public function hasRequestResource() - { - return isset($this->request_resource); - } - - public function clearRequestResource() - { - unset($this->request_resource); - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - * @param \Google\Protobuf\Any $var - * @return $this - */ - public function setRequestResource($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); - $this->request_resource = $var; - - return $this; - } - - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStages() - { - return $this->stages; - } - - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - * @param array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\Stage::class); - $this->stages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php deleted file mode 100644 index 6221980da99d..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php +++ /dev/null @@ -1,510 +0,0 @@ -google.cloud.functions.v2.Function - */ -class PBFunction extends \Google\Protobuf\Internal\Message -{ - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - */ - protected $build_config = null; - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - */ - protected $service_config = null; - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - */ - protected $event_trigger = null; - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - */ - private $labels; - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $state_messages; - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - */ - protected $environment = 0; - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $url = ''; - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * @type string $description - * User-provided description of a function. - * @type \Google\Cloud\Functions\V2\BuildConfig $build_config - * Describes the Build step of the function that builds a container from the - * given source. - * @type \Google\Cloud\Functions\V2\ServiceConfig $service_config - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * @type \Google\Cloud\Functions\V2\EventTrigger $event_trigger - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * @type int $state - * Output only. State of the function. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The last update timestamp of a Cloud Function. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels associated with this Cloud Function. - * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages - * Output only. State Messages for this Cloud Function. - * @type int $environment - * Describe whether the function is 1st Gen or 2nd Gen. - * @type string $url - * Output only. The deployed url for the function. - * @type string $kms_key_name - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - * @return \Google\Cloud\Functions\V2\BuildConfig|null - */ - public function getBuildConfig() - { - return $this->build_config; - } - - public function hasBuildConfig() - { - return isset($this->build_config); - } - - public function clearBuildConfig() - { - unset($this->build_config); - } - - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - * @param \Google\Cloud\Functions\V2\BuildConfig $var - * @return $this - */ - public function setBuildConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\BuildConfig::class); - $this->build_config = $var; - - return $this; - } - - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - * @return \Google\Cloud\Functions\V2\ServiceConfig|null - */ - public function getServiceConfig() - { - return $this->service_config; - } - - public function hasServiceConfig() - { - return isset($this->service_config); - } - - public function clearServiceConfig() - { - unset($this->service_config); - } - - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - * @param \Google\Cloud\Functions\V2\ServiceConfig $var - * @return $this - */ - public function setServiceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\ServiceConfig::class); - $this->service_config = $var; - - return $this; - } - - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - * @return \Google\Cloud\Functions\V2\EventTrigger|null - */ - public function getEventTrigger() - { - return $this->event_trigger; - } - - public function hasEventTrigger() - { - return isset($this->event_trigger); - } - - public function clearEventTrigger() - { - unset($this->event_trigger); - } - - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - * @param \Google\Cloud\Functions\V2\EventTrigger $var - * @return $this - */ - public function setEventTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\EventTrigger::class); - $this->event_trigger = $var; - - return $this; - } - - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\PBFunction\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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 last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - * @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; - } - - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStateMessages() - { - return $this->state_messages; - } - - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStateMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); - $this->state_messages = $arr; - - return $this; - } - - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - * @return int - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - * @param int $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); - $this->environment = $var; - - return $this; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php deleted file mode 100644 index f6e8c8a0e5cd..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php +++ /dev/null @@ -1,86 +0,0 @@ -google.cloud.functions.v2.Function.State - */ -class State -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Function has been successfully deployed and is serving. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Function deployment failed and the function is not serving. - * - * Generated from protobuf enum FAILED = 2; - */ - const FAILED = 2; - /** - * Function is being created or updated. - * - * Generated from protobuf enum DEPLOYING = 3; - */ - const DEPLOYING = 3; - /** - * Function is being deleted. - * - * Generated from protobuf enum DELETING = 4; - */ - const DELETING = 4; - /** - * Function deployment failed and the function serving state is undefined. - * The function should be updated or deleted to move it out of this state. - * - * Generated from protobuf enum UNKNOWN = 5; - */ - const UNKNOWN = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::FAILED => 'FAILED', - self::DEPLOYING => 'DEPLOYING', - self::DELETING => 'DELETING', - self::UNKNOWN => 'UNKNOWN', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Functions\V2\Function_State::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php deleted file mode 100644 index 5326f62530e6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php +++ /dev/null @@ -1,309 +0,0 @@ -google.cloud.functions.v2.RepoSource - */ -class RepoSource extends \Google\Protobuf\Internal\Message -{ - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - */ - protected $project_id = ''; - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - */ - protected $repo_name = ''; - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - */ - protected $dir = ''; - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - */ - protected $invert_regex = false; - protected $revision; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $branch_name - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * @type string $tag_name - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * @type string $commit_sha - * Explicit commit SHA to build. - * @type string $project_id - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * @type string $repo_name - * Name of the Cloud Source Repository. - * @type string $dir - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * @type bool $invert_regex - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string branch_name = 3; - * @return string - */ - public function getBranchName() - { - return $this->readOneof(3); - } - - public function hasBranchName() - { - return $this->hasOneof(3); - } - - /** - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string branch_name = 3; - * @param string $var - * @return $this - */ - public function setBranchName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string tag_name = 4; - * @return string - */ - public function getTagName() - { - return $this->readOneof(4); - } - - public function hasTagName() - { - return $this->hasOneof(4); - } - - /** - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string tag_name = 4; - * @param string $var - * @return $this - */ - public function setTagName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Explicit commit SHA to build. - * - * Generated from protobuf field string commit_sha = 5; - * @return string - */ - public function getCommitSha() - { - return $this->readOneof(5); - } - - public function hasCommitSha() - { - return $this->hasOneof(5); - } - - /** - * Explicit commit SHA to build. - * - * Generated from protobuf field string commit_sha = 5; - * @param string $var - * @return $this - */ - public function setCommitSha($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - * @return string - */ - public function getRepoName() - { - return $this->repo_name; - } - - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - * @param string $var - * @return $this - */ - public function setRepoName($var) - { - GPBUtil::checkString($var, True); - $this->repo_name = $var; - - return $this; - } - - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - * @return string - */ - public function getDir() - { - return $this->dir; - } - - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - * @param string $var - * @return $this - */ - public function setDir($var) - { - GPBUtil::checkString($var, True); - $this->dir = $var; - - return $this; - } - - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - * @return bool - */ - public function getInvertRegex() - { - return $this->invert_regex; - } - - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - * @param bool $var - * @return $this - */ - public function setInvertRegex($var) - { - GPBUtil::checkBool($var); - $this->invert_regex = $var; - - return $this; - } - - /** - * @return string - */ - public function getRevision() - { - return $this->whichOneof("revision"); - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php deleted file mode 100644 index d14b7f6d187b..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php +++ /dev/null @@ -1,191 +0,0 @@ -google.cloud.functions.v2.SecretEnvVar - */ -class SecretEnvVar extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - */ - protected $key = ''; - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - */ - protected $version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $key - * Name of the environment variable. - * @type string $project_id - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @param string $var - * @return $this - */ - public function setKey($var) - { - GPBUtil::checkString($var, True); - $this->key = $var; - - return $this; - } - - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php deleted file mode 100644 index 505db9251bf8..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php +++ /dev/null @@ -1,203 +0,0 @@ -google.cloud.functions.v2.SecretVolume - */ -class SecretVolume extends \Google\Protobuf\Internal\Message -{ - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - */ - protected $mount_path = ''; - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - */ - private $versions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $mount_path - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * @type string $project_id - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - * @return string - */ - public function getMountPath() - { - return $this->mount_path; - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - * @param string $var - * @return $this - */ - public function setMountPath($var) - { - GPBUtil::checkString($var, True); - $this->mount_path = $var; - - return $this; - } - - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getVersions() - { - return $this->versions; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - * @param array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setVersions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume\SecretVersion::class); - $this->versions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php deleted file mode 100644 index fe99c1e3ddd3..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v2.SecretVolume.SecretVersion - */ -class SecretVersion extends \Google\Protobuf\Internal\Message -{ - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - */ - protected $version = ''; - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - */ - protected $path = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * @type string $path - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @param string $var - * @return $this - */ - public function setPath($var) - { - GPBUtil::checkString($var, True); - $this->path = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecretVersion::class, \Google\Cloud\Functions\V2\SecretVolume_SecretVersion::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php deleted file mode 100644 index b333f681bb86..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php +++ /dev/null @@ -1,810 +0,0 @@ -google.cloud.functions.v2.ServiceConfig - */ -class ServiceConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $service = ''; - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - */ - protected $timeout_seconds = 0; - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - */ - protected $available_memory = ''; - /** - * [Preview] The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - */ - protected $available_cpu = ''; - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - */ - private $environment_variables; - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - */ - protected $max_instance_count = 0; - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - */ - protected $min_instance_count = 0; - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - */ - protected $vpc_connector = ''; - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - */ - protected $vpc_connector_egress_settings = 0; - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - */ - protected $ingress_settings = 0; - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $uri = ''; - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - */ - protected $service_account_email = ''; - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - */ - protected $all_traffic_on_latest_revision = false; - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - */ - private $secret_environment_variables; - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - */ - private $secret_volumes; - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $revision = ''; - /** - * [Preview] Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - */ - protected $max_instance_request_concurrency = 0; - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - */ - protected $security_level = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $service - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * @type int $timeout_seconds - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * @type string $available_memory - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * @type string $available_cpu - * [Preview] The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * Environment variables that shall be available during function execution. - * @type int $max_instance_count - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * @type int $min_instance_count - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * @type string $vpc_connector - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * @type int $vpc_connector_egress_settings - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * @type int $ingress_settings - * The ingress settings for the function, controlling what traffic can reach - * it. - * @type string $uri - * Output only. URI of the Service deployed. - * @type string $service_account_email - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * @type bool $all_traffic_on_latest_revision - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * @type array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables - * Secret environment variables configuration. - * @type array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes - * Secret volumes configuration. - * @type string $revision - * Output only. The name of service revision. - * @type int $max_instance_request_concurrency - * [Preview] Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * @type int $security_level - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getService() - { - return $this->service; - } - - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setService($var) - { - GPBUtil::checkString($var, True); - $this->service = $var; - - return $this; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - * @return int - */ - public function getTimeoutSeconds() - { - return $this->timeout_seconds; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - * @param int $var - * @return $this - */ - public function setTimeoutSeconds($var) - { - GPBUtil::checkInt32($var); - $this->timeout_seconds = $var; - - return $this; - } - - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - * @return string - */ - public function getAvailableMemory() - { - return $this->available_memory; - } - - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - * @param string $var - * @return $this - */ - public function setAvailableMemory($var) - { - GPBUtil::checkString($var, True); - $this->available_memory = $var; - - return $this; - } - - /** - * [Preview] The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - * @return string - */ - public function getAvailableCpu() - { - return $this->available_cpu; - } - - /** - * [Preview] The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - * @param string $var - * @return $this - */ - public function setAvailableCpu($var) - { - GPBUtil::checkString($var, True); - $this->available_cpu = $var; - - return $this; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - * @return int - */ - public function getMaxInstanceCount() - { - return $this->max_instance_count; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - * @param int $var - * @return $this - */ - public function setMaxInstanceCount($var) - { - GPBUtil::checkInt32($var); - $this->max_instance_count = $var; - - return $this; - } - - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - * @return int - */ - public function getMinInstanceCount() - { - return $this->min_instance_count; - } - - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - * @param int $var - * @return $this - */ - public function setMinInstanceCount($var) - { - GPBUtil::checkInt32($var); - $this->min_instance_count = $var; - - return $this; - } - - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - * @return string - */ - public function getVpcConnector() - { - return $this->vpc_connector; - } - - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setVpcConnector($var) - { - GPBUtil::checkString($var, True); - $this->vpc_connector = $var; - - return $this; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - * @return int - */ - public function getVpcConnectorEgressSettings() - { - return $this->vpc_connector_egress_settings; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - * @param int $var - * @return $this - */ - public function setVpcConnectorEgressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\VpcConnectorEgressSettings::class); - $this->vpc_connector_egress_settings = $var; - - return $this; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - * @return int - */ - public function getIngressSettings() - { - return $this->ingress_settings; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - * @param int $var - * @return $this - */ - public function setIngressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\IngressSettings::class); - $this->ingress_settings = $var; - - return $this; - } - - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUri($var) - { - GPBUtil::checkString($var, True); - $this->uri = $var; - - return $this; - } - - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - * @return bool - */ - public function getAllTrafficOnLatestRevision() - { - return $this->all_traffic_on_latest_revision; - } - - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - * @param bool $var - * @return $this - */ - public function setAllTrafficOnLatestRevision($var) - { - GPBUtil::checkBool($var); - $this->all_traffic_on_latest_revision = $var; - - return $this; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretEnvironmentVariables() - { - return $this->secret_environment_variables; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - * @param array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretEnvironmentVariables($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretEnvVar::class); - $this->secret_environment_variables = $arr; - - return $this; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretVolumes() - { - return $this->secret_volumes; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - * @param array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretVolumes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume::class); - $this->secret_volumes = $arr; - - return $this; - } - - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRevision() - { - return $this->revision; - } - - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRevision($var) - { - GPBUtil::checkString($var, True); - $this->revision = $var; - - return $this; - } - - /** - * [Preview] Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - * @return int - */ - public function getMaxInstanceRequestConcurrency() - { - return $this->max_instance_request_concurrency; - } - - /** - * [Preview] Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - * @param int $var - * @return $this - */ - public function setMaxInstanceRequestConcurrency($var) - { - GPBUtil::checkInt32($var); - $this->max_instance_request_concurrency = $var; - - return $this; - } - - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - * @return int - */ - public function getSecurityLevel() - { - return $this->security_level; - } - - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - * @param int $var - * @return $this - */ - public function setSecurityLevel($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\SecurityLevel::class); - $this->security_level = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php deleted file mode 100644 index 0dfd22d07834..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.IngressSettings - */ -class IngressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const INGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Allow HTTP traffic from public and private sources. - * - * Generated from protobuf enum ALLOW_ALL = 1; - */ - const ALLOW_ALL = 1; - /** - * Allow HTTP traffic from only private VPC sources. - * - * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; - */ - const ALLOW_INTERNAL_ONLY = 2; - /** - * Allow HTTP traffic from private VPC sources and through GCLB. - * - * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; - */ - const ALLOW_INTERNAL_AND_GCLB = 3; - - private static $valueToName = [ - self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', - self::ALLOW_ALL => 'ALLOW_ALL', - self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', - self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IngressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_IngressSettings::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php deleted file mode 100644 index 5fb4b8b79894..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.SecurityLevel - */ -class SecurityLevel -{ - /** - * Unspecified. - * - * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; - */ - const SECURITY_LEVEL_UNSPECIFIED = 0; - /** - * Requests for a URL that match this handler that do not use HTTPS are - * automatically redirected to the HTTPS URL with the same path. Query - * parameters are reserved for the redirect. - * - * Generated from protobuf enum SECURE_ALWAYS = 1; - */ - const SECURE_ALWAYS = 1; - /** - * Both HTTP and HTTPS requests with URLs that match the handler succeed - * without redirects. The application can examine the request to determine - * which protocol was used and respond accordingly. - * - * Generated from protobuf enum SECURE_OPTIONAL = 2; - */ - const SECURE_OPTIONAL = 2; - - private static $valueToName = [ - self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', - self::SECURE_ALWAYS => 'SECURE_ALWAYS', - self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecurityLevel::class, \Google\Cloud\Functions\V2\ServiceConfig_SecurityLevel::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php deleted file mode 100644 index 77a3f98e3ae3..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings - */ -class VpcConnectorEgressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Use the VPC Access Connector only for private IP space from RFC1918. - * - * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; - */ - const PRIVATE_RANGES_ONLY = 1; - /** - * Force the use of VPC Access Connector for all egress traffic from the - * function. - * - * Generated from protobuf enum ALL_TRAFFIC = 2; - */ - const ALL_TRAFFIC = 2; - - private static $valueToName = [ - self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', - self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', - self::ALL_TRAFFIC => 'ALL_TRAFFIC', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_VpcConnectorEgressSettings::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php deleted file mode 100644 index c2bf044c6339..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php +++ /dev/null @@ -1,111 +0,0 @@ -google.cloud.functions.v2.Source - */ -class Source extends \Google\Protobuf\Internal\Message -{ - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\StorageSource $storage_source - * If provided, get the source from this location in Google Cloud Storage. - * @type \Google\Cloud\Functions\V2\RepoSource $repo_source - * If provided, get the source from this location in a Cloud Source - * Repository. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * If provided, get the source from this location in Google Cloud Storage. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getStorageSource() - { - return $this->readOneof(1); - } - - public function hasStorageSource() - { - return $this->hasOneof(1); - } - - /** - * If provided, get the source from this location in Google Cloud Storage. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * If provided, get the source from this location in a Cloud Source - * Repository. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; - * @return \Google\Cloud\Functions\V2\RepoSource|null - */ - public function getRepoSource() - { - return $this->readOneof(2); - } - - public function hasRepoSource() - { - return $this->hasOneof(2); - } - - /** - * If provided, get the source from this location in a Cloud Source - * Repository. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; - * @param \Google\Cloud\Functions\V2\RepoSource $var - * @return $this - */ - public function setRepoSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php deleted file mode 100644 index f49a857e6dae..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php +++ /dev/null @@ -1,130 +0,0 @@ -google.cloud.functions.v2.SourceProvenance - */ -class SourceProvenance extends \Google\Protobuf\Internal\Message -{ - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - */ - protected $resolved_storage_source = null; - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - */ - protected $resolved_repo_source = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\StorageSource $resolved_storage_source - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * @type \Google\Cloud\Functions\V2\RepoSource $resolved_repo_source - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getResolvedStorageSource() - { - return $this->resolved_storage_source; - } - - public function hasResolvedStorageSource() - { - return isset($this->resolved_storage_source); - } - - public function clearResolvedStorageSource() - { - unset($this->resolved_storage_source); - } - - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setResolvedStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->resolved_storage_source = $var; - - return $this; - } - - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - * @return \Google\Cloud\Functions\V2\RepoSource|null - */ - public function getResolvedRepoSource() - { - return $this->resolved_repo_source; - } - - public function hasResolvedRepoSource() - { - return isset($this->resolved_repo_source); - } - - public function clearResolvedRepoSource() - { - unset($this->resolved_repo_source); - } - - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - * @param \Google\Cloud\Functions\V2\RepoSource $var - * @return $this - */ - public function setResolvedRepoSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); - $this->resolved_repo_source = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php deleted file mode 100644 index e965c5a3023b..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php +++ /dev/null @@ -1,237 +0,0 @@ -google.cloud.functions.v2.Stage - */ -class Stage extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - */ - protected $name = 0; - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - */ - protected $message = ''; - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - */ - protected $state = 0; - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - */ - protected $resource = ''; - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - */ - protected $resource_uri = ''; - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - */ - private $state_messages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $name - * Name of the Stage. This will be unique for each Stage. - * @type string $message - * Message describing the Stage - * @type int $state - * Current state of the Stage - * @type string $resource - * Resource of the Stage - * @type string $resource_uri - * Link to the current Stage resource - * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages - * State messages from the current Stage. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - * @return int - */ - public function getName() - { - return $this->name; - } - - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - * @param int $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\Name::class); - $this->name = $var; - - return $this; - } - - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - * @param string $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkString($var, True); - $this->message = $var; - - return $this; - } - - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\State::class); - $this->state = $var; - - return $this; - } - - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - * @return string - */ - public function getResource() - { - return $this->resource; - } - - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - * @param string $var - * @return $this - */ - public function setResource($var) - { - GPBUtil::checkString($var, True); - $this->resource = $var; - - return $this; - } - - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - * @return string - */ - public function getResourceUri() - { - return $this->resource_uri; - } - - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - * @param string $var - * @return $this - */ - public function setResourceUri($var) - { - GPBUtil::checkString($var, True); - $this->resource_uri = $var; - - return $this; - } - - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStateMessages() - { - return $this->state_messages; - } - - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStateMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); - $this->state_messages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php deleted file mode 100644 index 6dbaa6f06046..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php +++ /dev/null @@ -1,92 +0,0 @@ -google.cloud.functions.v2.Stage.Name - */ -class Name -{ - /** - * Not specified. Invalid name. - * - * Generated from protobuf enum NAME_UNSPECIFIED = 0; - */ - const NAME_UNSPECIFIED = 0; - /** - * Artifact Regsitry Stage - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 1; - */ - const ARTIFACT_REGISTRY = 1; - /** - * Build Stage - * - * Generated from protobuf enum BUILD = 2; - */ - const BUILD = 2; - /** - * Service Stage - * - * Generated from protobuf enum SERVICE = 3; - */ - const SERVICE = 3; - /** - * Trigger Stage - * - * Generated from protobuf enum TRIGGER = 4; - */ - const TRIGGER = 4; - /** - * Service Rollback Stage - * - * Generated from protobuf enum SERVICE_ROLLBACK = 5; - */ - const SERVICE_ROLLBACK = 5; - /** - * Trigger Rollback Stage - * - * Generated from protobuf enum TRIGGER_ROLLBACK = 6; - */ - const TRIGGER_ROLLBACK = 6; - - private static $valueToName = [ - self::NAME_UNSPECIFIED => 'NAME_UNSPECIFIED', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - self::BUILD => 'BUILD', - self::SERVICE => 'SERVICE', - self::TRIGGER => 'TRIGGER', - self::SERVICE_ROLLBACK => 'SERVICE_ROLLBACK', - self::TRIGGER_ROLLBACK => 'TRIGGER_ROLLBACK', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Name::class, \Google\Cloud\Functions\V2\Stage_Name::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php deleted file mode 100644 index 5a0be65fc0dc..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.Stage.State - */ -class State -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Stage has not started. - * - * Generated from protobuf enum NOT_STARTED = 1; - */ - const NOT_STARTED = 1; - /** - * Stage is in progress. - * - * Generated from protobuf enum IN_PROGRESS = 2; - */ - const IN_PROGRESS = 2; - /** - * Stage has completed. - * - * Generated from protobuf enum COMPLETE = 3; - */ - const COMPLETE = 3; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::NOT_STARTED => 'NOT_STARTED', - self::IN_PROGRESS => 'IN_PROGRESS', - self::COMPLETE => 'COMPLETE', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Functions\V2\Stage_State::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php deleted file mode 100644 index 9e318e5af10f..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.functions.v2.StateMessage - */ -class StateMessage extends \Google\Protobuf\Internal\Message -{ - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - */ - protected $severity = 0; - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - */ - protected $type = ''; - /** - * The message. - * - * Generated from protobuf field string message = 3; - */ - protected $message = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $severity - * Severity of the state message. - * @type string $type - * One-word CamelCase type of the state message. - * @type string $message - * The message. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - * @return int - */ - public function getSeverity() - { - return $this->severity; - } - - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - * @param int $var - * @return $this - */ - public function setSeverity($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\StateMessage\Severity::class); - $this->severity = $var; - - return $this; - } - - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - * @param string $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkString($var, True); - $this->type = $var; - - return $this; - } - - /** - * The message. - * - * Generated from protobuf field string message = 3; - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * The message. - * - * Generated from protobuf field string message = 3; - * @param string $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkString($var, True); - $this->message = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php deleted file mode 100644 index d201473a95e0..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.StateMessage.Severity - */ -class Severity -{ - /** - * Not specified. Invalid severity. - * - * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; - */ - const SEVERITY_UNSPECIFIED = 0; - /** - * ERROR-level severity. - * - * Generated from protobuf enum ERROR = 1; - */ - const ERROR = 1; - /** - * WARNING-level severity. - * - * Generated from protobuf enum WARNING = 2; - */ - const WARNING = 2; - /** - * INFO-level severity. - * - * Generated from protobuf enum INFO = 3; - */ - const INFO = 3; - - private static $valueToName = [ - self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', - self::ERROR => 'ERROR', - self::WARNING => 'WARNING', - self::INFO => 'INFO', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Severity::class, \Google\Cloud\Functions\V2\StateMessage_Severity::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php deleted file mode 100644 index b9d4608a89d2..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php +++ /dev/null @@ -1,155 +0,0 @@ -google.cloud.functions.v2.StorageSource - */ -class StorageSource extends \Google\Protobuf\Internal\Message -{ - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - */ - protected $bucket = ''; - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - */ - protected $object = ''; - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - */ - protected $generation = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $bucket - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * @type string $object - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * @type int|string $generation - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - * @return string - */ - public function getBucket() - { - return $this->bucket; - } - - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - * @param string $var - * @return $this - */ - public function setBucket($var) - { - GPBUtil::checkString($var, True); - $this->bucket = $var; - - return $this; - } - - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - * @return string - */ - public function getObject() - { - return $this->object; - } - - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - * @param string $var - * @return $this - */ - public function setObject($var) - { - GPBUtil::checkString($var, True); - $this->object = $var; - - return $this; - } - - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - * @return int|string - */ - public function getGeneration() - { - return $this->generation; - } - - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - * @param int|string $var - * @return $this - */ - public function setGeneration($var) - { - GPBUtil::checkInt64($var); - $this->generation = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php deleted file mode 100644 index 5ca8510a4ef8..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php +++ /dev/null @@ -1,146 +0,0 @@ -google.cloud.functions.v2.UpdateFunctionRequest - */ -class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\Functions\V2\PBFunction $function Required. New version of the function. - * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * - * @return \Google\Cloud\Functions\V2\UpdateFunctionRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Functions\V2\PBFunction $function, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setFunction($function) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\PBFunction $function - * Required. New version of the function. - * @type \Google\Protobuf\FieldMask $update_mask - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V2\PBFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V2\PBFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); - $this->function = $var; - - return $this; - } - - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @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); - } - - /** - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php deleted file mode 100644 index 9973077ba5d3..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php +++ /dev/null @@ -1,88 +0,0 @@ -setParent($formattedParent) - ->setFunction($function); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->createFunction($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - create_function_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php deleted file mode 100644 index d4b706eed552..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php +++ /dev/null @@ -1,82 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->deleteFunction($request); - $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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - delete_function_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php deleted file mode 100644 index 8c67ca295d6e..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php +++ /dev/null @@ -1,76 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var GenerateDownloadUrlResponse $response */ - $response = $functionServiceClient->generateDownloadUrl($request); - 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - generate_download_url_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php deleted file mode 100644 index ab1292854a03..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php +++ /dev/null @@ -1,94 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var GenerateUploadUrlResponse $response */ - $response = $functionServiceClient->generateUploadUrl($request); - 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 -{ - $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - generate_upload_url_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php deleted file mode 100644 index eee78f27db80..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php +++ /dev/null @@ -1,71 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var PBFunction $response */ - $response = $functionServiceClient->getFunction($request); - 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - get_function_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php deleted file mode 100644 index 6a84bd75b393..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php +++ /dev/null @@ -1,72 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $functionServiceClient->getIamPolicy($request); - 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 cloudfunctions_v2_generated_FunctionService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php deleted file mode 100644 index 2211ba2247b3..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php +++ /dev/null @@ -1,81 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $functionServiceClient->listFunctions($request); - - /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - list_functions_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php deleted file mode 100644 index 287d79cf8c32..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php +++ /dev/null @@ -1,62 +0,0 @@ -listLocations($request); - - /** @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 cloudfunctions_v2_generated_FunctionService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php deleted file mode 100644 index aca8dd8c813e..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php +++ /dev/null @@ -1,72 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var ListRuntimesResponse $response */ - $response = $functionServiceClient->listRuntimes($request); - 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 -{ - $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - list_runtimes_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php deleted file mode 100644 index 97295556fbfc..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $functionServiceClient->setIamPolicy($request); - 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 cloudfunctions_v2_generated_FunctionService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php deleted file mode 100644 index 93d2ca86cb79..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php +++ /dev/null @@ -1,84 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $functionServiceClient->testIamPermissions($request); - 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 cloudfunctions_v2_generated_FunctionService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php deleted file mode 100644 index 600989041e80..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php +++ /dev/null @@ -1,71 +0,0 @@ -setFunction($function); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->updateFunction($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var PBFunction $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()); - } -} -// [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php deleted file mode 100644 index b651a22fcc2a..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php +++ /dev/null @@ -1,832 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/function_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * 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; - } - - /** - * Formats a string containing the fully-qualified path to represent a build - * resource. - * - * @param string $project - * @param string $location - * @param string $build - * - * @return string The formatted build resource. - */ - public static function buildName(string $project, string $location, string $build): string - { - return self::getPathTemplate('build')->render([ - 'project' => $project, - 'location' => $location, - 'build' => $build, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a channel - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * - * @return string The formatted channel resource. - */ - public static function channelName(string $project, string $location, string $channel): string - { - return self::getPathTemplate('channel')->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName(string $project, string $location, string $connector): string - { - return self::getPathTemplate('connector')->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string - { - return self::getPathTemplate('cryptoKey')->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a function - * resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted function resource. - */ - public static function functionName(string $project, string $location, string $function): string - { - return self::getPathTemplate('function')->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * 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(string $project, string $location): string - { - return self::getPathTemplate('location')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName(string $project, string $location, string $repository): string - { - return self::getPathTemplate('repository')->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName(string $project, string $location, string $service): string - { - return self::getPathTemplate('service')->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName(string $project, string $topic): string - { - return self::getPathTemplate('topic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trigger - * resource. - * - * @param string $project - * @param string $location - * @param string $trigger - * - * @return string The formatted trigger resource. - */ - public static function triggerName(string $project, string $location, string $trigger): string - { - return self::getPathTemplate('trigger')->render([ - 'project' => $project, - 'location' => $location, - 'trigger' => $trigger, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a worker_pool - * resource. - * - * @param string $project - * @param string $location - * @param string $workerPool - * - * @return string The formatted worker_pool resource. - */ - public static function workerPoolName(string $project, string $location, string $workerPool): string - { - return self::getPathTemplate('workerPool')->render([ - 'project' => $project, - 'location' => $location, - 'worker_pool' => $workerPool, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - build: projects/{project}/locations/{location}/builds/{build} - * - channel: projects/{project}/locations/{location}/channels/{channel} - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - function: projects/{project}/locations/{location}/functions/{function} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - service: projects/{project}/locations/{location}/services/{service} - * - topic: projects/{project}/topics/{topic} - * - trigger: projects/{project}/locations/{location}/triggers/{trigger} - * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * 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 'cloudfunctions.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); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * The async variant is {@see FunctionServiceClient::createFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/create_function.php - * - * @param CreateFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createFunction(CreateFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateFunction', $request, $callOptions)->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * The async variant is {@see FunctionServiceClient::deleteFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/delete_function.php - * - * @param DeleteFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteFunction(DeleteFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteFunction', $request, $callOptions)->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * The async variant is {@see FunctionServiceClient::generateDownloadUrlAsync()} . - * - * @example samples/V2/FunctionServiceClient/generate_download_url.php - * - * @param GenerateDownloadUrlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return GenerateDownloadUrlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $callOptions = []): GenerateDownloadUrlResponse - { - return $this->startApiCall('GenerateDownloadUrl', $request, $callOptions)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * The async variant is {@see FunctionServiceClient::generateUploadUrlAsync()} . - * - * @example samples/V2/FunctionServiceClient/generate_upload_url.php - * - * @param GenerateUploadUrlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return GenerateUploadUrlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function generateUploadUrl(GenerateUploadUrlRequest $request, array $callOptions = []): GenerateUploadUrlResponse - { - return $this->startApiCall('GenerateUploadUrl', $request, $callOptions)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * The async variant is {@see FunctionServiceClient::getFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/get_function.php - * - * @param GetFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PBFunction - * - * @throws ApiException Thrown if the API call fails. - */ - public function getFunction(GetFunctionRequest $request, array $callOptions = []): PBFunction - { - return $this->startApiCall('GetFunction', $request, $callOptions)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * The async variant is {@see FunctionServiceClient::listFunctionsAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_functions.php - * - * @param ListFunctionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listFunctions(ListFunctionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListFunctions', $request, $callOptions); - } - - /** - * Returns a list of runtimes that are supported for the requested project. - * - * The async variant is {@see FunctionServiceClient::listRuntimesAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_runtimes.php - * - * @param ListRuntimesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ListRuntimesResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listRuntimes(ListRuntimesRequest $request, array $callOptions = []): ListRuntimesResponse - { - return $this->startApiCall('ListRuntimes', $request, $callOptions)->wait(); - } - - /** - * Updates existing function. - * - * The async variant is {@see FunctionServiceClient::updateFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/update_function.php - * - * @param UpdateFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateFunction(UpdateFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateFunction', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see FunctionServiceClient::listLocationsAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see FunctionServiceClient::getIamPolicyAsync()} . - * - * @example samples/V2/FunctionServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see FunctionServiceClient::setIamPolicyAsync()} . - * - * @example samples/V2/FunctionServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->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. - * - * The async variant is {@see FunctionServiceClient::testIamPermissionsAsync()} . - * - * @example samples/V2/FunctionServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php deleted file mode 100644 index 8b0aa3f05d5e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); - * $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 = $functionServiceClient->createFunction($formattedParent, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Functions\V2\Client\FunctionServiceClient}. - */ -class FunctionServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.functions.v2.FunctionService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $buildNameTemplate; - - private static $channelNameTemplate; - - private static $connectorNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $functionNameTemplate; - - private static $locationNameTemplate; - - private static $repositoryNameTemplate; - - private static $serviceNameTemplate; - - private static $topicNameTemplate; - - private static $triggerNameTemplate; - - private static $workerPoolNameTemplate; - - 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/function_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getBuildNameTemplate() - { - if (self::$buildNameTemplate == null) { - self::$buildNameTemplate = new PathTemplate('projects/{project}/locations/{location}/builds/{build}'); - } - - return self::$buildNameTemplate; - } - - private static function getChannelNameTemplate() - { - if (self::$channelNameTemplate == null) { - self::$channelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}'); - } - - return self::$channelNameTemplate; - } - - private static function getConnectorNameTemplate() - { - if (self::$connectorNameTemplate == null) { - self::$connectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/connectors/{connector}'); - } - - return self::$connectorNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getFunctionNameTemplate() - { - if (self::$functionNameTemplate == null) { - self::$functionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); - } - - return self::$functionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getRepositoryNameTemplate() - { - if (self::$repositoryNameTemplate == null) { - self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); - } - - return self::$repositoryNameTemplate; - } - - private static function getServiceNameTemplate() - { - if (self::$serviceNameTemplate == null) { - self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); - } - - return self::$serviceNameTemplate; - } - - private static function getTopicNameTemplate() - { - if (self::$topicNameTemplate == null) { - self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$topicNameTemplate; - } - - private static function getTriggerNameTemplate() - { - if (self::$triggerNameTemplate == null) { - self::$triggerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/triggers/{trigger}'); - } - - return self::$triggerNameTemplate; - } - - private static function getWorkerPoolNameTemplate() - { - if (self::$workerPoolNameTemplate == null) { - self::$workerPoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workerPools/{worker_pool}'); - } - - return self::$workerPoolNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'build' => self::getBuildNameTemplate(), - 'channel' => self::getChannelNameTemplate(), - 'connector' => self::getConnectorNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'function' => self::getFunctionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'repository' => self::getRepositoryNameTemplate(), - 'service' => self::getServiceNameTemplate(), - 'topic' => self::getTopicNameTemplate(), - 'trigger' => self::getTriggerNameTemplate(), - 'workerPool' => self::getWorkerPoolNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a build - * resource. - * - * @param string $project - * @param string $location - * @param string $build - * - * @return string The formatted build resource. - */ - public static function buildName($project, $location, $build) - { - return self::getBuildNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'build' => $build, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a channel - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * - * @return string The formatted channel resource. - */ - public static function channelName($project, $location, $channel) - { - return self::getChannelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName($project, $location, $connector) - { - return self::getConnectorNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) - { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a function - * resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted function resource. - */ - public static function functionName($project, $location, $function) - { - return self::getFunctionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * 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 repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName($project, $location, $repository) - { - return self::getRepositoryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName($project, $location, $service) - { - return self::getServiceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName($project, $topic) - { - return self::getTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trigger - * resource. - * - * @param string $project - * @param string $location - * @param string $trigger - * - * @return string The formatted trigger resource. - */ - public static function triggerName($project, $location, $trigger) - { - return self::getTriggerNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'trigger' => $trigger, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a worker_pool - * resource. - * - * @param string $project - * @param string $location - * @param string $workerPool - * - * @return string The formatted worker_pool resource. - */ - public static function workerPoolName($project, $location, $workerPool) - { - return self::getWorkerPoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'worker_pool' => $workerPool, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - build: projects/{project}/locations/{location}/builds/{build} - * - channel: projects/{project}/locations/{location}/channels/{channel} - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - function: projects/{project}/locations/{location}/functions/{function} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - service: projects/{project}/locations/{location}/services/{service} - * - topic: projects/{project}/topics/{topic} - * - trigger: projects/{project}/locations/{location}/triggers/{trigger} - * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'cloudfunctions.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 function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); - * $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 = $functionServiceClient->createFunction($formattedParent, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @param PBFunction $function Required. Function to be created. - * @param array $optionalArgs { - * Optional. - * - * @type string $functionId - * The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFunction($parent, $function, array $optionalArgs = []) - { - $request = new CreateFunctionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFunction($function); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['functionId'])) { - $request->setFunctionId($optionalArgs['functionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $operationResponse = $functionServiceClient->deleteFunction($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 = $functionServiceClient->deleteFunction($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'deleteFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which should be deleted. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFunction($name, array $optionalArgs = []) - { - $request = new DeleteFunctionRequest(); - $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $functionServiceClient->generateDownloadUrl($formattedName); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\GenerateDownloadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateDownloadUrl($name, array $optionalArgs = []) - { - $request = new GenerateDownloadUrlRequest(); - $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('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $functionServiceClient->generateUploadUrl($formattedParent); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * @param array $optionalArgs { - * Optional. - * - * @type string $kmsKeyName - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\GenerateUploadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateUploadUrl($parent, array $optionalArgs = []) - { - $request = new GenerateUploadUrlRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['kmsKeyName'])) { - $request->setKmsKeyName($optionalArgs['kmsKeyName']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $functionServiceClient->getFunction($formattedName); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which details should be obtained. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\PBFunction - * - * @throws ApiException if the remote call fails - */ - public function getFunction($name, array $optionalArgs = []) - { - $request = new GetFunctionRequest(); - $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('GetFunction', PBFunction::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 string $filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type string $orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFunctions($parent, array $optionalArgs = []) - { - $request = new ListFunctionsRequest(); - $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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); - } - - /** - * Returns a list of runtimes that are supported for the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $functionServiceClient->listRuntimes($formattedParent); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\ListRuntimesResponse - * - * @throws ApiException if the remote call fails - */ - public function listRuntimes($parent, array $optionalArgs = []) - { - $request = new ListRuntimesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListRuntimes', ListRuntimesResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates existing function. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->updateFunction($function); - * $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 = $functionServiceClient->updateFunction($function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'updateFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param PBFunction $function Required. New version of the function. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFunction($function, array $optionalArgs = []) - { - $request = new UpdateFunctionRequest(); - $requestParamHeaders = []; - $request->setFunction($function); - $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $functionServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $functionServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $response = $functionServiceClient->getIamPolicy($resource); - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $functionServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $functionServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $functionServiceClient->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/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json deleted file mode 100644 index 9e109ca2916e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.functions.v2", - "libraryPackage": "Google\\Cloud\\Functions\\V2", - "services": { - "FunctionService": { - "clients": { - "grpc": { - "libraryClient": "FunctionServiceGapicClient", - "rpcs": { - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json deleted file mode 100644 index bfc64e4b21e5..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v2.FunctionService": { - "retry_codes": { - "no_retry_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 - } - }, - "methods": { - "CreateFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "DeleteFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateDownloadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateUploadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListFunctions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListRuntimes": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "UpdateFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListLocations": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php deleted file mode 100644 index b0f8d88bbb90..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php +++ /dev/null @@ -1,227 +0,0 @@ - [ - 'google.cloud.functions.v2.FunctionService' => [ - 'CreateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'function.name', - 'fieldAccessors' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\GenerateDownloadUrlResponse', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\GenerateUploadUrlResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\PBFunction', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListFunctions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getFunctions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\ListFunctionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListRuntimes' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\ListRuntimesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListLocations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getLocations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'templateMap' => [ - 'build' => 'projects/{project}/locations/{location}/builds/{build}', - 'channel' => 'projects/{project}/locations/{location}/channels/{channel}', - 'connector' => 'projects/{project}/locations/{location}/connectors/{connector}', - 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', - 'function' => 'projects/{project}/locations/{location}/functions/{function}', - 'location' => 'projects/{project}/locations/{location}', - 'repository' => 'projects/{project}/locations/{location}/repositories/{repository}', - 'service' => 'projects/{project}/locations/{location}/services/{service}', - 'topic' => 'projects/{project}/topics/{topic}', - 'trigger' => 'projects/{project}/locations/{location}/triggers/{trigger}', - 'workerPool' => 'projects/{project}/locations/{location}/workerPools/{worker_pool}', - ], - ], - ], -]; diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php deleted file mode 100644 index 44d8f539758e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php +++ /dev/null @@ -1,196 +0,0 @@ - [ - 'google.cloud.functions.v2.FunctionService' => [ - 'CreateFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', - 'body' => 'function', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'method' => 'delete', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListFunctions' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListRuntimes' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/runtimes', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'method' => 'patch', - 'uriTemplate' => '/v2/{function.name=projects/*/locations/*/functions/*}', - 'body' => 'function', - 'placeholders' => [ - 'function.name' => [ - 'getters' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.location.Locations' => [ - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php deleted file mode 100644 index 4e17ac09f50f..000000000000 --- a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php +++ /dev/null @@ -1,1149 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FunctionServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FunctionServiceClient($options); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunction($request); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new DeleteFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->deleteFunction($request); - $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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new DeleteFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->deleteFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GenerateDownloadUrlRequest()) - ->setName($formattedName); - $response = $gapicClient->generateDownloadUrl($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GenerateDownloadUrlRequest()) - ->setName($formattedName); - try { - $gapicClient->generateDownloadUrl($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new GenerateUploadUrlRequest()) - ->setParent($formattedParent); - $response = $gapicClient->generateUploadUrl($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new GenerateUploadUrlRequest()) - ->setParent($formattedParent); - try { - $gapicClient->generateUploadUrl($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GetFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->getFunction($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GetFunctionRequest()) - ->setName($formattedName); - try { - $gapicClient->getFunction($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new PBFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFunctionsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listFunctions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new ListFunctionsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listFunctions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListRuntimesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListRuntimesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listRuntimes($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new ListRuntimesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listRuntimes($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new PBFunction(); - $request = (new UpdateFunctionRequest()) - ->setFunction($function); - $response = $gapicClient->updateFunction($request); - $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new PBFunction(); - $request = (new UpdateFunctionRequest()) - ->setFunction($function); - $response = $gapicClient->updateFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->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); - $request = new ListLocationsRequest(); - $response = $gapicClient->listLocations($request); - $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); - $request = new ListLocationsRequest(); - try { - $gapicClient->listLocations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $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'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $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(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $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 = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createFunctionAsyncTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunctionAsync($request)->wait(); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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()); - } -} diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php deleted file mode 100644 index 870c34941734..000000000000 --- a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php +++ /dev/null @@ -1,1009 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FunctionServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FunctionServiceClient($options); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $response = $gapicClient->createFunction($formattedParent, $function); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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]'); - $function = new PBFunction(); - $response = $gapicClient->createFunction($formattedParent, $function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->generateDownloadUrl($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.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->generateDownloadUrl($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 generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->generateUploadUrl($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->generateUploadUrl($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 getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->getFunction($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.functions.v2.FunctionService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->getFunction($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 listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new PBFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listFunctions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listFunctions($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 listRuntimesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListRuntimesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listRuntimes($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listRuntimes($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 updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new PBFunction(); - $response = $gapicClient->updateFunction($function); - $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new PBFunction(); - $response = $gapicClient->updateFunction($function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->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()); - } -} From f0c28bcc201bcd0a8c3fb643304c6415ad13c2ab Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 8 Aug 2024 03:59:02 +0000 Subject: [PATCH 3/4] feat: optional field for specifying a service account to use for the build. This helps navigate the change of historical default on new projects. For more details, see https://cloud.google.com/build/docs/cloud-build-service-account-updates feat: optional fields for setting up automatic base image updates. feat: optional field for specifying a revision on GetFunction. feat: optional field for binary authorization policy. feat: optional field for deploying a source from a GitHub repository. feat: additional field on the output that specified whether the deployment supports Physical Zone Separation. feat: Generate upload URL now supports for specifying the GCF generation that the generated upload url will be used for. feat: ListRuntimes response now includes deprecation and decommissioning dates. docs: Refined description in several fields. PiperOrigin-RevId: 660624506 Source-Link: https://github.com/googleapis/googleapis/commit/8652e28bd0156553465918b9b7564420da79456e Source-Link: https://github.com/googleapis/googleapis-gen/commit/960e4b2595c6eda4e3f1c44d4cd5760cceefae88 Copy-Tag: eyJwIjoiRnVuY3Rpb25zLy5Pd2xCb3QueWFtbCIsImgiOiI5NjBlNGIyNTk1YzZlZGE0ZTNmMWM0NGQ0Y2Q1NzYwY2NlZWZhZTg4In0= --- .../Google/Cloud/Functions/V1/Functions.php | Bin 0 -> 9005 bytes .../Google/Cloud/Functions/V1/Operations.php | Bin 0 -> 1271 bytes .../Functions/V1/CallFunctionRequest.php | 101 + .../Functions/V1/CallFunctionResponse.php | 143 ++ .../Cloud/Functions/V1/CloudFunction.php | 1639 +++++++++++++++++ .../CloudFunction/AutomaticUpdatePolicy.php | 37 + .../V1/CloudFunction/DockerRegistry.php | 69 + .../V1/CloudFunction/IngressSettings.php | 73 + .../V1/CloudFunction/OnDeployUpdatePolicy.php | 74 + .../VpcConnectorEgressSettings.php | 67 + .../Functions/V1/CloudFunctionStatus.php | 83 + .../Functions/V1/CreateFunctionRequest.php | 115 ++ .../Functions/V1/DeleteFunctionRequest.php | 67 + .../Cloud/Functions/V1/EventTrigger.php | 292 +++ .../Cloud/Functions/V1/FailurePolicy.php | 76 + .../Functions/V1/FailurePolicy/Retry.php | 40 + .../V1/GenerateDownloadUrlRequest.php | 109 ++ .../V1/GenerateDownloadUrlResponse.php | 71 + .../Functions/V1/GenerateUploadUrlRequest.php | 161 ++ .../V1/GenerateUploadUrlResponse.php | 75 + .../Cloud/Functions/V1/GetFunctionRequest.php | 121 ++ .../Cloud/Functions/V1/HttpsTrigger.php | 101 + .../V1/HttpsTrigger/SecurityLevel.php | 70 + .../Functions/V1/ListFunctionsRequest.php | 167 ++ .../Functions/V1/ListFunctionsResponse.php | 151 ++ .../Functions/V1/OperationMetadataV1.php | 349 ++++ .../Cloud/Functions/V1/OperationType.php | 68 + .../Cloud/Functions/V1/SecretEnvVar.php | 191 ++ .../Cloud/Functions/V1/SecretVolume.php | 213 +++ .../V1/SecretVolume/SecretVersion.php | 124 ++ .../Cloud/Functions/V1/SourceRepository.php | 154 ++ .../Functions/V1/UpdateFunctionRequest.php | 121 ++ .../call_function.php | 75 + .../create_function.php | 84 + .../delete_function.php | 81 + .../generate_download_url.php | 57 + .../generate_upload_url.php | 77 + .../get_function.php | 70 + .../get_iam_policy.php | 68 + .../list_functions.php | 58 + .../list_locations.php | 58 + .../set_iam_policy.php | 70 + .../test_iam_permissions.php | 77 + .../update_function.php | 68 + .../v1/src/V1/CloudFunctionsServiceClient.php | 34 + .../CloudFunctionsServiceGapicClient.php | 1154 ++++++++++++ .../Functions/v1/src/V1/gapic_metadata.json | 78 + ...cloud_functions_service_client_config.json | 105 ++ ...ud_functions_service_descriptor_config.php | 79 + ...d_functions_service_rest_client_config.php | 188 ++ .../V1/CloudFunctionsServiceClientTest.php | 1091 +++++++++++ .../Google/Cloud/Functions/V2/Functions.php | Bin 0 -> 12405 bytes .../Functions/V2/AutomaticUpdatePolicy.php | 34 + .../Google/Cloud/Functions/V2/BuildConfig.php | 599 ++++++ .../V2/BuildConfig/DockerRegistry.php | 69 + .../Functions/V2/CreateFunctionRequest.php | 184 ++ .../Functions/V2/DeleteFunctionRequest.php | 81 + .../Google/Cloud/Functions/V2/Environment.php | 61 + .../Google/Cloud/Functions/V2/EventFilter.php | 147 ++ .../Cloud/Functions/V2/EventTrigger.php | 432 +++++ .../Functions/V2/EventTrigger/RetryPolicy.php | 66 + .../V2/GenerateDownloadUrlRequest.php | 71 + .../V2/GenerateDownloadUrlResponse.php | 71 + .../Functions/V2/GenerateUploadUrlRequest.php | 199 ++ .../V2/GenerateUploadUrlResponse.php | 139 ++ .../Cloud/Functions/V2/GetFunctionRequest.php | 135 ++ .../Functions/V2/ListFunctionsRequest.php | 278 +++ .../Functions/V2/ListFunctionsResponse.php | 143 ++ .../Functions/V2/ListRuntimesRequest.php | 124 ++ .../Functions/V2/ListRuntimesResponse.php | 67 + .../V2/ListRuntimesResponse/Runtime.php | 295 +++ .../V2/ListRuntimesResponse/RuntimeStage.php | 92 + .../Cloud/Functions/V2/LocationMetadata.php | 67 + .../Functions/V2/OnDeployUpdatePolicy.php | 71 + .../Cloud/Functions/V2/OperationMetadata.php | 495 +++++ .../Cloud/Functions/V2/OperationType.php | 68 + .../Google/Cloud/Functions/V2/PBFunction.php | 592 ++++++ .../Cloud/Functions/V2/PBFunction/State.php | 86 + .../Google/Cloud/Functions/V2/RepoSource.php | 309 ++++ .../Cloud/Functions/V2/SecretEnvVar.php | 191 ++ .../Cloud/Functions/V2/SecretVolume.php | 203 ++ .../V2/SecretVolume/SecretVersion.php | 124 ++ .../Cloud/Functions/V2/ServiceConfig.php | 848 +++++++++ .../V2/ServiceConfig/IngressSettings.php | 73 + .../V2/ServiceConfig/SecurityLevel.php | 71 + .../VpcConnectorEgressSettings.php | 67 + .../src/Google/Cloud/Functions/V2/Source.php | 150 ++ .../Cloud/Functions/V2/SourceProvenance.php | 168 ++ .../src/Google/Cloud/Functions/V2/Stage.php | 237 +++ .../Google/Cloud/Functions/V2/Stage/Name.php | 92 + .../Google/Cloud/Functions/V2/Stage/State.php | 71 + .../Cloud/Functions/V2/StateMessage.php | 135 ++ .../Functions/V2/StateMessage/Severity.php | 71 + .../Cloud/Functions/V2/StorageSource.php | 197 ++ .../Functions/V2/UpdateFunctionRequest.php | 141 ++ .../FunctionServiceClient/create_function.php | 88 + .../FunctionServiceClient/delete_function.php | 82 + .../generate_download_url.php | 76 + .../generate_upload_url.php | 94 + .../V2/FunctionServiceClient/get_function.php | 71 + .../FunctionServiceClient/get_iam_policy.php | 72 + .../FunctionServiceClient/list_functions.php | 81 + .../FunctionServiceClient/list_locations.php | 62 + .../FunctionServiceClient/list_runtimes.php | 72 + .../FunctionServiceClient/set_iam_policy.php | 77 + .../test_iam_permissions.php | 84 + .../FunctionServiceClient/update_function.php | 71 + .../src/V2/Client/FunctionServiceClient.php | 832 +++++++++ .../v2/src/V2/FunctionServiceClient.php | 34 + .../V2/Gapic/FunctionServiceGapicClient.php | 1431 ++++++++++++++ .../Functions/v2/src/V2/gapic_metadata.json | 78 + .../function_service_client_config.json | 82 + .../function_service_descriptor_config.php | 227 +++ .../function_service_rest_client_config.php | 196 ++ .../V2/Client/FunctionServiceClientTest.php | 1157 ++++++++++++ .../Unit/V2/FunctionServiceClientTest.php | 1015 ++++++++++ 116 files changed, 22490 insertions(+) create mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Operations.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php create mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/Gapic/CloudFunctionsServiceGapicClient.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php create mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php create mode 100644 owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/AutomaticUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php create mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/Gapic/FunctionServiceGapicClient.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php create mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php create mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php create mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php diff --git a/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php b/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php new file mode 100644 index 0000000000000000000000000000000000000000..8933e0a4c3f52d8552d2fc8b7f0ecec2ccddff9c GIT binary patch literal 9005 zcmbtaOLN=S6%Hj!mag8A718t~G@Le)Vv)6+*HE?-@Fg>*NtUGKaYi!;1YSvqKmY|m z*@~-8H=Qo~n(jN@^cQrdn`}E?bdl~d(`h=>RenNNJ@*9yq(oDR7Z!SS;&`~ zw}8~MJFbp1$phOyFmYNp?M^Gb-?4Pxuq`ire7E~0MY$qmX>IH|nvRoOwd@n@Yc0*! zcDE>l-5g=CTNDg-ckXT?q??-OC4-0PB}&3Sr?Y1odeZYXAO5^;c&cF;zM+}Mmte_* z<2C+PgYjBSi;WOPp&W>GnqamA0&OZgTvC3Nf-Ma*V?3d69%Wjr`Dts~aUNmLG_d7gjHYN{vz5h%+Oc7~7bC4>9xg*G*&hzORfojt#cVBU zZHS~@_*1hXW=@7zn^RtttZZ8cZpX3=>);0|9K>9{!;BqXB<344Y|iMK)v`y{s2Js#YA1815hlrE28zO;6}YIYE&eD6)Z*U;Jo z7U7TT&|u{2iRgM{?KWRCyJ3|+SAfIuD&69-!v$R9OoDYxqJu9A01pioL792K3GGS$v3;>$0w z4^4F(DDPOM!l$XMM4zmth$LpiGD64L^&m)8qZOY8qEWVxN8_LdHof>yTyfHwh!@3v?s$Sj7i`fS&4M--puX#g}2*>_%>AOLiPRCu9^TuLfr& z)zLh#jIxhY_8$$+zQh;=Jny6Fqqe6W;S-et(N$tq_NU(~x6v&cGqB2;1G;-D=yTIK z_XIk-$M{6LiWb-@64zoEQpz^t3F??7G{Kf2K(A4zH2WZO*<&j0R(IhEy6#~eI=gcs z;s%X~fq>JX^biFQYtqMPmh(Hd%?=dY_|0KC>`($QZkj`@Zy#YR{+3YolJqHBXxTck zIE1<~T~B|n+(B!a>l^!;?z{NF@F1mnUD!olsfOkPUTkyxHgKBV_;Bb$%~M_KTo$D7 zvexnKHtG6RjxMZN##eyz)W*Z1IV*zCHU%lx_N3p~vx_Um?ypH%2bTc~`u3p1I?x4f~m{>=vJGGpet5zz7T(eqN z3tROJ_ETq>VrkUG7;> zDtUD)SI*9l%Acdzo)~`%UCUQT@OANr9|5pfMq<{y(f*Of zxBQP7nhy74(tL=JwGK}xV0K)?KT%ES)Jz)hvm5UZ$mB4~6u>W~E)!z;DVm8qkZz(x zqmbLKmzvMia$%=X?m4gpARy}nh?J+wvj&{iBAVlmsIaesp#p`mm0R`7ML@v?~MbEiwWIgR+ihA`hVEj6nf| z2ArJ7)WG&MLYS%(sz+}mE~7E}F*||Ap?W}nC)dz)q^?D<0ZiwyNBTf^Uzmj^nHEBB zCm1dOkK79;<*&ejj3qC0z@<$aQ%Ca;c`OaXc?(T&&K_JjNV_>GR>C4ltbnI>SPz>> z(OBs|Anmx&nT0molc;jkMEQ>~w3Kr(bj>0g>-ZNPxKm4;XhI|&GbFqEtujKp8S%WY zohkFAh2xtL2}*rAwJ|6bBJDFtp%M8vpcgA+y?TXNv*5TGYbhPv6Uc>=tJi-|2*wh! zgQP9&_v)d9@0;0s)HmxF!@cO;gB%FGd&HnBT`5DeBSd=QOg=#4j^;vw@)Kdr#o9WEcC#hhlE!mq-uKc2I+fG&~AG6N14 z!jI9Fs4(u!D`*|rk=avEJdLlV~=q9!!bpqk4MQ9=;p?dKL5c!ZRTj%9$Jqme+_OY%K* z?M(WvyIPzroug2pYrl)ZQHGlcHkXiof^Ox?)$P1m+^*zEp;H@8rMcbPsUb8DT}x@F z0HtvXU9J|3W$13^MUCH*Carb2iptq%|!+9&iJ8W-gI-zaos7g3X3X3tSF)c&oVO8<$W*=XgG z2DvD@RVaHy*cKXgrh=ir{L5F$+r4wf#b8;yPTINqjj|v>_>RCyYSpHkrp_0u=U5hU zel5h*sC5ul0Wwi)!YzgG!D!4o&?0m2!ion*i6|d)C)VioQb1q|?uzKj)eTvlSRv z9m{uRyp-2FE;U8Q$ zdz*o}&fcF#Mz?as?-ct&^IIioPF^zy3P!~ShM7_D?d0@3<;5_=_QtS+V02k0?;g@G z$yncokEdx}%{{=f~yiVN^c}lL%JwEsN+q zCjlo+Q0_^nq7a(r=;iMPu%#nW#OR`8Y=C8fxV#aw1WV;L<2_gsR}7mA z@@wO$Y~6dLrP;a?Z@dO89Dh%xIp(5lT|e3`S_?^*blflim|&jBfcHsgE=lB~VT1LQ z$yDRM5^X-r+IQ#Lwe`j(SRJG!3Khk&M6Vg!;8DI?eL=tB*j&k~@~|AIcF0^+wL=0P z-xj_Do_0L$?4BuU%Jw&5|niyvD8Kf+{xL z&+aU8@#F`1CVvIR9P^iUV(P`!l9DW+Ug>K!#~1d~u|1+QzY4^N{9EVgoogle.cloud.functions.v1.CallFunctionRequest + */ +class CallFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function to be called. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function to be called. + * @type string $data + * Required. Input to be passed to the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function to be called. + * + * 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 function to be called. + * + * 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; + } + + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * Required. Input to be passed to the function. + * + * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, True); + $this->data = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php new file mode 100644 index 000000000000..bb7004f8e9d2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php @@ -0,0 +1,143 @@ +google.cloud.functions.v1.CallFunctionResponse + */ +class CallFunctionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + */ + protected $execution_id = ''; + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + */ + protected $result = ''; + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + */ + protected $error = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $execution_id + * Execution id of function invocation. + * @type string $result + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * @type string $error + * Either system or user-function generated error. Set if execution + * was not successful. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + * @return string + */ + public function getExecutionId() + { + return $this->execution_id; + } + + /** + * Execution id of function invocation. + * + * Generated from protobuf field string execution_id = 1; + * @param string $var + * @return $this + */ + public function setExecutionId($var) + { + GPBUtil::checkString($var, True); + $this->execution_id = $var; + + return $this; + } + + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * Result populated for successful execution of synchronous function. Will + * not be populated if function does not return a result through context. + * + * Generated from protobuf field string result = 2; + * @param string $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkString($var, True); + $this->result = $var; + + return $this; + } + + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + * @return string + */ + public function getError() + { + return $this->error; + } + + /** + * Either system or user-function generated error. Set if execution + * was not successful. + * + * Generated from protobuf field string error = 3; + * @param string $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkString($var, True); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php new file mode 100644 index 000000000000..dcb6a3476b51 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php @@ -0,0 +1,1639 @@ +google.cloud.functions.v1.CloudFunction + */ +class CloudFunction extends \Google\Protobuf\Internal\Message +{ + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status = 0; + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + */ + protected $entry_point = ''; + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + */ + protected $runtime = ''; + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + */ + protected $timeout = null; + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + */ + protected $available_memory_mb = 0; + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + */ + protected $service_account_email = ''; + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $version_id = 0; + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + */ + private $labels; + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + */ + private $environment_variables; + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + */ + private $build_environment_variables; + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @deprecated + */ + protected $network = ''; + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + */ + protected $max_instances = 0; + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + */ + protected $min_instances = 0; + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + */ + protected $vpc_connector = ''; + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + */ + protected $vpc_connector_egress_settings = 0; + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + */ + protected $ingress_settings = 0; + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + */ + protected $build_worker_pool = ''; + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $build_id = ''; + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $build_name = ''; + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + */ + private $secret_environment_variables; + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + */ + private $secret_volumes; + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $source_token = ''; + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + */ + protected $docker_repository = ''; + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + */ + protected $docker_registry = 0; + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + */ + protected $build_service_account = ''; + protected $source_code; + protected $trigger; + protected $runtime_update_policy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * @type string $description + * User-provided description of a function. + * @type string $source_archive_url + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * @type \Google\Cloud\Functions\V1\SourceRepository $source_repository + * **Beta Feature** + * The source repository where a function is hosted. + * @type string $source_upload_url + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * @type \Google\Cloud\Functions\V1\HttpsTrigger $https_trigger + * An HTTPS endpoint type of source that can be triggered via URL. + * @type \Google\Cloud\Functions\V1\EventTrigger $event_trigger + * A source that fires events in response to a condition in another service. + * @type int $status + * Output only. Status of the function deployment. + * @type string $entry_point + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * @type string $runtime + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * @type \Google\Protobuf\Duration $timeout + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * @type int $available_memory_mb + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * @type string $service_account_email + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last update timestamp of a Cloud Function. + * @type int|string $version_id + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this Cloud Function. + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * Environment variables that shall be available during function execution. + * @type array|\Google\Protobuf\Internal\MapField $build_environment_variables + * Build environment variables that shall be available during build time. + * @type string $network + * Deprecated: use vpc_connector + * @type int $max_instances + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * @type int $min_instances + * A lower bound for the number function instances that may coexist at a + * given time. + * @type string $vpc_connector + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * @type int $vpc_connector_egress_settings + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * @type int $ingress_settings + * The ingress settings for the function, controlling what traffic can reach + * it. + * @type string $kms_key_name + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * @type string $build_worker_pool + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * @type string $build_id + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * @type string $build_name + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * @type array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables + * Secret environment variables configuration. + * @type array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes + * Secret volumes configuration. + * @type string $source_token + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * @type string $docker_repository + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * @type int $docker_registry + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * @type \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $automatic_update_policy + * @type \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $on_deploy_update_policy + * @type string $build_service_account + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * + * Generated from protobuf field string source_archive_url = 3; + * @return string + */ + public function getSourceArchiveUrl() + { + return $this->readOneof(3); + } + + public function hasSourceArchiveUrl() + { + return $this->hasOneof(3); + } + + /** + * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip + * archive which contains the function. + * + * Generated from protobuf field string source_archive_url = 3; + * @param string $var + * @return $this + */ + public function setSourceArchiveUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * **Beta Feature** + * The source repository where a function is hosted. + * + * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; + * @return \Google\Cloud\Functions\V1\SourceRepository|null + */ + public function getSourceRepository() + { + return $this->readOneof(4); + } + + public function hasSourceRepository() + { + return $this->hasOneof(4); + } + + /** + * **Beta Feature** + * The source repository where a function is hosted. + * + * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; + * @param \Google\Cloud\Functions\V1\SourceRepository $var + * @return $this + */ + public function setSourceRepository($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\SourceRepository::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * + * Generated from protobuf field string source_upload_url = 16; + * @return string + */ + public function getSourceUploadUrl() + { + return $this->readOneof(16); + } + + public function hasSourceUploadUrl() + { + return $this->hasOneof(16); + } + + /** + * The Google Cloud Storage signed URL used for source uploading, generated + * by calling [google.cloud.functions.v1.GenerateUploadUrl]. + * The signature is validated on write methods (Create, Update) + * The signature is stripped from the Function object on read methods (Get, + * List) + * + * Generated from protobuf field string source_upload_url = 16; + * @param string $var + * @return $this + */ + public function setSourceUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * An HTTPS endpoint type of source that can be triggered via URL. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; + * @return \Google\Cloud\Functions\V1\HttpsTrigger|null + */ + public function getHttpsTrigger() + { + return $this->readOneof(5); + } + + public function hasHttpsTrigger() + { + return $this->hasOneof(5); + } + + /** + * An HTTPS endpoint type of source that can be triggered via URL. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; + * @param \Google\Cloud\Functions\V1\HttpsTrigger $var + * @return $this + */ + public function setHttpsTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\HttpsTrigger::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A source that fires events in response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; + * @return \Google\Cloud\Functions\V1\EventTrigger|null + */ + public function getEventTrigger() + { + return $this->readOneof(6); + } + + public function hasEventTrigger() + { + return $this->hasOneof(6); + } + + /** + * A source that fires events in response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; + * @param \Google\Cloud\Functions\V1\EventTrigger $var + * @return $this + */ + public function setEventTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\EventTrigger::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Output only. Status of the function deployment. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunctionStatus::class); + $this->status = $var; + + return $this; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix (ID of the function), if not + * specified. + * + * Generated from protobuf field string entry_point = 8; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + * @return string + */ + public function getRuntime() + { + return $this->runtime; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 19; + * @param string $var + * @return $this + */ + public function setRuntime($var) + { + GPBUtil::checkString($var, True); + $this->runtime = $var; + + return $this; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 9; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + * @return int + */ + public function getAvailableMemoryMb() + { + return $this->available_memory_mb; + } + + /** + * The amount of memory in MB available for a function. + * Defaults to 256MB. + * + * Generated from protobuf field int32 available_memory_mb = 10; + * @param int $var + * @return $this + */ + public function setAvailableMemoryMb($var) + { + GPBUtil::checkInt32($var); + $this->available_memory_mb = $var; + + return $this; + } + + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * The email of the function's service account. If empty, defaults to + * `{project_id}@appspot.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 11; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; + } + + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. + * + * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 15; + * @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; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 17; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + * @return \Google\Protobuf\Internal\MapField + */ + public function getBuildEnvironmentVariables() + { + return $this->build_environment_variables; + } + + /** + * Build environment variables that shall be available during build time. + * + * Generated from protobuf field map build_environment_variables = 28; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setBuildEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->build_environment_variables = $arr; + + return $this; + } + + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @return string + * @deprecated + */ + public function getNetwork() + { + @trigger_error('network is deprecated.', E_USER_DEPRECATED); + return $this->network; + } + + /** + * Deprecated: use vpc_connector + * + * Generated from protobuf field string network = 18 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setNetwork($var) + { + @trigger_error('network is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + * @return int + */ + public function getMaxInstances() + { + return $this->max_instances; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instances = 20; + * @param int $var + * @return $this + */ + public function setMaxInstances($var) + { + GPBUtil::checkInt32($var); + $this->max_instances = $var; + + return $this; + } + + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + * @return int + */ + public function getMinInstances() + { + return $this->min_instances; + } + + /** + * A lower bound for the number function instances that may coexist at a + * given time. + * + * Generated from protobuf field int32 min_instances = 32; + * @param int $var + * @return $this + */ + public function setMinInstances($var) + { + GPBUtil::checkInt32($var); + $this->min_instances = $var; + + return $this; + } + + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + * @return string + */ + public function getVpcConnector() + { + return $this->vpc_connector; + } + + /** + * The VPC Network Connector that this cloud function can connect to. It can + * be either the fully-qualified URI, or the short name of the network + * connector resource. The format of this field is + * `projects/*/locations/*/connectors/*` + * This field is mutually exclusive with `network` field and will eventually + * replace it. + * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + * more information on connecting Cloud projects. + * + * Generated from protobuf field string vpc_connector = 22; + * @param string $var + * @return $this + */ + public function setVpcConnector($var) + { + GPBUtil::checkString($var, True); + $this->vpc_connector = $var; + + return $this; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + * @return int + */ + public function getVpcConnectorEgressSettings() + { + return $this->vpc_connector_egress_settings; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + * @param int $var + * @return $this + */ + public function setVpcConnectorEgressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\VpcConnectorEgressSettings::class); + $this->vpc_connector_egress_settings = $var; + + return $this; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + * @return int + */ + public function getIngressSettings() + { + return $this->ingress_settings; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; + * @param int $var + * @return $this + */ + public function setIngressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\IngressSettings::class); + $this->ingress_settings = $var; + + return $this; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * If specified, you must also provide an artifact registry repository using + * the `docker_repository` field that was created with the same KMS crypto + * key. + * The following service accounts need to be granted the role 'Cloud KMS + * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + * on the Key/KeyRing/Project/Organization (least access preferred). + * 1. Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + * Required to protect the function's image. + * 2. Google Storage service account + * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + * Required to protect the function's source code. + * If this service account does not exist, deploying a function without a + * KMS key or retrieving the service agent name provisions it. For more + * information, see + * https://cloud.google.com/storage/docs/projects#service-agents and + * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + * Google Cloud Functions delegates access to service agents to protect + * function resources in internal projects that are not accessible by the + * end user. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + * @return string + */ + public function getBuildWorkerPool() + { + return $this->build_worker_pool; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * `{project}` and `{region}` are the project id and region respectively where + * the worker pool is defined and `{workerPool}` is the short name of the + * worker pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + * be granted the role Cloud Build Custom Workers Builder + * (`roles/cloudbuild.customworkers.builder`) in the project. + * + * Generated from protobuf field string build_worker_pool = 26; + * @param string $var + * @return $this + */ + public function setBuildWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->build_worker_pool = $var; + + return $this; + } + + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBuildId() + { + return $this->build_id; + } + + /** + * Output only. The Cloud Build ID of the latest successful deployment of the + * function. + * + * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBuildId($var) + { + GPBUtil::checkString($var, True); + $this->build_id = $var; + + return $this; + } + + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * Output only. The Cloud Build Name of the function deployment. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretEnvironmentVariables() + { + return $this->secret_environment_variables; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; + * @param array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretEnvironmentVariables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretEnvVar::class); + $this->secret_environment_variables = $arr; + + return $this; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretVolumes() + { + return $this->secret_volumes; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; + * @param array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretVolumes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume::class); + $this->secret_volumes = $arr; + + return $this; + } + + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + * @return string + */ + public function getDockerRepository() + { + return $this->docker_repository; + } + + /** + * User-managed repository created in Artifact Registry to which the + * function's Docker image will be pushed after it is built by Cloud Build. + * May optionally be encrypted with a customer-managed encryption key (CMEK). + * If unspecified and `docker_registry` is not explicitly set to + * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry + * repository named 'gcf-artifacts' in the region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDockerRepository($var) + { + GPBUtil::checkString($var, True); + $this->docker_repository = $var; + + return $this; + } + + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + * @return int + */ + public function getDockerRegistry() + { + return $this->docker_registry; + } + + /** + * Docker Registry to use for this deployment. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; + * @param int $var + * @return $this + */ + public function setDockerRegistry($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\DockerRegistry::class); + $this->docker_registry = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; + * @return \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy|null + */ + public function getAutomaticUpdatePolicy() + { + return $this->readOneof(40); + } + + public function hasAutomaticUpdatePolicy() + { + return $this->hasOneof(40); + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; + * @param \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $var + * @return $this + */ + public function setAutomaticUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy::class); + $this->writeOneof(40, $var); + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @return \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy|null + */ + public function getOnDeployUpdatePolicy() + { + return $this->readOneof(41); + } + + public function hasOnDeployUpdatePolicy() + { + return $this->hasOneof(41); + } + + /** + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @param \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $var + * @return $this + */ + public function setOnDeployUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy::class); + $this->writeOneof(41, $var); + + return $this; + } + + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @return string + */ + public function getBuildServiceAccount() + { + return $this->build_service_account; + } + + /** + * A service account the user provides for use with Cloud Build. The format of + * this field is + * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string build_service_account = 43; + * @param string $var + * @return $this + */ + public function setBuildServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->build_service_account = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceCode() + { + return $this->whichOneof("source_code"); + } + + /** + * @return string + */ + public function getTrigger() + { + return $this->whichOneof("trigger"); + } + + /** + * @return string + */ + public function getRuntimeUpdatePolicy() + { + return $this->whichOneof("runtime_update_policy"); + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php new file mode 100644 index 000000000000..02f5ae78823a --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php @@ -0,0 +1,37 @@ +google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy + */ +class AutomaticUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutomaticUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_AutomaticUpdatePolicy::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php new file mode 100644 index 000000000000..0dc3a8279ff9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php @@ -0,0 +1,69 @@ +google.cloud.functions.v1.CloudFunction.DockerRegistry + */ +class DockerRegistry +{ + /** + * Unspecified. + * + * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; + */ + const DOCKER_REGISTRY_UNSPECIFIED = 0; + /** + * Docker images will be stored in multi-regional Container Registry + * repositories named `gcf`. + * + * Generated from protobuf enum CONTAINER_REGISTRY = 1; + */ + const CONTAINER_REGISTRY = 1; + /** + * Docker images will be stored in regional Artifact Registry repositories. + * By default, GCF will create and use repositories named `gcf-artifacts` + * in every region in which a function is deployed. But the repository to + * use can also be specified by the user using the `docker_repository` + * field. + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 2; + */ + const ARTIFACT_REGISTRY = 2; + + private static $valueToName = [ + self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', + self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DockerRegistry::class, \Google\Cloud\Functions\V1\CloudFunction_DockerRegistry::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php new file mode 100644 index 000000000000..f01e9ad97124 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php @@ -0,0 +1,73 @@ +google.cloud.functions.v1.CloudFunction.IngressSettings + */ +class IngressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const INGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Allow HTTP traffic from public and private sources. + * + * Generated from protobuf enum ALLOW_ALL = 1; + */ + const ALLOW_ALL = 1; + /** + * Allow HTTP traffic from only private VPC sources. + * + * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; + */ + const ALLOW_INTERNAL_ONLY = 2; + /** + * Allow HTTP traffic from private VPC sources and through GCLB. + * + * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; + */ + const ALLOW_INTERNAL_AND_GCLB = 3; + + private static $valueToName = [ + self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', + self::ALLOW_ALL => 'ALLOW_ALL', + self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', + self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IngressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_IngressSettings::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php new file mode 100644 index 000000000000..1183812ad6bb --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php @@ -0,0 +1,74 @@ +google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy + */ +class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $runtime_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $runtime_version + * Output only. Contains the runtime version which was used during latest + * function deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRuntimeVersion() + { + return $this->runtime_version; + } + + /** + * Output only. Contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRuntimeVersion($var) + { + GPBUtil::checkString($var, True); + $this->runtime_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OnDeployUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_OnDeployUpdatePolicy::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php new file mode 100644 index 000000000000..a357c173fb54 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php @@ -0,0 +1,67 @@ +google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings + */ +class VpcConnectorEgressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Use the VPC Access Connector only for private IP space from RFC1918. + * + * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; + */ + const PRIVATE_RANGES_ONLY = 1; + /** + * Force the use of VPC Access Connector for all egress traffic from the + * function. + * + * Generated from protobuf enum ALL_TRAFFIC = 2; + */ + const ALL_TRAFFIC = 2; + + private static $valueToName = [ + self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', + self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', + self::ALL_TRAFFIC => 'ALL_TRAFFIC', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_VpcConnectorEgressSettings::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php new file mode 100644 index 000000000000..50cab779a116 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php @@ -0,0 +1,83 @@ +google.cloud.functions.v1.CloudFunctionStatus + */ +class CloudFunctionStatus +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + */ + const CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + /** + * Function has been successfully deployed and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Function deployment failed and the function isn’t serving. + * + * Generated from protobuf enum OFFLINE = 2; + */ + const OFFLINE = 2; + /** + * Function is being created or updated. + * + * Generated from protobuf enum DEPLOY_IN_PROGRESS = 3; + */ + const DEPLOY_IN_PROGRESS = 3; + /** + * Function is being deleted. + * + * Generated from protobuf enum DELETE_IN_PROGRESS = 4; + */ + const DELETE_IN_PROGRESS = 4; + /** + * Function deployment failed and the function serving state is undefined. + * The function should be updated or deleted to move it out of this state. + * + * Generated from protobuf enum UNKNOWN = 5; + */ + const UNKNOWN = 5; + + private static $valueToName = [ + self::CLOUD_FUNCTION_STATUS_UNSPECIFIED => 'CLOUD_FUNCTION_STATUS_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::OFFLINE => 'OFFLINE', + self::DEPLOY_IN_PROGRESS => 'DEPLOY_IN_PROGRESS', + self::DELETE_IN_PROGRESS => 'DELETE_IN_PROGRESS', + self::UNKNOWN => 'UNKNOWN', + ]; + + 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php new file mode 100644 index 000000000000..cb11a65978b1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php @@ -0,0 +1,115 @@ +google.cloud.functions.v1.CreateFunctionRequest + */ +class CreateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $location = ''; + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @type \Google\Cloud\Functions\V1\CloudFunction $function + * Required. Function to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V1\CloudFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V1\CloudFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->function = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php new file mode 100644 index 000000000000..9fa98e38b5ea --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php @@ -0,0 +1,67 @@ +google.cloud.functions.v1.DeleteFunctionRequest + */ +class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which should be deleted. + * + * 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. The name of the function which should be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which should be deleted. + * + * 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 function which should be deleted. + * + * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php new file mode 100644 index 000000000000..a85d3f80fc84 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php @@ -0,0 +1,292 @@ +google.cloud.functions.v1.EventTrigger + */ +class EventTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + */ + protected $event_type = ''; + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + */ + protected $resource = ''; + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + */ + protected $service = ''; + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + */ + protected $failure_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $event_type + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * @type string $resource + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * @type string $service + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * @type \Google\Cloud\Functions\V1\FailurePolicy $failure_policy + * Specifies policy for failed executions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + * @return string + */ + public function getEventType() + { + return $this->event_type; + } + + /** + * Required. The type of event to observe. For example: + * `providers/cloud.storage/eventTypes/object.change` and + * `providers/cloud.pubsub/eventTypes/topic.publish`. + * Event types match pattern `providers/*/eventTypes/*.*`. + * The pattern contains: + * 1. namespace: For example, `cloud.storage` and + * `google.firebase.analytics`. + * 2. resource type: The type of resource on which event occurs. For + * example, the Google Cloud Storage API includes the type `object`. + * 3. action: The action that generates the event. For example, action for + * a Google Cloud Storage Object is 'change'. + * These parts are lower case. + * + * Generated from protobuf field string event_type = 1; + * @param string $var + * @return $this + */ + public function setEventType($var) + { + GPBUtil::checkString($var, True); + $this->event_type = $var; + + return $this; + } + + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Required. The resource(s) from which to observe events, for example, + * `projects/_/buckets/myBucket`. + * Not all syntactically correct values are accepted by all services. For + * example: + * 1. The authorization model must support it. Google Cloud Functions + * only allows EventTriggers to be deployed that observe resources in the + * same project as the `CloudFunction`. + * 2. The resource type must match the pattern expected for an + * `event_type`. For example, an `EventTrigger` that has an + * `event_type` of "google.pubsub.topic.publish" should have a resource + * that matches Google Cloud Pub/Sub topics. + * Additionally, some services may support short names when creating an + * `EventTrigger`. These will always be returned in the normalized "long" + * format. + * See each *service's* documentation for supported formats. + * + * Generated from protobuf field string resource = 2; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * The hostname of the service that should be observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * + * Generated from protobuf field string service = 3; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + * @return \Google\Cloud\Functions\V1\FailurePolicy|null + */ + public function getFailurePolicy() + { + return $this->failure_policy; + } + + public function hasFailurePolicy() + { + return isset($this->failure_policy); + } + + public function clearFailurePolicy() + { + unset($this->failure_policy); + } + + /** + * Specifies policy for failed executions. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; + * @param \Google\Cloud\Functions\V1\FailurePolicy $var + * @return $this + */ + public function setFailurePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy::class); + $this->failure_policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php new file mode 100644 index 000000000000..f81b50f6d779 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php @@ -0,0 +1,76 @@ +google.cloud.functions.v1.FailurePolicy + */ +class FailurePolicy extends \Google\Protobuf\Internal\Message +{ + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry + * If specified, then the function will be retried in case of a failure. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * If specified, then the function will be retried in case of a failure. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; + * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null + */ + public function getRetry() + { + return $this->readOneof(1); + } + + public function hasRetry() + { + return $this->hasOneof(1); + } + + /** + * If specified, then the function will be retried in case of a failure. + * + * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; + * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var + * @return $this + */ + public function setRetry($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy\Retry::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php new file mode 100644 index 000000000000..a2188ed7d6ef --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php @@ -0,0 +1,40 @@ +google.cloud.functions.v1.FailurePolicy.Retry + */ +class Retry extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Retry::class, \Google\Cloud\Functions\V1\FailurePolicy_Retry::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php new file mode 100644 index 000000000000..072629f3be02 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php @@ -0,0 +1,109 @@ +google.cloud.functions.v1.GenerateDownloadUrlRequest + */ +class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + */ + protected $version_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @type int|string $version_id + * The optional version of function. If not set, default, current version + * is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * The optional version of function. If not set, default, current version + * is used. + * + * Generated from protobuf field uint64 version_id = 2; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkUint64($var); + $this->version_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php new file mode 100644 index 000000000000..54d5d55e458f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php @@ -0,0 +1,71 @@ +google.cloud.functions.v1.GenerateDownloadUrlResponse + */ +class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + */ + protected $download_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $download_url + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @return string + */ + public function getDownloadUrl() + { + return $this->download_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @param string $var + * @return $this + */ + public function setDownloadUrl($var) + { + GPBUtil::checkString($var, True); + $this->download_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php new file mode 100644 index 000000000000..94a0f06d4816 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php @@ -0,0 +1,161 @@ +google.cloud.functions.v1.GenerateUploadUrlRequest + */ +class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * @type string $kms_key_name + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php new file mode 100644 index 000000000000..41557ee9aa0e --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php @@ -0,0 +1,75 @@ +google.cloud.functions.v1.GenerateUploadUrlResponse + */ +class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + */ + protected $upload_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $upload_url + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @return string + */ + public function getUploadUrl() + { + return $this->upload_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @param string $var + * @return $this + */ + public function setUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->upload_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php new file mode 100644 index 000000000000..72f3e59339fc --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php @@ -0,0 +1,121 @@ +google.cloud.functions.v1.GetFunctionRequest + */ +class GetFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which details should be obtained. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $version_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which details should be obtained. + * @type int|string $version_id + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which details should be obtained. + * + * 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 function which details should be obtained. + * + * 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. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * + * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php new file mode 100644 index 000000000000..24ca96c54a24 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php @@ -0,0 +1,101 @@ +google.cloud.functions.v1.HttpsTrigger + */ +class HttpsTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $url = ''; + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + */ + protected $security_level = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Output only. The deployed url for the function. + * @type int $security_level + * The security level for the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * @return int + */ + public function getSecurityLevel() + { + return $this->security_level; + } + + /** + * The security level for the function. + * + * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * @param int $var + * @return $this + */ + public function setSecurityLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\HttpsTrigger\SecurityLevel::class); + $this->security_level = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php new file mode 100644 index 000000000000..26f38ca940f8 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php @@ -0,0 +1,70 @@ +google.cloud.functions.v1.HttpsTrigger.SecurityLevel + */ +class SecurityLevel +{ + /** + * Unspecified. + * + * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; + */ + const SECURITY_LEVEL_UNSPECIFIED = 0; + /** + * Requests for a URL that match this handler that do not use HTTPS are + * automatically redirected to the HTTPS URL with the same path. Query + * parameters are reserved for the redirect. + * + * Generated from protobuf enum SECURE_ALWAYS = 1; + */ + const SECURE_ALWAYS = 1; + /** + * Both HTTP and HTTPS requests with URLs that match the handler succeed + * without redirects. The application can examine the request to determine + * which protocol was used and respond accordingly. + * + * Generated from protobuf enum SECURE_OPTIONAL = 2; + */ + const SECURE_OPTIONAL = 2; + + private static $valueToName = [ + self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', + self::SECURE_ALWAYS => 'SECURE_ALWAYS', + self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityLevel::class, \Google\Cloud\Functions\V1\HttpsTrigger_SecurityLevel::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php new file mode 100644 index 000000000000..31a224ea16e1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php @@ -0,0 +1,167 @@ +google.cloud.functions.v1.ListFunctionsRequest + */ +class ListFunctionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @type int $page_size + * Maximum number of functions to return per call. + * @type string $page_token + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.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 functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of functions 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php new file mode 100644 index 000000000000..354f44b97f4e --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php @@ -0,0 +1,151 @@ +google.cloud.functions.v1.ListFunctionsResponse + */ +class ListFunctionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + */ + private $functions; + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. The response does not include any + * functions from these locations. + * + * 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\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $functions + * The functions that match the request. + * @type string $next_page_token + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. The response does not include any + * functions from these locations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; + * @param array<\Google\Cloud\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFunctions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->functions = $arr; + + return $this; + } + + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If not empty, indicates that there may be more functions that match + * the request; this value should be passed in a new + * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + * to get more functions. + * + * 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. The response does not include any + * functions from these locations. + * + * 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. The response does not include any + * functions from these locations. + * + * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php new file mode 100644 index 000000000000..0f72c0be190f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php @@ -0,0 +1,349 @@ +google.cloud.functions.v1.OperationMetadataV1 + */ +class OperationMetadataV1 extends \Google\Protobuf\Internal\Message +{ + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + */ + protected $target = ''; + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + */ + protected $type = 0; + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + */ + protected $request = null; + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + */ + protected $version_id = 0; + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + */ + protected $update_time = null; + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + */ + protected $build_id = ''; + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + */ + protected $source_token = ''; + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + */ + protected $build_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * @type int $type + * Type of operation. + * @type \Google\Protobuf\Any $request + * The original request that started the operation. + * @type int|string $version_id + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * @type \Google\Protobuf\Timestamp $update_time + * The last update timestamp of the operation. + * @type string $build_id + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * @type string $source_token + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * @type string $build_name + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Operations::initOnce(); + parent::__construct($data); + } + + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Target of the operation - for example + * `projects/project-1/locations/region-1/functions/function-1` + * + * Generated from protobuf field string target = 1; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of operation. + * + * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\OperationType::class); + $this->type = $var; + + return $this; + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + * @return \Google\Protobuf\Any|null + */ + public function getRequest() + { + return $this->request; + } + + public function hasRequest() + { + return isset($this->request); + } + + public function clearRequest() + { + unset($this->request); + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request = 3; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setRequest($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->request = $var; + + return $this; + } + + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + * @return int|string + */ + public function getVersionId() + { + return $this->version_id; + } + + /** + * Version id of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field int64 version_id = 4; + * @param int|string $var + * @return $this + */ + public function setVersionId($var) + { + GPBUtil::checkInt64($var); + $this->version_id = $var; + + return $this; + } + + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + * @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); + } + + /** + * The last update timestamp of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + * @return string + */ + public function getBuildId() + { + return $this->build_id; + } + + /** + * The Cloud Build ID of the function created or updated by an API call. + * This field is only populated for Create and Update operations. + * + * Generated from protobuf field string build_id = 6; + * @param string $var + * @return $this + */ + public function setBuildId($var) + { + GPBUtil::checkString($var, True); + $this->build_id = $var; + + return $this; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 7; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * The Cloud Build Name of the function deployment. + * This field is only populated for Create and Update operations. + * `projects//locations//builds/`. + * + * Generated from protobuf field string build_name = 8; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php new file mode 100644 index 000000000000..665dca661df7 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php @@ -0,0 +1,68 @@ +google.cloud.functions.v1.OperationType + */ +class OperationType +{ + /** + * Unknown operation type. + * + * Generated from protobuf enum OPERATION_UNSPECIFIED = 0; + */ + const OPERATION_UNSPECIFIED = 0; + /** + * Triggered by CreateFunction call + * + * Generated from protobuf enum CREATE_FUNCTION = 1; + */ + const CREATE_FUNCTION = 1; + /** + * Triggered by UpdateFunction call + * + * Generated from protobuf enum UPDATE_FUNCTION = 2; + */ + const UPDATE_FUNCTION = 2; + /** + * Triggered by DeleteFunction call. + * + * Generated from protobuf enum DELETE_FUNCTION = 3; + */ + const DELETE_FUNCTION = 3; + + private static $valueToName = [ + self::OPERATION_UNSPECIFIED => 'OPERATION_UNSPECIFIED', + self::CREATE_FUNCTION => 'CREATE_FUNCTION', + self::UPDATE_FUNCTION => 'UPDATE_FUNCTION', + self::DELETE_FUNCTION => 'DELETE_FUNCTION', + ]; + + 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php new file mode 100644 index 000000000000..c47df271d7a9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php @@ -0,0 +1,191 @@ +google.cloud.functions.v1.SecretEnvVar + */ +class SecretEnvVar extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Name of the environment variable. + * @type string $project_id + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances start. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php new file mode 100644 index 000000000000..66e6c00d8ac1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php @@ -0,0 +1,213 @@ +google.cloud.functions.v1.SecretVolume + */ +class SecretVolume extends \Google\Protobuf\Internal\Message +{ + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + */ + protected $mount_path = ''; + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + */ + private $versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mount_path + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * @type string $project_id + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + * @return string + */ + public function getMountPath() + { + return $this->mount_path; + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount paths: /etc/secrets + * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + * + * Generated from protobuf field string mount_path = 1; + * @param string $var + * @return $this + */ + public function setMountPath($var) + { + GPBUtil::checkString($var, True); + $this->mount_path = $var; + + return $this; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferrably project number but can also be the project + * ID) of the project that contains the secret. If not set, it will be + * populated with the function's project assuming that the secret exists in + * the same project as of the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersions() + { + return $this->versions; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; + * @param array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume\SecretVersion::class); + $this->versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php new file mode 100644 index 000000000000..a44fd6355ac6 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php @@ -0,0 +1,124 @@ +google.cloud.functions.v1.SecretVolume.SecretVersion + */ +class SecretVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * @type string $path + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretVersion::class, \Google\Cloud\Functions\V1\SecretVolume_SecretVersion::class); + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php new file mode 100644 index 000000000000..6f58de5fd44f --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php @@ -0,0 +1,154 @@ +google.cloud.functions.v1.SourceRepository + */ +class SourceRepository extends \Google\Protobuf\Internal\Message +{ + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deployed_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * @type string $deployed_url + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL pointing to the hosted repository where the function is defined. + * There are supported Cloud Source Repository URLs in the following + * formats: + * To refer to a specific commit: + * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + * To refer to a moveable alias (branch): + * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + * In particular, to refer to HEAD use `master` moveable alias. + * To refer to a specific fixed alias (tag): + * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + * You may omit `paths/*` if you want to use the main directory. The function + * response may add an empty `/paths/` to the URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDeployedUrl() + { + return $this->deployed_url; + } + + /** + * Output only. The URL pointing to the hosted repository where the function + * were defined at the time of deployment. It always points to a specific + * commit in the format described above. + * + * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDeployedUrl($var) + { + GPBUtil::checkString($var, True); + $this->deployed_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php new file mode 100644 index 000000000000..9d09690f55e7 --- /dev/null +++ b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php @@ -0,0 +1,121 @@ +google.cloud.functions.v1.UpdateFunctionRequest + */ +class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V1\CloudFunction $function + * Required. New version of the function. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The list of fields in `CloudFunction` that have to be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V1\CloudFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V1\CloudFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); + $this->function = $var; + + return $this; + } + + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @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); + } + + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php new file mode 100644 index 000000000000..48ae28d54e29 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php @@ -0,0 +1,75 @@ +callFunction($formattedName, $data); + 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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + $data = '[DATA]'; + + call_function_sample($formattedName, $data); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php new file mode 100644 index 000000000000..a1bbed30bfe9 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php @@ -0,0 +1,84 @@ +createFunction($formattedLocation, $function); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CloudFunction $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 +{ + $formattedLocation = CloudFunctionsServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_function_sample($formattedLocation); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php new file mode 100644 index 000000000000..8b01ac67ecd1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php @@ -0,0 +1,81 @@ +deleteFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + + delete_function_sample($formattedName); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php new file mode 100644 index 000000000000..8f47e47eabf2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php @@ -0,0 +1,57 @@ +generateDownloadUrl(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php new file mode 100644 index 000000000000..fff703d3d6d1 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php @@ -0,0 +1,77 @@ +generateUploadUrl(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php new file mode 100644 index 000000000000..8cdd9c74f902 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php @@ -0,0 +1,70 @@ +getFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( + '[PROJECT]', + '[LOCATION]', + '[FUNCTION]' + ); + + get_function_sample($formattedName); +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..7d5f9df65ad5 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php @@ -0,0 +1,68 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php new file mode 100644 index 000000000000..9a163ed63d13 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php @@ -0,0 +1,58 @@ +listFunctions(); + + /** @var CloudFunction $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 cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php new file mode 100644 index 000000000000..e8bcd3814df5 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/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 cloudfunctions_v1_generated_CloudFunctionsService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..b1a06b2632ff --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php @@ -0,0 +1,70 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..f7ce83e8395c --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php @@ -0,0 +1,77 @@ +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 cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php new file mode 100644 index 000000000000..c3a85dedaa99 --- /dev/null +++ b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php @@ -0,0 +1,68 @@ +updateFunction($function); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CloudFunction $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()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php new file mode 100644 index 000000000000..e423650fbff2 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php @@ -0,0 +1,34 @@ +cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $data = 'data'; + * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); + * } finally { + * $cloudFunctionsServiceClient->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 CloudFunctionsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.functions.v1.CloudFunctionsService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $cloudFunctionNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $locationNameTemplate; + + private static $repositoryNameTemplate; + + 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/cloud_functions_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/cloud_functions_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/cloud_functions_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/cloud_functions_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getCloudFunctionNameTemplate() + { + if (self::$cloudFunctionNameTemplate == null) { + self::$cloudFunctionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); + } + + return self::$cloudFunctionNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRepositoryNameTemplate() + { + if (self::$repositoryNameTemplate == null) { + self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); + } + + return self::$repositoryNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'cloudFunction' => self::getCloudFunctionNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'repository' => self::getRepositoryNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * cloud_function resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted cloud_function resource. + */ + public static function cloudFunctionName($project, $location, $function) + { + return self::getCloudFunctionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName($project, $location, $repository) + { + return self::getRepositoryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cloudFunction: projects/{project}/locations/{location}/functions/{function} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * + * 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 'cloudfunctions.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); + } + + /** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $data = 'data'; + * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function to be called. + * @param string $data Required. Input to be passed to the function. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\CallFunctionResponse + * + * @throws ApiException if the remote call fails + */ + public function callFunction($name, $data, array $optionalArgs = []) + { + $request = new CallFunctionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setData($data); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CallFunction', CallFunctionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedLocation = $cloudFunctionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $function = new CloudFunction(); + * $operationResponse = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); + * $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 = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $location Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @param CloudFunction $function Required. Function 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 createFunction($location, $function, array $optionalArgs = []) + { + $request = new CreateFunctionRequest(); + $requestParamHeaders = []; + $request->setLocation($location); + $request->setFunction($function); + $requestParamHeaders['location'] = $location; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $operationResponse = $cloudFunctionsServiceClient->deleteFunction($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 = $cloudFunctionsServiceClient->deleteFunction($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'deleteFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which should be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteFunction($name, array $optionalArgs = []) + { + $request = new DeleteFunctionRequest(); + $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $response = $cloudFunctionsServiceClient->generateDownloadUrl(); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @type int $versionId + * The optional version of function. If not set, default, current version + * is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\GenerateDownloadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateDownloadUrl(array $optionalArgs = []) + { + $request = new GenerateDownloadUrlRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['versionId'])) { + $request->setVersionId($optionalArgs['versionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $response = $cloudFunctionsServiceClient->generateUploadUrl(); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/*/locations/*`. + * @type string $kmsKeyName + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\GenerateUploadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateUploadUrl(array $optionalArgs = []) + { + $request = new GenerateUploadUrlRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['kmsKeyName'])) { + $request->setKmsKeyName($optionalArgs['kmsKeyName']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $cloudFunctionsServiceClient->getFunction($formattedName); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which details should be obtained. + * @param array $optionalArgs { + * Optional. + * + * @type int $versionId + * Optional. The optional version of the function whose details should be + * obtained. The version of a 1st Gen function is an integer that starts from + * 1 and gets incremented on redeployments. Each deployment creates a config + * version of the underlying function. GCF may keep historical configs for old + * versions. This field can be specified to fetch the historical configs. + * Leave it blank or set to 0 to get the latest version of the function. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V1\CloudFunction + * + * @throws ApiException if the remote call fails + */ + public function getFunction($name, array $optionalArgs = []) + { + $request = new GetFunctionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['versionId'])) { + $request->setVersionId($optionalArgs['versionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFunction', CloudFunction::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function exists and does not have a policy + * set. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $response = $cloudFunctionsServiceClient->getIamPolicy($resource); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The project and location from which the function should be listed, + * specified in the format `projects/*/locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @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 listFunctions(array $optionalArgs = []) + { + $request = new ListFunctionsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); + } + + /** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $cloudFunctionsServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $cloudFunctionsServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates existing function. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * $function = new CloudFunction(); + * $operationResponse = $cloudFunctionsServiceClient->updateFunction($function); + * $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 = $cloudFunctionsServiceClient->updateFunction($function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'updateFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param CloudFunction $function Required. New version of the function. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Required. The list of fields in `CloudFunction` that have to be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateFunction($function, array $optionalArgs = []) + { + $request = new UpdateFunctionRequest(); + $requestParamHeaders = []; + $request->setFunction($function); + $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..eeb514889328 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json @@ -0,0 +1,78 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.functions.v1", + "libraryPackage": "Google\\Cloud\\Functions\\V1", + "services": { + "CloudFunctionsService": { + "clients": { + "grpc": { + "libraryClient": "CloudFunctionsServiceGapicClient", + "rpcs": { + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json new file mode 100644 index 000000000000..fd458597923c --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json @@ -0,0 +1,105 @@ +{ + "interfaces": { + "google.cloud.functions.v1.CloudFunctionsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ], + "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 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CallFunction": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GenerateDownloadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateUploadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFunctions": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFunction": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php new file mode 100644 index 000000000000..0fa06f2e23bd --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php @@ -0,0 +1,79 @@ + [ + 'google.cloud.functions.v1.CloudFunctionsService' => [ + 'CreateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListFunctions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFunctions', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + ], + ], +]; diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php new file mode 100644 index 000000000000..5cbbcec88874 --- /dev/null +++ b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php @@ -0,0 +1,188 @@ + [ + 'google.cloud.functions.v1.CloudFunctionsService' => [ + 'CallFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:call', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{location=projects/*/locations/*}/functions', + 'body' => 'function', + 'placeholders' => [ + 'location' => [ + 'getters' => [ + 'getLocation', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'ListFunctions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{function.name=projects/*/locations/*/functions/*}', + 'body' => 'function', + 'placeholders' => [ + 'function.name' => [ + 'getters' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/operations', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php new file mode 100644 index 000000000000..8fb42777775e --- /dev/null +++ b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php @@ -0,0 +1,1091 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CloudFunctionsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CloudFunctionsServiceClient($options); + } + + /** @test */ + public function callFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $executionId = 'executionId-1217171550'; + $result = 'result-934426595'; + $error = 'error96784904'; + $expectedResponse = new CallFunctionResponse(); + $expectedResponse->setExecutionId($executionId); + $expectedResponse->setResult($result); + $expectedResponse->setError($error); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $data = 'data3076010'; + $response = $gapicClient->callFunction($formattedName, $data); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/CallFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getData(); + $this->assertProtobufEquals($data, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function callFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $data = 'data3076010'; + try { + $gapicClient->callFunction($formattedName, $data); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId = 670497310; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new CloudFunction(); + $response = $gapicClient->createFunction($formattedLocation, $function); + $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.functions.v1.CloudFunctionsService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getLocation(); + $this->assertProtobufEquals($formattedLocation, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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 + $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new CloudFunction(); + $response = $gapicClient->createFunction($formattedLocation, $function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($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.functions.v1.CloudFunctionsService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + $response = $gapicClient->generateDownloadUrl(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateDownloadUrl', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->generateDownloadUrl(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + $response = $gapicClient->generateUploadUrl(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateUploadUrl', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->generateUploadUrl(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId2 = 102817515; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId2); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->getFunction($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.functions.v1.CloudFunctionsService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->getFunction($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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/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 listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new CloudFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listFunctions(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/ListFunctions', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->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->listFunctions(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; + $entryPoint = 'entryPoint-799136893'; + $runtime = 'runtime1550962648'; + $availableMemoryMb = 1964533661; + $serviceAccountEmail = 'serviceAccountEmail-1300473088'; + $versionId = 670497310; + $network = 'network1843485230'; + $maxInstances = 330682013; + $minInstances = 1491624145; + $vpcConnector = 'vpcConnector1732864119'; + $kmsKeyName = 'kmsKeyName2094986649'; + $buildWorkerPool = 'buildWorkerPool1575447532'; + $buildId = 'buildId-1430655860'; + $buildName = 'buildName-470597188'; + $sourceToken = 'sourceToken1671283925'; + $dockerRepository = 'dockerRepository-1273385271'; + $buildServiceAccount = 'buildServiceAccount-1152257326'; + $expectedResponse = new CloudFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); + $expectedResponse->setEntryPoint($entryPoint); + $expectedResponse->setRuntime($runtime); + $expectedResponse->setAvailableMemoryMb($availableMemoryMb); + $expectedResponse->setServiceAccountEmail($serviceAccountEmail); + $expectedResponse->setVersionId($versionId); + $expectedResponse->setNetwork($network); + $expectedResponse->setMaxInstances($maxInstances); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setVpcConnector($vpcConnector); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setBuildWorkerPool($buildWorkerPool); + $expectedResponse->setBuildId($buildId); + $expectedResponse->setBuildName($buildName); + $expectedResponse->setSourceToken($sourceToken); + $expectedResponse->setDockerRepository($dockerRepository); + $expectedResponse->setBuildServiceAccount($buildServiceAccount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new CloudFunction(); + $response = $gapicClient->updateFunction($function); + $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.functions.v1.CloudFunctionsService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new CloudFunction(); + $response = $gapicClient->updateFunction($function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php b/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php new file mode 100644 index 0000000000000000000000000000000000000000..67d1301d26f56e0946fa7041a44867ba9a09b719 GIT binary patch literal 12405 zcmcIq&2t;sabJ+)2OdZW9FZbKNnU8Q(NbIqu%WfGOMUDPfFTza1i%1DSuQ4%0Wbu| z0x|H+fD%{5q$ERO*^>{cO4T0n2k4aF`N-Y!{H$duG1G{Ccr#hC^=^B|<*BZ1lyMtcKHLaeLImjOW zNHea4^z?nh>FX^cwOP$QHC(-|yZX*1W3ZE_40bj=20Po?2ZXe`y5pq$m*h1`;a`8y z?3%5V>^jgO1?G)!p$9~Yau<}PK zPoyeU1{ASV?74>B)4Mwb!)e)O-?i*2hOV!74A)m7eY1L7OiS6ByQx(!k*)WZ6 zJ7?_a2c~78kF;h8a~WI6lGW?jgI>?$?%@S$nu{Atg*ob*9t%T2^n@>?9}g zHkQ4W=Il>VcRELh=ho?g;*N|2lUgEA?7Ok#sR)t^Q+oSb2^uXs#6 z^{0Jr;Z&cI>8{>1x=wO7H3@xXJc5(vnf7NbF$%Tk+J{mBilahka6(7#7)~NWE@0M&JM=#V&BnT7>63On=9-a+hiV9buz|I$fb1^KM6=9X>vYQBaq zvFzK_ymFVsf=Y{#Nr)z_d7exi=-q+A?Rb6SlZgChWQwUsS|SVehSE^At#ZAp=8GFe zwUBsEB4k?0H;UV8B0`@xlwt|*C!~22EvVH}<$1BZnV5vv%ofy=+MvHKNHH?ARen;g zJS!)r*8lt)iH=~^v*ykuT`k4MMZOXju5 z^=K{XJv!N0?@|6;gv2mWK5F4s#u``r*z43ehnf{sQB8bw4vxJYJ%O|n=J zl{d(&KQu`e>*}^zD>j~w=r&5G)LN}lgKD9%XG*P1)i)u{k_*N1MkO&R|0$WTBb$M- z*I7O%#mRJY(0XCGVn^}YYEp#>Nw7y9o;1>MMFZ2MbcHPN<6Rr{yO!S8s0GuQ6P5oy zLP*W%TY~!%i8XD#*V^NzOv$5PyeCOy*3~=w9izj$MPz^0{=VsI&YsQ!5FbgzwrOTt zh`2zaHm2a@Jb=O|+osK;PZXTy%pSJG)oi0u=AkOD=@+lp7+TV zJBYcZ<#s;A>GVdqLEdN4hJ6|hy=BTJ)=R6Jr`%vp!$i?{1O5gMLm3d1n zdn3d~_^wM&d|!hf2m`=*M=k85w^AS53_k!Klh{kkeqq><%Ib0_%iVsX+#(;Gy})OT zf>t|{MwS96opzwxrrzx0+?;0T=I0>-1CM}bTUYe!1 zS{8PjovqQ82jt4xD|-8J86T1PeR8!>$v;tRT20+7)*H3aD1Vtq`AWH=6w84z2>Cd0 zm0F{?f#cODO-$sL$&xV5VK0&YgWxb2$^-9_8L>p+05Y@xYh(o+MpYw7sa~kvTLVOH z0|{)~VMoW5lq3oLKsS-2b!m#VPjx>J%Z)hTbq{BwC5{>dh&RdyM8+qW z1aiVr9U;Hwq87Qql3WfKxM9rn%7}g8PDd&UgLJZ<#SgVuexA`$d~}jVfHj+ z#Iv7_&A!MP_&iyjY9c}Q^VI8PNf?VJ{6RDJvE9sLqtY$%9lhH{MWOHRBI+YlcaeEI z^ibxfa54d2v(i&?4Q2xSj%?*R{IZph5>rYgtx;1pHj4Sgg#3zJ z95uESxdxVD>`^U%OXZn{zhH{l_|Iawq1MVuiO)76T_wvSACz)I+sv18NQR%$_!m_4 zcgRXz&2O>Hx`Y(FG_t4#5YX=`rhTS7uVdy*Yr?E@x>+YUNjK|@;NoECS2drt?9Cow@ zr$ntn-D;c5wUTDaJAOe^AWvovb)ckS!m%aFzq~-^)F5W?37PTW1~xvBZNch$u5PzR z!>I>1Tqbcr%JKvsM_DF>k!q}zV$}vsd?tWT2!LbP>;l^LmL6K9QyBo6VYu`unF9vx z44Rs2_05(@oNoR>iM&y+ldJsO31R6_Nj@t|Qlx}c{1L>9Ip~q)ip-%Y{t?gK3yBs% zMW$<%mZ!yZwGj!LZSCnedAcl9j55taROGQ|X*SQtqjvH$06)}6*UJN*Fr@@9|0K&DBv*2UWPvN_ta-%Y*j+#mq}E2vB}K=P$h03Y$v55 z#DVWF0yaklaW4Ct9+6EVZ5pnJ1k`xAMzI!v<8oJVua^>X^kwO$y!B9GE4o?A8#7eJL} zExV00x_QWrRX!q1BLX^obP){cJ~;+CplBKqZiZN%w?dls^^8|E{`j)^mCv9Dmt+tqwL2hhG09-Fo&#rO!!H+!e;8(}d zgl(n#Hy3zxJDx%aR79pMrWK*%k3&Mou#}udTJT)?^#qv_&m$cZx@yzucXfe>(_$?O zT!eNUIy@-Gvk$-JyZ~c61`U@lb({7c9UiZw5v!yi<=9p!eMAy~rEG(v%o>He7&IBn zE_h@%RpQ_~sPG2CzN~!vV!a?Dj+E9SCPm_sF1t@!*5J2!XHIJ;lkeC8Y8!xE&%G0OC zdL5}P-c8Fu6HW!>jr7GtflXw0-(0&^`KJT zCJQn>=|J&B}d0O+=8IzcTIU}9AowzhH?9w(txERIZJq_ zuD?kL`+p;H!0O4%# z7v2ZY_qT_2BB)xuHw=^KyH8Pt;Z`AsJjZSo(%j+#6Mc~+$_o5-xGi=nc*p!Tw^c0B z1{pd!b+xu#%&Tx&{AkpQo11D4ehZG`i&m?YN;xI}1m26cV#x8^X}SEC_8cMx&DIf2 zYBUJ2dc9cIspMIQg>t@N0z?9)J1o|MjzpjC7aYn0iec zypIGL;AGYUoyoO8Lvrm%`b~t)59RMtSa)M+q$g!qk7a~_pUv{)uN6_f3<=E(nlr=> zG*YFXPmuU<(l3PxF+9{0`?|LmflDB1-{jl<@Xi`snO2K07bCeXU&O ztGu%-iUj`w)dJJTr!wEdaka7T*DBI4pqJq?BUCTLL&wz1Z~ve4vgj*h!25W#reO-n zW$!ba_6DTKHSU0B{yTz{W2p2A)y(kFF*Wm7&`g0W32X2VVRrrNoJJCG=(Te?^j8tG z;N|*$F(!p!J|{+d>;2gCkW*5HQ;39f|A1{;LH>+w+Spdy5jRMEnb#w0((fbWk~dSJ zD3ZdU#Z$(63kt)@PbCveDzPPP$jZ55D=u~NOR)jT>7xD#kZZ7Hkyw~<_q2x?l&L! z;`W=rnwZ?oZ+xRz=jzNV{t5b)J3jP=1MBAEa#ZHE|LgGR8|C@id;IsuorWdgn1KBc z-sYI?^|9B%oA|UPk68j8ea!Wv&|dBOxJwY7J+K!~VBH?8(fN4XDg0h4Ch?y!&7Yi& zQhWIS*vk-I0?Z(u!ufkB_}Kgf%uZLp0d(;HJiH-r;}rd{t^yU3whX}H)i^i(>ZdUB zG1K79HeA=MQD`Icn%*h2@pzPJc^3w$=7kL=P{Qv*} literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/AutomaticUpdatePolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/AutomaticUpdatePolicy.php new file mode 100644 index 000000000000..b30ace2a41a9 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/AutomaticUpdatePolicy.php @@ -0,0 +1,34 @@ +google.cloud.functions.v2.AutomaticUpdatePolicy + */ +class AutomaticUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php new file mode 100644 index 000000000000..ad0033887c63 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php @@ -0,0 +1,599 @@ +google.cloud.functions.v2.BuildConfig + */ +class BuildConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $build = ''; + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + */ + protected $runtime = ''; + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + */ + protected $entry_point = ''; + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + */ + protected $source = null; + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_provenance = null; + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + */ + protected $worker_pool = ''; + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + */ + private $environment_variables; + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + */ + protected $docker_registry = 0; + /** + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + */ + protected $docker_repository = ''; + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + */ + protected $service_account = ''; + protected $runtime_update_policy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $automatic_update_policy + * @type \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $on_deploy_update_policy + * @type string $build + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * @type string $runtime + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * @type string $entry_point + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * @type \Google\Cloud\Functions\V2\Source $source + * The location of the function source code. + * @type \Google\Cloud\Functions\V2\SourceProvenance $source_provenance + * Output only. A permanent fixed identifier for source. + * @type string $worker_pool + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * User-provided build-time environment variables for the function + * @type int $docker_registry + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * @type string $docker_repository + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * @type string $service_account + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; + * @return \Google\Cloud\Functions\V2\AutomaticUpdatePolicy|null + */ + public function getAutomaticUpdatePolicy() + { + return $this->readOneof(40); + } + + public function hasAutomaticUpdatePolicy() + { + return $this->hasOneof(40); + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; + * @param \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $var + * @return $this + */ + public function setAutomaticUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\AutomaticUpdatePolicy::class); + $this->writeOneof(40, $var); + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @return \Google\Cloud\Functions\V2\OnDeployUpdatePolicy|null + */ + public function getOnDeployUpdatePolicy() + { + return $this->readOneof(41); + } + + public function hasOnDeployUpdatePolicy() + { + return $this->hasOneof(41); + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @param \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $var + * @return $this + */ + public function setOnDeployUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\OnDeployUpdatePolicy::class); + $this->writeOneof(41, $var); + + return $this; + } + + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getBuild() + { + return $this->build; + } + + /** + * Output only. The Cloud Build name of the latest successful deployment of + * the function. + * + * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBuild($var) + { + GPBUtil::checkString($var, True); + $this->build = $var; + + return $this; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + * @return string + */ + public function getRuntime() + { + return $this->runtime; + } + + /** + * The runtime in which to run the function. Required when deploying a new + * function, optional when updating an existing function. For a complete + * list of possible choices, see the + * [`gcloud` command + * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + * + * Generated from protobuf field string runtime = 2; + * @param string $var + * @return $this + */ + public function setRuntime($var) + { + GPBUtil::checkString($var, True); + $this->runtime = $var; + + return $this; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + * @return string + */ + public function getEntryPoint() + { + return $this->entry_point; + } + + /** + * The name of the function (as defined in source code) that will be + * executed. Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, then the + * system will try to use function named "function". + * For Node.js this is name of a function exported by the module specified + * in `source_location`. + * + * Generated from protobuf field string entry_point = 3; + * @param string $var + * @return $this + */ + public function setEntryPoint($var) + { + GPBUtil::checkString($var, True); + $this->entry_point = $var; + + return $this; + } + + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + * @return \Google\Cloud\Functions\V2\Source|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * The location of the function source code. + * + * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; + * @param \Google\Cloud\Functions\V2\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\Source::class); + $this->source = $var; + + return $this; + } + + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Functions\V2\SourceProvenance|null + */ + public function getSourceProvenance() + { + return $this->source_provenance; + } + + public function hasSourceProvenance() + { + return isset($this->source_provenance); + } + + public function clearSourceProvenance() + { + unset($this->source_provenance); + } + + /** + * Output only. A permanent fixed identifier for source. + * + * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Functions\V2\SourceProvenance $var + * @return $this + */ + public function setSourceProvenance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\SourceProvenance::class); + $this->source_provenance = $var; + + return $this; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + * @return string + */ + public function getWorkerPool() + { + return $this->worker_pool; + } + + /** + * Name of the Cloud Build Custom Worker Pool that should be used to build the + * function. The format of this field is + * `projects/{project}/locations/{region}/workerPools/{workerPool}` where + * {project} and {region} are the project id and region respectively where the + * worker pool is defined and {workerPool} is the short name of the worker + * pool. + * If the project id is not the same as the function, then the Cloud + * Functions Service Agent + * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role Cloud Build Custom Workers Builder + * (roles/cloudbuild.customworkers.builder) in the project. + * + * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWorkerPool($var) + { + GPBUtil::checkString($var, True); + $this->worker_pool = $var; + + return $this; + } + + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * User-provided build-time environment variables for the function + * + * Generated from protobuf field map environment_variables = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + * @return int + */ + public function getDockerRegistry() + { + return $this->docker_registry; + } + + /** + * Docker Registry to use for this deployment. This configuration is only + * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact + * Registry. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; + * @param int $var + * @return $this + */ + public function setDockerRegistry($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\BuildConfig\DockerRegistry::class); + $this->docker_registry = $var; + + return $this; + } + + /** + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getDockerRepository() + { + return $this->docker_repository; + } + + /** + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' + * for every deployed region. + * It must match the pattern + * `projects/{project}/locations/{location}/repositories/{repository}`. + * Cross-project repositories are not supported. + * Cross-location repositories are not supported. + * Repository format must be 'DOCKER'. + * + * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDockerRepository($var) + { + GPBUtil::checkString($var, True); + $this->docker_repository = $var; + + return $this; + } + + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * @return string + */ + public function getRuntimeUpdatePolicy() + { + return $this->whichOneof("runtime_update_policy"); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php new file mode 100644 index 000000000000..dc5838f431f2 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php @@ -0,0 +1,69 @@ +google.cloud.functions.v2.BuildConfig.DockerRegistry + */ +class DockerRegistry +{ + /** + * Unspecified. + * + * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; + */ + const DOCKER_REGISTRY_UNSPECIFIED = 0; + /** + * Docker images will be stored in multi-regional Container Registry + * repositories named `gcf`. + * + * Generated from protobuf enum CONTAINER_REGISTRY = 1; + */ + const CONTAINER_REGISTRY = 1; + /** + * Docker images will be stored in regional Artifact Registry repositories. + * By default, GCF will create and use repositories named `gcf-artifacts` + * in every region in which a function is deployed. But the repository to + * use can also be specified by the user using the `docker_repository` + * field. + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 2; + */ + const ARTIFACT_REGISTRY = 2; + + private static $valueToName = [ + self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', + self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DockerRegistry::class, \Google\Cloud\Functions\V2\BuildConfig_DockerRegistry::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php new file mode 100644 index 000000000000..903e08f50551 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php @@ -0,0 +1,184 @@ +google.cloud.functions.v2.CreateFunctionRequest + */ +class CreateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + */ + protected $function_id = ''; + + /** + * @param string $parent Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Functions\V2\PBFunction $function Required. Function to be created. + * @param string $functionId The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * @return \Google\Cloud\Functions\V2\CreateFunctionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Functions\V2\PBFunction $function, string $functionId): self + { + return (new self()) + ->setParent($parent) + ->setFunction($function) + ->setFunctionId($functionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @type \Google\Cloud\Functions\V2\PBFunction $function + * Required. Function to be created. + * @type string $function_id + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the function should be created, + * 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 in which the function should be created, + * 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; + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V2\PBFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. Function to be created. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V2\PBFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); + $this->function = $var; + + return $this; + } + + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + * @return string + */ + public function getFunctionId() + { + return $this->function_id; + } + + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * + * Generated from protobuf field string function_id = 3; + * @param string $var + * @return $this + */ + public function setFunctionId($var) + { + GPBUtil::checkString($var, True); + $this->function_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php new file mode 100644 index 000000000000..cd7afb9522a6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php @@ -0,0 +1,81 @@ +google.cloud.functions.v2.DeleteFunctionRequest + */ +class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which should be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the function which should be deleted. Please see + * {@see FunctionServiceClient::functionName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\DeleteFunctionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which should be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which should be deleted. + * + * 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 function which should be deleted. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php new file mode 100644 index 000000000000..a1fd8153a794 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php @@ -0,0 +1,61 @@ +google.cloud.functions.v2.Environment + */ +class Environment +{ + /** + * Unspecified + * + * Generated from protobuf enum ENVIRONMENT_UNSPECIFIED = 0; + */ + const ENVIRONMENT_UNSPECIFIED = 0; + /** + * Gen 1 + * + * Generated from protobuf enum GEN_1 = 1; + */ + const GEN_1 = 1; + /** + * Gen 2 + * + * Generated from protobuf enum GEN_2 = 2; + */ + const GEN_2 = 2; + + private static $valueToName = [ + self::ENVIRONMENT_UNSPECIFIED => 'ENVIRONMENT_UNSPECIFIED', + self::GEN_1 => 'GEN_1', + self::GEN_2 => 'GEN_2', + ]; + + 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php new file mode 100644 index 000000000000..15ec540f1dd6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php @@ -0,0 +1,147 @@ +google.cloud.functions.v2.EventFilter + */ +class EventFilter extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attribute = ''; + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $operator = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $attribute + * Required. The name of a CloudEvents attribute. + * @type string $value + * Required. The value for the attribute. + * @type string $operator + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * Required. The name of a CloudEvents attribute. + * + * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAttribute($var) + { + GPBUtil::checkString($var, True); + $this->attribute = $var; + + return $this; + } + + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The value for the attribute. + * + * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Optional. The operator used for matching the events with the value of the + * filter. If not specified, only events that have an exact key-value pair + * specified in the filter are matched. The only allowed value is + * `match-path-pattern`. + * + * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOperator($var) + { + GPBUtil::checkString($var, True); + $this->operator = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php new file mode 100644 index 000000000000..62813744547d --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php @@ -0,0 +1,432 @@ +google.cloud.functions.v2.EventTrigger + */ +class EventTrigger extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $trigger = ''; + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + */ + protected $trigger_region = ''; + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event_type = ''; + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + */ + private $event_filters; + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $pubsub_topic = ''; + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_email = ''; + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retry_policy = 0; + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $channel = ''; + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $trigger + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * @type string $trigger_region + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * @type string $event_type + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * @type array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $event_filters + * Criteria used to filter events. + * @type string $pubsub_topic + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * @type string $service_account_email + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * @type int $retry_policy + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * @type string $channel + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * @type string $service + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getTrigger() + { + return $this->trigger; + } + + /** + * Output only. The resource name of the Eventarc trigger. The format of this + * field is `projects/{project}/locations/{region}/triggers/{trigger}`. + * + * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTrigger($var) + { + GPBUtil::checkString($var, True); + $this->trigger = $var; + + return $this; + } + + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + * @return string + */ + public function getTriggerRegion() + { + return $this->trigger_region; + } + + /** + * The region that the trigger will be in. The trigger will only receive + * events originating in this region. It can be the same + * region as the function, a different region or multi-region, or the global + * region. If not provided, defaults to the same region as the function. + * + * Generated from protobuf field string trigger_region = 2; + * @param string $var + * @return $this + */ + public function setTriggerRegion($var) + { + GPBUtil::checkString($var, True); + $this->trigger_region = $var; + + return $this; + } + + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEventType() + { + return $this->event_type; + } + + /** + * Required. The type of event to observe. For example: + * `google.cloud.audit.log.v1.written` or + * `google.cloud.pubsub.topic.v1.messagePublished`. + * + * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEventType($var) + { + GPBUtil::checkString($var, True); + $this->event_type = $var; + + return $this; + } + + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEventFilters() + { + return $this->event_filters; + } + + /** + * Criteria used to filter events. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; + * @param array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEventFilters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\EventFilter::class); + $this->event_filters = $arr; + + return $this; + } + + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getPubsubTopic() + { + return $this->pubsub_topic; + } + + /** + * Optional. The name of a Pub/Sub topic in the same project that will be used + * as the transport topic for the event delivery. Format: + * `projects/{project}/topics/{topic}`. + * This is only valid for events of type + * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + * will not be deleted at function deletion. + * + * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPubsubTopic($var) + { + GPBUtil::checkString($var, True); + $this->pubsub_topic = $var; + + return $this; + } + + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * Optional. The email of the trigger's service account. The service account + * must have permission to invoke Cloud Run services, the permission is + * `run.routes.invoke`. + * If empty, defaults to the Compute Engine default service account: + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRetryPolicy() + { + return $this->retry_policy; + } + + /** + * Optional. If unset, then defaults to ignoring failures (i.e. not retrying + * them). + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRetryPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\EventTrigger\RetryPolicy::class); + $this->retry_policy = $var; + + return $this; + } + + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * Optional. The name of the channel associated with the trigger in + * `projects/{project}/locations/{location}/channels/{channel}` format. + * You must provide a channel to receive events from Eventarc SaaS partners. + * + * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkString($var, True); + $this->channel = $var; + + return $this; + } + + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php new file mode 100644 index 000000000000..fe9035ebeee4 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php @@ -0,0 +1,66 @@ +google.cloud.functions.v2.EventTrigger.RetryPolicy + */ +class RetryPolicy +{ + /** + * Not specified. + * + * Generated from protobuf enum RETRY_POLICY_UNSPECIFIED = 0; + */ + const RETRY_POLICY_UNSPECIFIED = 0; + /** + * Do not retry. + * + * Generated from protobuf enum RETRY_POLICY_DO_NOT_RETRY = 1; + */ + const RETRY_POLICY_DO_NOT_RETRY = 1; + /** + * Retry on any failure, retry up to 7 days with an exponential backoff + * (capped at 10 seconds). + * + * Generated from protobuf enum RETRY_POLICY_RETRY = 2; + */ + const RETRY_POLICY_RETRY = 2; + + private static $valueToName = [ + self::RETRY_POLICY_UNSPECIFIED => 'RETRY_POLICY_UNSPECIFIED', + self::RETRY_POLICY_DO_NOT_RETRY => 'RETRY_POLICY_DO_NOT_RETRY', + self::RETRY_POLICY_RETRY => 'RETRY_POLICY_RETRY', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RetryPolicy::class, \Google\Cloud\Functions\V2\EventTrigger_RetryPolicy::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php new file mode 100644 index 000000000000..6e003ddc46aa --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.GenerateDownloadUrlRequest + */ +class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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 function for which source code Google Cloud Storage + * signed URL should be generated. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php new file mode 100644 index 000000000000..c49cbe0ed3f5 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.GenerateDownloadUrlResponse + */ +class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + */ + protected $download_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $download_url + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @return string + */ + public function getDownloadUrl() + { + return $this->download_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for + * function source code download. + * + * Generated from protobuf field string download_url = 1; + * @param string $var + * @return $this + */ + public function setDownloadUrl($var) + { + GPBUtil::checkString($var, True); + $this->download_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php new file mode 100644 index 000000000000..e61cc8639a76 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php @@ -0,0 +1,199 @@ +google.cloud.functions.v2.GenerateUploadUrlRequest + */ +class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + */ + protected $environment = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * @type string $kms_key_name + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @type int $environment + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, 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 in which the Google Cloud Storage signed + * URL should be generated, 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; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php new file mode 100644 index 000000000000..ec4ee0a82cfa --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php @@ -0,0 +1,139 @@ +google.cloud.functions.v2.GenerateUploadUrlResponse + */ +class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + */ + protected $upload_url = ''; + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + */ + protected $storage_source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $upload_url + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * @type \Google\Cloud\Functions\V2\StorageSource $storage_source + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @return string + */ + public function getUploadUrl() + { + return $this->upload_url; + } + + /** + * The generated Google Cloud Storage signed URL that should be used for a + * function source code upload. The uploaded file should be a zip archive + * which contains a function. + * + * Generated from protobuf field string upload_url = 1; + * @param string $var + * @return $this + */ + public function setUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->upload_url = $var; + + return $this; + } + + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getStorageSource() + { + return $this->storage_source; + } + + public function hasStorageSource() + { + return isset($this->storage_source); + } + + public function clearStorageSource() + { + unset($this->storage_source); + } + + /** + * The location of the source code in the upload bucket. + * Once the archive is uploaded using the `upload_url` use this field to + * set the `function.build_config.source.storage_source` + * during CreateFunction and UpdateFunction. + * Generation defaults to 0, as Cloud Storage provides a new generation only + * upon uploading a new object or version of an object. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->storage_source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php new file mode 100644 index 000000000000..015177d21580 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php @@ -0,0 +1,135 @@ +google.cloud.functions.v2.GetFunctionRequest + */ +class GetFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the function which details should be obtained. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $revision = ''; + + /** + * @param string $name Required. The name of the function which details should be obtained. Please see + * {@see FunctionServiceClient::functionName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\GetFunctionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the function which details should be obtained. + * @type string $revision + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the function which details should be obtained. + * + * 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 function which details should be obtained. + * + * 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. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php new file mode 100644 index 000000000000..993b0f979c80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php @@ -0,0 +1,278 @@ +google.cloud.functions.v2.ListFunctionsRequest + */ +class ListFunctionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. Please see + * {@see FunctionServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\ListFunctionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable locations. + * @type int $page_size + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * @type string $page_token + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @type string $filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type string $order_by + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of functions to return per call. The largest allowed + * page_size is 1,000, if the page_size is omitted or specified as greater + * than 1,000 then it will be replaced as 1,000. The size of the list + * response can be less than specified when used with filters. + * + * 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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 + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` 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; + } + + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php new file mode 100644 index 000000000000..edfa21aa7abe --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php @@ -0,0 +1,143 @@ +google.cloud.functions.v2.ListFunctionsResponse + */ +class ListFunctionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + */ + private $functions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. The response does not include any + * functions from these locations. + * + * 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\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $functions + * The functions that match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. The response does not include any + * functions from these locations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * The functions that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; + * @param array<\Google\Cloud\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFunctions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\PBFunction::class); + $this->functions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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. The response does not include any + * functions from these locations. + * + * 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. The response does not include any + * functions from these locations. + * + * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php new file mode 100644 index 000000000000..7b4e50584294 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php @@ -0,0 +1,124 @@ +google.cloud.functions.v2.ListRuntimesRequest + */ +class ListRuntimesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the runtimes 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 = ''; + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Functions\V2\ListRuntimesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * @type string $filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the runtimes 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 runtimes 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; + } + + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php new file mode 100644 index 000000000000..b833f9d472e1 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.ListRuntimesResponse + */ +class ListRuntimesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + */ + private $runtimes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $runtimes + * The runtimes that match the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRuntimes() + { + return $this->runtimes; + } + + /** + * The runtimes that match the request. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; + * @param array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRuntimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime::class); + $this->runtimes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php new file mode 100644 index 000000000000..2928581dd1a4 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php @@ -0,0 +1,295 @@ +google.cloud.functions.v2.ListRuntimesResponse.Runtime + */ +class Runtime extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + */ + protected $display_name = ''; + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + */ + protected $stage = 0; + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + */ + private $warnings; + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + */ + protected $environment = 0; + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + */ + protected $deprecation_date = null; + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + */ + protected $decommission_date = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * @type string $display_name + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * @type int $stage + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * @type array|\Google\Protobuf\Internal\RepeatedField $warnings + * Warning messages, e.g., a deprecation warning. + * @type int $environment + * The environment for the runtime. + * @type \Google\Type\Date $deprecation_date + * Deprecation date for the runtime. + * @type \Google\Type\Date $decommission_date + * Decommission date for the runtime. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the runtime, e.g., 'go113', 'nodejs12', etc. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + * + * Generated from protobuf field string display_name = 5; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + * @return int + */ + public function getStage() + { + return $this->stage; + } + + /** + * The stage of life this runtime is in, e.g., BETA, GA, etc. + * + * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; + * @param int $var + * @return $this + */ + public function setStage($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ListRuntimesResponse\RuntimeStage::class); + $this->stage = $var; + + return $this; + } + + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * Warning messages, e.g., a deprecation warning. + * + * Generated from protobuf field repeated string warnings = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWarnings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->warnings = $arr; + + return $this; + } + + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The environment for the runtime. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + * @return \Google\Type\Date|null + */ + public function getDeprecationDate() + { + return $this->deprecation_date; + } + + public function hasDeprecationDate() + { + return isset($this->deprecation_date); + } + + public function clearDeprecationDate() + { + unset($this->deprecation_date); + } + + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDeprecationDate($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->deprecation_date = $var; + + return $this; + } + + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + * @return \Google\Type\Date|null + */ + public function getDecommissionDate() + { + return $this->decommission_date; + } + + public function hasDecommissionDate() + { + return isset($this->decommission_date); + } + + public function clearDecommissionDate() + { + unset($this->decommission_date); + } + + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDecommissionDate($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->decommission_date = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Runtime::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_Runtime::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php new file mode 100644 index 000000000000..60d76ac6285e --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php @@ -0,0 +1,92 @@ +google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage + */ +class RuntimeStage +{ + /** + * Not specified. + * + * Generated from protobuf enum RUNTIME_STAGE_UNSPECIFIED = 0; + */ + const RUNTIME_STAGE_UNSPECIFIED = 0; + /** + * The runtime is in development. + * + * Generated from protobuf enum DEVELOPMENT = 1; + */ + const DEVELOPMENT = 1; + /** + * The runtime is in the Alpha stage. + * + * Generated from protobuf enum ALPHA = 2; + */ + const ALPHA = 2; + /** + * The runtime is in the Beta stage. + * + * Generated from protobuf enum BETA = 3; + */ + const BETA = 3; + /** + * The runtime is generally available. + * + * Generated from protobuf enum GA = 4; + */ + const GA = 4; + /** + * The runtime is deprecated. + * + * Generated from protobuf enum DEPRECATED = 5; + */ + const DEPRECATED = 5; + /** + * The runtime is no longer supported. + * + * Generated from protobuf enum DECOMMISSIONED = 6; + */ + const DECOMMISSIONED = 6; + + private static $valueToName = [ + self::RUNTIME_STAGE_UNSPECIFIED => 'RUNTIME_STAGE_UNSPECIFIED', + self::DEVELOPMENT => 'DEVELOPMENT', + self::ALPHA => 'ALPHA', + self::BETA => 'BETA', + self::GA => 'GA', + self::DEPRECATED => 'DEPRECATED', + self::DECOMMISSIONED => 'DECOMMISSIONED', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RuntimeStage::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_RuntimeStage::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php new file mode 100644 index 000000000000..f6f8e06ea974 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + */ + private $environments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $environments + * The Cloud Function environments this location supports. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnvironments() + { + return $this->environments; + } + + /** + * The Cloud Function environments this location supports. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnvironments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Functions\V2\Environment::class); + $this->environments = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php new file mode 100644 index 000000000000..471df8d867e2 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.OnDeployUpdatePolicy + */ +class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $runtime_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $runtime_version + * Output only. contains the runtime version which was used during latest + * function deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRuntimeVersion() + { + return $this->runtime_version; + } + + /** + * Output only. contains the runtime version which was used during latest + * function deployment. + * + * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRuntimeVersion($var) + { + GPBUtil::checkString($var, True); + $this->runtime_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php new file mode 100644 index 000000000000..b6394ceb74f7 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php @@ -0,0 +1,495 @@ +google.cloud.functions.v2.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + */ + protected $status_detail = ''; + /** + * Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool cancel_requested = 6; + */ + protected $cancel_requested = false; + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + */ + protected $api_version = ''; + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + */ + protected $request_resource = null; + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + */ + private $stages; + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + */ + protected $source_token = ''; + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + */ + protected $build_name = ''; + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + */ + protected $operation_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * @type string $status_detail + * Human-readable status of the operation, if any. + * @type bool $cancel_requested + * Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * @type string $api_version + * API version used to start the operation. + * @type \Google\Protobuf\Any $request_resource + * The original request that started the operation. + * @type array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $stages + * Mechanism for reporting in-progress stages + * @type string $source_token + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * @type string $build_name + * The build name of the function for create and update operations. + * @type int $operation_type + * The operation type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @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); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @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); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @return string + */ + public function getStatusDetail() + { + return $this->status_detail; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @param string $var + * @return $this + */ + public function setStatusDetail($var) + { + GPBUtil::checkString($var, True); + $this->status_detail = $var; + + return $this; + } + + /** + * Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool cancel_requested = 6; + * @return bool + */ + public function getCancelRequested() + { + return $this->cancel_requested; + } + + /** + * Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field bool cancel_requested = 6; + * @param bool $var + * @return $this + */ + public function setCancelRequested($var) + { + GPBUtil::checkBool($var); + $this->cancel_requested = $var; + + return $this; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 7; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + * @return \Google\Protobuf\Any|null + */ + public function getRequestResource() + { + return $this->request_resource; + } + + public function hasRequestResource() + { + return isset($this->request_resource); + } + + public function clearRequestResource() + { + unset($this->request_resource); + } + + /** + * The original request that started the operation. + * + * Generated from protobuf field .google.protobuf.Any request_resource = 8; + * @param \Google\Protobuf\Any $var + * @return $this + */ + public function setRequestResource($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); + $this->request_resource = $var; + + return $this; + } + + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStages() + { + return $this->stages; + } + + /** + * Mechanism for reporting in-progress stages + * + * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; + * @param array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\Stage::class); + $this->stages = $arr; + + return $this; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + * @return int + */ + public function getOperationType() + { + return $this->operation_type; + } + + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + * @param int $var + * @return $this + */ + public function setOperationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\OperationType::class); + $this->operation_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php new file mode 100644 index 000000000000..00296bf3ca85 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php @@ -0,0 +1,68 @@ +google.cloud.functions.v2.OperationType + */ +class OperationType +{ + /** + * Unspecified + * + * Generated from protobuf enum OPERATIONTYPE_UNSPECIFIED = 0; + */ + const OPERATIONTYPE_UNSPECIFIED = 0; + /** + * CreateFunction + * + * Generated from protobuf enum CREATE_FUNCTION = 1; + */ + const CREATE_FUNCTION = 1; + /** + * UpdateFunction + * + * Generated from protobuf enum UPDATE_FUNCTION = 2; + */ + const UPDATE_FUNCTION = 2; + /** + * DeleteFunction + * + * Generated from protobuf enum DELETE_FUNCTION = 3; + */ + const DELETE_FUNCTION = 3; + + private static $valueToName = [ + self::OPERATIONTYPE_UNSPECIFIED => 'OPERATIONTYPE_UNSPECIFIED', + self::CREATE_FUNCTION => 'CREATE_FUNCTION', + self::UPDATE_FUNCTION => 'UPDATE_FUNCTION', + self::DELETE_FUNCTION => 'DELETE_FUNCTION', + ]; + + 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php new file mode 100644 index 000000000000..f910190061c4 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php @@ -0,0 +1,592 @@ +google.cloud.functions.v2.Function + */ +class PBFunction extends \Google\Protobuf\Internal\Message +{ + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + */ + protected $build_config = null; + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + */ + protected $service_config = null; + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + */ + protected $event_trigger = null; + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $state_messages; + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + */ + protected $environment = 0; + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $url = ''; + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $satisfies_pzs = false; + /** + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * @type string $description + * User-provided description of a function. + * @type \Google\Cloud\Functions\V2\BuildConfig $build_config + * Describes the Build step of the function that builds a container from the + * given source. + * @type \Google\Cloud\Functions\V2\ServiceConfig $service_config + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * @type \Google\Cloud\Functions\V2\EventTrigger $event_trigger + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * @type int $state + * Output only. State of the function. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last update timestamp of a Cloud Function. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this Cloud Function. + * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages + * Output only. State Messages for this Cloud Function. + * @type int $environment + * Describe whether the function is 1st Gen or 2nd Gen. + * @type string $url + * Output only. The deployed url for the function. + * @type string $kms_key_name + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * @type bool $satisfies_pzs + * Output only. Reserved for future use. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A user-defined name of the function. Function names must be unique + * globally and match pattern `projects/*/locations/*/functions/*` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of a function. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + * @return \Google\Cloud\Functions\V2\BuildConfig|null + */ + public function getBuildConfig() + { + return $this->build_config; + } + + public function hasBuildConfig() + { + return isset($this->build_config); + } + + public function clearBuildConfig() + { + unset($this->build_config); + } + + /** + * Describes the Build step of the function that builds a container from the + * given source. + * + * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; + * @param \Google\Cloud\Functions\V2\BuildConfig $var + * @return $this + */ + public function setBuildConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\BuildConfig::class); + $this->build_config = $var; + + return $this; + } + + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + * @return \Google\Cloud\Functions\V2\ServiceConfig|null + */ + public function getServiceConfig() + { + return $this->service_config; + } + + public function hasServiceConfig() + { + return isset($this->service_config); + } + + public function clearServiceConfig() + { + unset($this->service_config); + } + + /** + * Describes the Service being deployed. Currently deploys services to Cloud + * Run (fully managed). + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; + * @param \Google\Cloud\Functions\V2\ServiceConfig $var + * @return $this + */ + public function setServiceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\ServiceConfig::class); + $this->service_config = $var; + + return $this; + } + + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + * @return \Google\Cloud\Functions\V2\EventTrigger|null + */ + public function getEventTrigger() + { + return $this->event_trigger; + } + + public function hasEventTrigger() + { + return isset($this->event_trigger); + } + + public function clearEventTrigger() + { + unset($this->event_trigger); + } + + /** + * An Eventarc trigger managed by Google Cloud Functions that fires events in + * response to a condition in another service. + * + * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; + * @param \Google\Cloud\Functions\V2\EventTrigger $var + * @return $this + */ + public function setEventTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\EventTrigger::class); + $this->event_trigger = $var; + + return $this; + } + + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\PBFunction\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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 last update timestamp of a Cloud Function. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this Cloud Function. + * + * Generated from protobuf field map labels = 8; + * @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; + } + + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStateMessages() + { + return $this->state_messages; + } + + /** + * Output only. State Messages for this Cloud Function. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStateMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); + $this->state_messages = $arr; + + return $this; + } + + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Describe whether the function is 1st Gen or 2nd Gen. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The deployed url for the function. + * + * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function resources. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getSatisfiesPzs() + { + return $this->satisfies_pzs; + } + + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setSatisfiesPzs($var) + { + GPBUtil::checkBool($var); + $this->satisfies_pzs = $var; + + return $this; + } + + /** + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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 create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php new file mode 100644 index 000000000000..f6e8c8a0e5cd --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php @@ -0,0 +1,86 @@ +google.cloud.functions.v2.Function.State + */ +class State +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Function has been successfully deployed and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Function deployment failed and the function is not serving. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * Function is being created or updated. + * + * Generated from protobuf enum DEPLOYING = 3; + */ + const DEPLOYING = 3; + /** + * Function is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * Function deployment failed and the function serving state is undefined. + * The function should be updated or deleted to move it out of this state. + * + * Generated from protobuf enum UNKNOWN = 5; + */ + const UNKNOWN = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::DEPLOYING => 'DEPLOYING', + self::DELETING => 'DELETING', + self::UNKNOWN => 'UNKNOWN', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Functions\V2\Function_State::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php new file mode 100644 index 000000000000..5326f62530e6 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php @@ -0,0 +1,309 @@ +google.cloud.functions.v2.RepoSource + */ +class RepoSource extends \Google\Protobuf\Internal\Message +{ + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + */ + protected $project_id = ''; + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + */ + protected $repo_name = ''; + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + */ + protected $dir = ''; + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + */ + protected $invert_regex = false; + protected $revision; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $branch_name + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * @type string $tag_name + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * @type string $commit_sha + * Explicit commit SHA to build. + * @type string $project_id + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * @type string $repo_name + * Name of the Cloud Source Repository. + * @type string $dir + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * @type bool $invert_regex + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string branch_name = 3; + * @return string + */ + public function getBranchName() + { + return $this->readOneof(3); + } + + public function hasBranchName() + { + return $this->hasOneof(3); + } + + /** + * Regex matching branches to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string branch_name = 3; + * @param string $var + * @return $this + */ + public function setBranchName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string tag_name = 4; + * @return string + */ + public function getTagName() + { + return $this->readOneof(4); + } + + public function hasTagName() + { + return $this->hasOneof(4); + } + + /** + * Regex matching tags to build. + * The syntax of the regular expressions accepted is the syntax accepted by + * RE2 and described at https://github.com/google/re2/wiki/Syntax + * + * Generated from protobuf field string tag_name = 4; + * @param string $var + * @return $this + */ + public function setTagName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Explicit commit SHA to build. + * + * Generated from protobuf field string commit_sha = 5; + * @return string + */ + public function getCommitSha() + { + return $this->readOneof(5); + } + + public function hasCommitSha() + { + return $this->hasOneof(5); + } + + /** + * Explicit commit SHA to build. + * + * Generated from protobuf field string commit_sha = 5; + * @param string $var + * @return $this + */ + public function setCommitSha($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * ID of the project that owns the Cloud Source Repository. If omitted, the + * project ID requesting the build is assumed. + * + * Generated from protobuf field string project_id = 1; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + * @return string + */ + public function getRepoName() + { + return $this->repo_name; + } + + /** + * Name of the Cloud Source Repository. + * + * Generated from protobuf field string repo_name = 2; + * @param string $var + * @return $this + */ + public function setRepoName($var) + { + GPBUtil::checkString($var, True); + $this->repo_name = $var; + + return $this; + } + + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + * @return string + */ + public function getDir() + { + return $this->dir; + } + + /** + * Directory, relative to the source root, in which to run the build. + * This must be a relative path. If a step's `dir` is specified and is an + * absolute path, this value is ignored for that step's execution. + * eg. helloworld (no leading slash allowed) + * + * Generated from protobuf field string dir = 6; + * @param string $var + * @return $this + */ + public function setDir($var) + { + GPBUtil::checkString($var, True); + $this->dir = $var; + + return $this; + } + + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + * @return bool + */ + public function getInvertRegex() + { + return $this->invert_regex; + } + + /** + * Only trigger a build if the revision regex does NOT match the revision + * regex. + * + * Generated from protobuf field bool invert_regex = 7; + * @param bool $var + * @return $this + */ + public function setInvertRegex($var) + { + GPBUtil::checkBool($var); + $this->invert_regex = $var; + + return $this; + } + + /** + * @return string + */ + public function getRevision() + { + return $this->whichOneof("revision"); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php new file mode 100644 index 000000000000..d14b7f6d187b --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php @@ -0,0 +1,191 @@ +google.cloud.functions.v2.SecretEnvVar + */ +class SecretEnvVar extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Name of the environment variable. + * @type string $project_id + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Name of the environment variable. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferably project number but can also be the + * project ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * recommended to use a numeric version for secret environment variables as + * any updates to the secret value is not reflected until new instances + * start. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php new file mode 100644 index 000000000000..505db9251bf8 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php @@ -0,0 +1,203 @@ +google.cloud.functions.v2.SecretVolume + */ +class SecretVolume extends \Google\Protobuf\Internal\Message +{ + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + */ + protected $mount_path = ''; + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + */ + protected $secret = ''; + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + */ + private $versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mount_path + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * @type string $project_id + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * @type string $secret + * Name of the secret in secret manager (not the full resource name). + * @type array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + * @return string + */ + public function getMountPath() + { + return $this->mount_path; + } + + /** + * The path within the container to mount the secret volume. For example, + * setting the mount_path as `/etc/secrets` would mount the secret value files + * under the `/etc/secrets` directory. This directory will also be completely + * shadowed and unavailable to mount any other secrets. + * Recommended mount path: /etc/secrets + * + * Generated from protobuf field string mount_path = 1; + * @param string $var + * @return $this + */ + public function setMountPath($var) + { + GPBUtil::checkString($var, True); + $this->mount_path = $var; + + return $this; + } + + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project identifier (preferably project number but can also be the project + * ID) of the project that contains the secret. If not set, it is + * assumed that the secret is in the same project as the function. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Name of the secret in secret manager (not the full resource name). + * + * Generated from protobuf field string secret = 3; + * @param string $var + * @return $this + */ + public function setSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret = $var; + + return $this; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersions() + { + return $this->versions; + } + + /** + * List of secret versions to mount for this secret. If empty, the `latest` + * version of the secret will be made available in a file named after the + * secret under the mount point. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; + * @param array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume\SecretVersion::class); + $this->versions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php new file mode 100644 index 000000000000..fe99c1e3ddd3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php @@ -0,0 +1,124 @@ +google.cloud.functions.v2.SecretVolume.SecretVersion + */ +class SecretVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * @type string $path + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the secret (version number or the string 'latest'). It is + * preferable to use `latest` version with secret volumes as secret value + * changes are reflected immediately. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Relative path of the file under the mount path where the secret value for + * this version will be fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `secret_foo` would mount the + * secret value file at `/etc/secrets/secret_foo`. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretVersion::class, \Google\Cloud\Functions\V2\SecretVolume_SecretVersion::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php new file mode 100644 index 000000000000..d0d031b1c59c --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php @@ -0,0 +1,848 @@ +google.cloud.functions.v2.ServiceConfig + */ +class ServiceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $service = ''; + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + */ + protected $timeout_seconds = 0; + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + */ + protected $available_memory = ''; + /** + * The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + */ + protected $available_cpu = ''; + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + */ + private $environment_variables; + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + */ + protected $max_instance_count = 0; + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + */ + protected $min_instance_count = 0; + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + */ + protected $vpc_connector = ''; + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + */ + protected $vpc_connector_egress_settings = 0; + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + */ + protected $ingress_settings = 0; + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uri = ''; + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + */ + protected $service_account_email = ''; + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + */ + protected $all_traffic_on_latest_revision = false; + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + */ + private $secret_environment_variables; + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + */ + private $secret_volumes; + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision = ''; + /** + * Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + */ + protected $max_instance_request_concurrency = 0; + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + */ + protected $security_level = 0; + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $binary_authorization_policy = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * @type int $timeout_seconds + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * @type string $available_memory + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * @type string $available_cpu + * The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * @type array|\Google\Protobuf\Internal\MapField $environment_variables + * Environment variables that shall be available during function execution. + * @type int $max_instance_count + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * @type int $min_instance_count + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * @type string $vpc_connector + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * @type int $vpc_connector_egress_settings + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * @type int $ingress_settings + * The ingress settings for the function, controlling what traffic can reach + * it. + * @type string $uri + * Output only. URI of the Service deployed. + * @type string $service_account_email + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * @type bool $all_traffic_on_latest_revision + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * @type array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables + * Secret environment variables configuration. + * @type array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes + * Secret volumes configuration. + * @type string $revision + * Output only. The name of service revision. + * @type int $max_instance_request_concurrency + * Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * @type int $security_level + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * @type string $binary_authorization_policy + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Output only. Name of the service associated with a Function. + * The format of this field is + * `projects/{project}/locations/{region}/services/{service}` + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + * @return int + */ + public function getTimeoutSeconds() + { + return $this->timeout_seconds; + } + + /** + * The function execution timeout. Execution is considered failed and + * can be terminated if the function is not completed at the end of the + * timeout period. Defaults to 60 seconds. + * + * Generated from protobuf field int32 timeout_seconds = 2; + * @param int $var + * @return $this + */ + public function setTimeoutSeconds($var) + { + GPBUtil::checkInt32($var); + $this->timeout_seconds = $var; + + return $this; + } + + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + * @return string + */ + public function getAvailableMemory() + { + return $this->available_memory; + } + + /** + * The amount of memory available for a function. + * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + * supplied the value is interpreted as bytes. + * See + * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + * a full description. + * + * Generated from protobuf field string available_memory = 13; + * @param string $var + * @return $this + */ + public function setAvailableMemory($var) + { + GPBUtil::checkString($var, True); + $this->available_memory = $var; + + return $this; + } + + /** + * The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + * @return string + */ + public function getAvailableCpu() + { + return $this->available_cpu; + } + + /** + * The number of CPUs used in a single container instance. + * Default value is calculated from available memory. + * Supports the same values as Cloud Run, see + * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements + * Example: "1" indicates 1 vCPU + * + * Generated from protobuf field string available_cpu = 22; + * @param string $var + * @return $this + */ + public function setAvailableCpu($var) + { + GPBUtil::checkString($var, True); + $this->available_cpu = $var; + + return $this; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEnvironmentVariables() + { + return $this->environment_variables; + } + + /** + * Environment variables that shall be available during function execution. + * + * Generated from protobuf field map environment_variables = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEnvironmentVariables($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->environment_variables = $arr; + + return $this; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + * @return int + */ + public function getMaxInstanceCount() + { + return $this->max_instance_count; + } + + /** + * The limit on the maximum number of function instances that may coexist at a + * given time. + * In some cases, such as rapid traffic surges, Cloud Functions may, for a + * short period of time, create more instances than the specified max + * instances limit. If your function cannot tolerate this temporary behavior, + * you may want to factor in a safety margin and set a lower max instances + * value than your function can tolerate. + * See the [Max + * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + * more details. + * + * Generated from protobuf field int32 max_instance_count = 5; + * @param int $var + * @return $this + */ + public function setMaxInstanceCount($var) + { + GPBUtil::checkInt32($var); + $this->max_instance_count = $var; + + return $this; + } + + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + * @return int + */ + public function getMinInstanceCount() + { + return $this->min_instance_count; + } + + /** + * The limit on the minimum number of function instances that may coexist at a + * given time. + * Function instances are kept in idle state for a short period after they + * finished executing the request to reduce cold start time for subsequent + * requests. Setting a minimum instance count will ensure that the given + * number of instances are kept running in idle state always. This can help + * with cold start times when jump in incoming request count occurs after the + * idle instance would have been stopped in the default case. + * + * Generated from protobuf field int32 min_instance_count = 12; + * @param int $var + * @return $this + */ + public function setMinInstanceCount($var) + { + GPBUtil::checkInt32($var); + $this->min_instance_count = $var; + + return $this; + } + + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getVpcConnector() + { + return $this->vpc_connector; + } + + /** + * The Serverless VPC Access connector that this cloud function can connect + * to. The format of this field is `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVpcConnector($var) + { + GPBUtil::checkString($var, True); + $this->vpc_connector = $var; + + return $this; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + * @return int + */ + public function getVpcConnectorEgressSettings() + { + return $this->vpc_connector_egress_settings; + } + + /** + * The egress settings for the connector, controlling what traffic is diverted + * through it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + * @param int $var + * @return $this + */ + public function setVpcConnectorEgressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\VpcConnectorEgressSettings::class); + $this->vpc_connector_egress_settings = $var; + + return $this; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + * @return int + */ + public function getIngressSettings() + { + return $this->ingress_settings; + } + + /** + * The ingress settings for the function, controlling what traffic can reach + * it. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; + * @param int $var + * @return $this + */ + public function setIngressSettings($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\IngressSettings::class); + $this->ingress_settings = $var; + + return $this; + } + + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Output only. URI of the Service deployed. + * + * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * The email of the service's service account. If empty, defaults to + * `{project_number}-compute@developer.gserviceaccount.com`. + * + * Generated from protobuf field string service_account_email = 10; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + * @return bool + */ + public function getAllTrafficOnLatestRevision() + { + return $this->all_traffic_on_latest_revision; + } + + /** + * Whether 100% of traffic is routed to the latest revision. + * On CreateFunction and UpdateFunction, when set to true, the revision being + * deployed will serve 100% of traffic, ignoring any traffic split settings, + * if any. On GetFunction, true will be returned if the latest revision is + * serving 100% of traffic. + * + * Generated from protobuf field bool all_traffic_on_latest_revision = 16; + * @param bool $var + * @return $this + */ + public function setAllTrafficOnLatestRevision($var) + { + GPBUtil::checkBool($var); + $this->all_traffic_on_latest_revision = $var; + + return $this; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretEnvironmentVariables() + { + return $this->secret_environment_variables; + } + + /** + * Secret environment variables configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; + * @param array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretEnvironmentVariables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretEnvVar::class); + $this->secret_environment_variables = $arr; + + return $this; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecretVolumes() + { + return $this->secret_volumes; + } + + /** + * Secret volumes configuration. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; + * @param array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecretVolumes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume::class); + $this->secret_volumes = $arr; + + return $this; + } + + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Output only. The name of service revision. + * + * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + + /** + * Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + * @return int + */ + public function getMaxInstanceRequestConcurrency() + { + return $this->max_instance_request_concurrency; + } + + /** + * Sets the maximum number of concurrent requests that each instance + * can receive. Defaults to 1. + * + * Generated from protobuf field int32 max_instance_request_concurrency = 20; + * @param int $var + * @return $this + */ + public function setMaxInstanceRequestConcurrency($var) + { + GPBUtil::checkInt32($var); + $this->max_instance_request_concurrency = $var; + + return $this; + } + + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + * @return int + */ + public function getSecurityLevel() + { + return $this->security_level; + } + + /** + * Security level configure whether the function only accepts https. + * This configuration is only applicable to 1st Gen functions with Http + * trigger. By default https is optional for 1st Gen functions; 2nd Gen + * functions are https ONLY. + * + * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; + * @param int $var + * @return $this + */ + public function setSecurityLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\SecurityLevel::class); + $this->security_level = $var; + + return $this; + } + + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getBinaryAuthorizationPolicy() + { + return $this->binary_authorization_policy; + } + + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setBinaryAuthorizationPolicy($var) + { + GPBUtil::checkString($var, True); + $this->binary_authorization_policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php new file mode 100644 index 000000000000..0dfd22d07834 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php @@ -0,0 +1,73 @@ +google.cloud.functions.v2.ServiceConfig.IngressSettings + */ +class IngressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const INGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Allow HTTP traffic from public and private sources. + * + * Generated from protobuf enum ALLOW_ALL = 1; + */ + const ALLOW_ALL = 1; + /** + * Allow HTTP traffic from only private VPC sources. + * + * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; + */ + const ALLOW_INTERNAL_ONLY = 2; + /** + * Allow HTTP traffic from private VPC sources and through GCLB. + * + * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; + */ + const ALLOW_INTERNAL_AND_GCLB = 3; + + private static $valueToName = [ + self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', + self::ALLOW_ALL => 'ALLOW_ALL', + self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', + self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IngressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_IngressSettings::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php new file mode 100644 index 000000000000..5fb4b8b79894 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.ServiceConfig.SecurityLevel + */ +class SecurityLevel +{ + /** + * Unspecified. + * + * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; + */ + const SECURITY_LEVEL_UNSPECIFIED = 0; + /** + * Requests for a URL that match this handler that do not use HTTPS are + * automatically redirected to the HTTPS URL with the same path. Query + * parameters are reserved for the redirect. + * + * Generated from protobuf enum SECURE_ALWAYS = 1; + */ + const SECURE_ALWAYS = 1; + /** + * Both HTTP and HTTPS requests with URLs that match the handler succeed + * without redirects. The application can examine the request to determine + * which protocol was used and respond accordingly. + * + * Generated from protobuf enum SECURE_OPTIONAL = 2; + */ + const SECURE_OPTIONAL = 2; + + private static $valueToName = [ + self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', + self::SECURE_ALWAYS => 'SECURE_ALWAYS', + self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityLevel::class, \Google\Cloud\Functions\V2\ServiceConfig_SecurityLevel::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php new file mode 100644 index 000000000000..77a3f98e3ae3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php @@ -0,0 +1,67 @@ +google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings + */ +class VpcConnectorEgressSettings +{ + /** + * Unspecified. + * + * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + */ + const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + /** + * Use the VPC Access Connector only for private IP space from RFC1918. + * + * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; + */ + const PRIVATE_RANGES_ONLY = 1; + /** + * Force the use of VPC Access Connector for all egress traffic from the + * function. + * + * Generated from protobuf enum ALL_TRAFFIC = 2; + */ + const ALL_TRAFFIC = 2; + + private static $valueToName = [ + self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', + self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', + self::ALL_TRAFFIC => 'ALL_TRAFFIC', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_VpcConnectorEgressSettings::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php new file mode 100644 index 000000000000..b16cd2dea16e --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php @@ -0,0 +1,150 @@ +google.cloud.functions.v2.Source + */ +class Source extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\StorageSource $storage_source + * If provided, get the source from this location in Google Cloud Storage. + * @type \Google\Cloud\Functions\V2\RepoSource $repo_source + * If provided, get the source from this location in a Cloud Source + * Repository. + * @type string $git_uri + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * If provided, get the source from this location in Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getStorageSource() + { + return $this->readOneof(1); + } + + public function hasStorageSource() + { + return $this->hasOneof(1); + } + + /** + * If provided, get the source from this location in Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If provided, get the source from this location in a Cloud Source + * Repository. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; + * @return \Google\Cloud\Functions\V2\RepoSource|null + */ + public function getRepoSource() + { + return $this->readOneof(2); + } + + public function hasRepoSource() + { + return $this->hasOneof(2); + } + + /** + * If provided, get the source from this location in a Cloud Source + * Repository. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; + * @param \Google\Cloud\Functions\V2\RepoSource $var + * @return $this + */ + public function setRepoSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// + * + * Generated from protobuf field string git_uri = 3; + * @return string + */ + public function getGitUri() + { + return $this->readOneof(3); + } + + public function hasGitUri() + { + return $this->hasOneof(3); + } + + /** + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// + * + * Generated from protobuf field string git_uri = 3; + * @param string $var + * @return $this + */ + public function setGitUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php new file mode 100644 index 000000000000..0b1954543663 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php @@ -0,0 +1,168 @@ +google.cloud.functions.v2.SourceProvenance + */ +class SourceProvenance extends \Google\Protobuf\Internal\Message +{ + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + */ + protected $resolved_storage_source = null; + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + */ + protected $resolved_repo_source = null; + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + */ + protected $git_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\StorageSource $resolved_storage_source + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * @type \Google\Cloud\Functions\V2\RepoSource $resolved_repo_source + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * @type string $git_uri + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + * @return \Google\Cloud\Functions\V2\StorageSource|null + */ + public function getResolvedStorageSource() + { + return $this->resolved_storage_source; + } + + public function hasResolvedStorageSource() + { + return isset($this->resolved_storage_source); + } + + public function clearResolvedStorageSource() + { + unset($this->resolved_storage_source); + } + + /** + * A copy of the build's `source.storage_source`, if exists, with any + * generations resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; + * @param \Google\Cloud\Functions\V2\StorageSource $var + * @return $this + */ + public function setResolvedStorageSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); + $this->resolved_storage_source = $var; + + return $this; + } + + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + * @return \Google\Cloud\Functions\V2\RepoSource|null + */ + public function getResolvedRepoSource() + { + return $this->resolved_repo_source; + } + + public function hasResolvedRepoSource() + { + return isset($this->resolved_repo_source); + } + + public function clearResolvedRepoSource() + { + unset($this->resolved_repo_source); + } + + /** + * A copy of the build's `source.repo_source`, if exists, with any + * revisions resolved. + * + * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; + * @param \Google\Cloud\Functions\V2\RepoSource $var + * @return $this + */ + public function setResolvedRepoSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); + $this->resolved_repo_source = $var; + + return $this; + } + + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + * @return string + */ + public function getGitUri() + { + return $this->git_uri; + } + + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + * @param string $var + * @return $this + */ + public function setGitUri($var) + { + GPBUtil::checkString($var, True); + $this->git_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php new file mode 100644 index 000000000000..e965c5a3023b --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php @@ -0,0 +1,237 @@ +google.cloud.functions.v2.Stage + */ +class Stage extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + */ + protected $name = 0; + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + */ + protected $state = 0; + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + */ + protected $resource = ''; + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + */ + protected $resource_uri = ''; + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + */ + private $state_messages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $name + * Name of the Stage. This will be unique for each Stage. + * @type string $message + * Message describing the Stage + * @type int $state + * Current state of the Stage + * @type string $resource + * Resource of the Stage + * @type string $resource_uri + * Link to the current Stage resource + * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages + * State messages from the current Stage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + * @return int + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the Stage. This will be unique for each Stage. + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; + * @param int $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\Name::class); + $this->name = $var; + + return $this; + } + + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Message describing the Stage + * + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Current state of the Stage + * + * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\State::class); + $this->state = $var; + + return $this; + } + + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Resource of the Stage + * + * Generated from protobuf field string resource = 4; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + * @return string + */ + public function getResourceUri() + { + return $this->resource_uri; + } + + /** + * Link to the current Stage resource + * + * Generated from protobuf field string resource_uri = 5; + * @param string $var + * @return $this + */ + public function setResourceUri($var) + { + GPBUtil::checkString($var, True); + $this->resource_uri = $var; + + return $this; + } + + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStateMessages() + { + return $this->state_messages; + } + + /** + * State messages from the current Stage. + * + * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; + * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStateMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); + $this->state_messages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php new file mode 100644 index 000000000000..6dbaa6f06046 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php @@ -0,0 +1,92 @@ +google.cloud.functions.v2.Stage.Name + */ +class Name +{ + /** + * Not specified. Invalid name. + * + * Generated from protobuf enum NAME_UNSPECIFIED = 0; + */ + const NAME_UNSPECIFIED = 0; + /** + * Artifact Regsitry Stage + * + * Generated from protobuf enum ARTIFACT_REGISTRY = 1; + */ + const ARTIFACT_REGISTRY = 1; + /** + * Build Stage + * + * Generated from protobuf enum BUILD = 2; + */ + const BUILD = 2; + /** + * Service Stage + * + * Generated from protobuf enum SERVICE = 3; + */ + const SERVICE = 3; + /** + * Trigger Stage + * + * Generated from protobuf enum TRIGGER = 4; + */ + const TRIGGER = 4; + /** + * Service Rollback Stage + * + * Generated from protobuf enum SERVICE_ROLLBACK = 5; + */ + const SERVICE_ROLLBACK = 5; + /** + * Trigger Rollback Stage + * + * Generated from protobuf enum TRIGGER_ROLLBACK = 6; + */ + const TRIGGER_ROLLBACK = 6; + + private static $valueToName = [ + self::NAME_UNSPECIFIED => 'NAME_UNSPECIFIED', + self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', + self::BUILD => 'BUILD', + self::SERVICE => 'SERVICE', + self::TRIGGER => 'TRIGGER', + self::SERVICE_ROLLBACK => 'SERVICE_ROLLBACK', + self::TRIGGER_ROLLBACK => 'TRIGGER_ROLLBACK', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Name::class, \Google\Cloud\Functions\V2\Stage_Name::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php new file mode 100644 index 000000000000..5a0be65fc0dc --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.Stage.State + */ +class State +{ + /** + * Not specified. Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Stage has not started. + * + * Generated from protobuf enum NOT_STARTED = 1; + */ + const NOT_STARTED = 1; + /** + * Stage is in progress. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * Stage has completed. + * + * Generated from protobuf enum COMPLETE = 3; + */ + const COMPLETE = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::NOT_STARTED => 'NOT_STARTED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::COMPLETE => 'COMPLETE', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Functions\V2\Stage_State::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php new file mode 100644 index 000000000000..9e318e5af10f --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php @@ -0,0 +1,135 @@ +google.cloud.functions.v2.StateMessage + */ +class StateMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + */ + protected $severity = 0; + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * The message. + * + * Generated from protobuf field string message = 3; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $severity + * Severity of the state message. + * @type string $type + * One-word CamelCase type of the state message. + * @type string $message + * The message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Severity of the state message. + * + * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\StateMessage\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * One-word CamelCase type of the state message. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The message. + * + * Generated from protobuf field string message = 3; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * The message. + * + * Generated from protobuf field string message = 3; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php new file mode 100644 index 000000000000..d201473a95e0 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php @@ -0,0 +1,71 @@ +google.cloud.functions.v2.StateMessage.Severity + */ +class Severity +{ + /** + * Not specified. Invalid severity. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * ERROR-level severity. + * + * Generated from protobuf enum ERROR = 1; + */ + const ERROR = 1; + /** + * WARNING-level severity. + * + * Generated from protobuf enum WARNING = 2; + */ + const WARNING = 2; + /** + * INFO-level severity. + * + * Generated from protobuf enum INFO = 3; + */ + const INFO = 3; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::ERROR => 'ERROR', + self::WARNING => 'WARNING', + self::INFO => 'INFO', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\Functions\V2\StateMessage_Severity::class); + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php new file mode 100644 index 000000000000..ddeebbd71e96 --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php @@ -0,0 +1,197 @@ +google.cloud.functions.v2.StorageSource + */ +class StorageSource extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + */ + protected $bucket = ''; + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + */ + protected $object = ''; + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + */ + protected $generation = 0; + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + */ + protected $source_upload_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $bucket + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * @type string $object + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * @type int|string $generation + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * @type string $source_upload_url + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + * @return string + */ + public function getBucket() + { + return $this->bucket; + } + + /** + * Google Cloud Storage bucket containing the source (see + * [Bucket Name + * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + * + * Generated from protobuf field string bucket = 1; + * @param string $var + * @return $this + */ + public function setBucket($var) + { + GPBUtil::checkString($var, True); + $this->bucket = $var; + + return $this; + } + + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + * @return string + */ + public function getObject() + { + return $this->object; + } + + /** + * Google Cloud Storage object containing the source. + * This object must be a gzipped archive file (`.tar.gz`) containing source to + * build. + * + * Generated from protobuf field string object = 2; + * @param string $var + * @return $this + */ + public function setObject($var) + { + GPBUtil::checkString($var, True); + $this->object = $var; + + return $this; + } + + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + * @return int|string + */ + public function getGeneration() + { + return $this->generation; + } + + /** + * Google Cloud Storage generation for the object. If the generation is + * omitted, the latest generation will be used. + * + * Generated from protobuf field int64 generation = 3; + * @param int|string $var + * @return $this + */ + public function setGeneration($var) + { + GPBUtil::checkInt64($var); + $this->generation = $var; + + return $this; + } + + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + * @return string + */ + public function getSourceUploadUrl() + { + return $this->source_upload_url; + } + + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + * @param string $var + * @return $this + */ + public function setSourceUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->source_upload_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php new file mode 100644 index 000000000000..3834e2723d6e --- /dev/null +++ b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php @@ -0,0 +1,141 @@ +google.cloud.functions.v2.UpdateFunctionRequest + */ +class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $function = null; + /** + * The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Functions\V2\PBFunction $function Required. New version of the function. + * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * + * @return \Google\Cloud\Functions\V2\UpdateFunctionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Functions\V2\PBFunction $function, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setFunction($function) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Functions\V2\PBFunction $function + * Required. New version of the function. + * @type \Google\Protobuf\FieldMask $update_mask + * The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); + parent::__construct($data); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Functions\V2\PBFunction|null + */ + public function getFunction() + { + return $this->function; + } + + public function hasFunction() + { + return isset($this->function); + } + + public function clearFunction() + { + unset($this->function); + } + + /** + * Required. New version of the function. + * + * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Functions\V2\PBFunction $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); + $this->function = $var; + + return $this; + } + + /** + * The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @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); + } + + /** + * The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php new file mode 100644 index 000000000000..9973077ba5d3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php @@ -0,0 +1,88 @@ +setParent($formattedParent) + ->setFunction($function); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->createFunction($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_function_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php new file mode 100644 index 000000000000..d4b706eed552 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php @@ -0,0 +1,82 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->deleteFunction($request); + $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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + delete_function_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php new file mode 100644 index 000000000000..8c67ca295d6e --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var GenerateDownloadUrlResponse $response */ + $response = $functionServiceClient->generateDownloadUrl($request); + 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + generate_download_url_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php new file mode 100644 index 000000000000..450230528989 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php @@ -0,0 +1,94 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var GenerateUploadUrlResponse $response */ + $response = $functionServiceClient->generateUploadUrl($request); + 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 +{ + $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + generate_upload_url_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php new file mode 100644 index 000000000000..eee78f27db80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PBFunction $response */ + $response = $functionServiceClient->getFunction($request); + 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + + get_function_sample($formattedName); +} +// [END cloudfunctions_v2_generated_FunctionService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..6a84bd75b393 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $functionServiceClient->getIamPolicy($request); + 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 cloudfunctions_v2_generated_FunctionService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php new file mode 100644 index 000000000000..2211ba2247b3 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $functionServiceClient->listFunctions($request); + + /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_functions_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php new file mode 100644 index 000000000000..287d79cf8c32 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @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 cloudfunctions_v2_generated_FunctionService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php new file mode 100644 index 000000000000..aca8dd8c813e --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php @@ -0,0 +1,72 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var ListRuntimesResponse $response */ + $response = $functionServiceClient->listRuntimes($request); + 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 +{ + $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_runtimes_sample($formattedParent); +} +// [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..97295556fbfc --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $functionServiceClient->setIamPolicy($request); + 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 cloudfunctions_v2_generated_FunctionService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..93d2ca86cb79 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $functionServiceClient->testIamPermissions($request); + 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 cloudfunctions_v2_generated_FunctionService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php new file mode 100644 index 000000000000..600989041e80 --- /dev/null +++ b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php @@ -0,0 +1,71 @@ +setFunction($function); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $functionServiceClient->updateFunction($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBFunction $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()); + } +} +// [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php new file mode 100644 index 000000000000..4c68a6e338d2 --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php @@ -0,0 +1,832 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/function_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * Formats a string containing the fully-qualified path to represent a build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName(string $project, string $location, string $build): string + { + return self::getPathTemplate('build')->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName(string $project, string $location, string $channel): string + { + return self::getPathTemplate('channel')->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName(string $project, string $location, string $connector): string + { + return self::getPathTemplate('connector')->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('cryptoKey')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName(string $project, string $location, string $function): string + { + return self::getPathTemplate('function')->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * 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(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName(string $project, string $location, string $repository): string + { + return self::getPathTemplate('repository')->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $location, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName(string $project, string $topic): string + { + return self::getPathTemplate('topic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a trigger + * resource. + * + * @param string $project + * @param string $location + * @param string $trigger + * + * @return string The formatted trigger resource. + */ + public static function triggerName(string $project, string $location, string $trigger): string + { + return self::getPathTemplate('trigger')->render([ + 'project' => $project, + 'location' => $location, + 'trigger' => $trigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName(string $project, string $location, string $workerPool): string + { + return self::getPathTemplate('workerPool')->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - function: projects/{project}/locations/{location}/functions/{function} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - service: projects/{project}/locations/{location}/services/{service} + * - topic: projects/{project}/topics/{topic} + * - trigger: projects/{project}/locations/{location}/triggers/{trigger} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'cloudfunctions.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * The async variant is {@see FunctionServiceClient::createFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/create_function.php + * + * @param CreateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFunction(CreateFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateFunction', $request, $callOptions)->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * The async variant is {@see FunctionServiceClient::deleteFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/delete_function.php + * + * @param DeleteFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteFunction(DeleteFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteFunction', $request, $callOptions)->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * The async variant is {@see FunctionServiceClient::generateDownloadUrlAsync()} . + * + * @example samples/V2/FunctionServiceClient/generate_download_url.php + * + * @param GenerateDownloadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateDownloadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $callOptions = []): GenerateDownloadUrlResponse + { + return $this->startApiCall('GenerateDownloadUrl', $request, $callOptions)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, specify this header: + * + * * `content-type: application/zip` + * + * Do not specify this header: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * The async variant is {@see FunctionServiceClient::generateUploadUrlAsync()} . + * + * @example samples/V2/FunctionServiceClient/generate_upload_url.php + * + * @param GenerateUploadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateUploadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateUploadUrl(GenerateUploadUrlRequest $request, array $callOptions = []): GenerateUploadUrlResponse + { + return $this->startApiCall('GenerateUploadUrl', $request, $callOptions)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * The async variant is {@see FunctionServiceClient::getFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/get_function.php + * + * @param GetFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PBFunction + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFunction(GetFunctionRequest $request, array $callOptions = []): PBFunction + { + return $this->startApiCall('GetFunction', $request, $callOptions)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * The async variant is {@see FunctionServiceClient::listFunctionsAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_functions.php + * + * @param ListFunctionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFunctions(ListFunctionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFunctions', $request, $callOptions); + } + + /** + * Returns a list of runtimes that are supported for the requested project. + * + * The async variant is {@see FunctionServiceClient::listRuntimesAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_runtimes.php + * + * @param ListRuntimesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ListRuntimesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listRuntimes(ListRuntimesRequest $request, array $callOptions = []): ListRuntimesResponse + { + return $this->startApiCall('ListRuntimes', $request, $callOptions)->wait(); + } + + /** + * Updates existing function. + * + * The async variant is {@see FunctionServiceClient::updateFunctionAsync()} . + * + * @example samples/V2/FunctionServiceClient/update_function.php + * + * @param UpdateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateFunction(UpdateFunctionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateFunction', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see FunctionServiceClient::listLocationsAsync()} . + * + * @example samples/V2/FunctionServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see FunctionServiceClient::getIamPolicyAsync()} . + * + * @example samples/V2/FunctionServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see FunctionServiceClient::setIamPolicyAsync()} . + * + * @example samples/V2/FunctionServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->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. + * + * The async variant is {@see FunctionServiceClient::testIamPermissionsAsync()} . + * + * @example samples/V2/FunctionServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php new file mode 100644 index 000000000000..8b0aa3f05d5e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php @@ -0,0 +1,34 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); + * $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 = $functionServiceClient->createFunction($formattedParent, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Functions\V2\Client\FunctionServiceClient}. + */ +class FunctionServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.functions.v2.FunctionService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $buildNameTemplate; + + private static $channelNameTemplate; + + private static $connectorNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $functionNameTemplate; + + private static $locationNameTemplate; + + private static $repositoryNameTemplate; + + private static $serviceNameTemplate; + + private static $topicNameTemplate; + + private static $triggerNameTemplate; + + private static $workerPoolNameTemplate; + + 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/function_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getBuildNameTemplate() + { + if (self::$buildNameTemplate == null) { + self::$buildNameTemplate = new PathTemplate('projects/{project}/locations/{location}/builds/{build}'); + } + + return self::$buildNameTemplate; + } + + private static function getChannelNameTemplate() + { + if (self::$channelNameTemplate == null) { + self::$channelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}'); + } + + return self::$channelNameTemplate; + } + + private static function getConnectorNameTemplate() + { + if (self::$connectorNameTemplate == null) { + self::$connectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/connectors/{connector}'); + } + + return self::$connectorNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getFunctionNameTemplate() + { + if (self::$functionNameTemplate == null) { + self::$functionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); + } + + return self::$functionNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRepositoryNameTemplate() + { + if (self::$repositoryNameTemplate == null) { + self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); + } + + return self::$repositoryNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getTopicNameTemplate() + { + if (self::$topicNameTemplate == null) { + self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$topicNameTemplate; + } + + private static function getTriggerNameTemplate() + { + if (self::$triggerNameTemplate == null) { + self::$triggerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/triggers/{trigger}'); + } + + return self::$triggerNameTemplate; + } + + private static function getWorkerPoolNameTemplate() + { + if (self::$workerPoolNameTemplate == null) { + self::$workerPoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workerPools/{worker_pool}'); + } + + return self::$workerPoolNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'build' => self::getBuildNameTemplate(), + 'channel' => self::getChannelNameTemplate(), + 'connector' => self::getConnectorNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'function' => self::getFunctionNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'repository' => self::getRepositoryNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'topic' => self::getTopicNameTemplate(), + 'trigger' => self::getTriggerNameTemplate(), + 'workerPool' => self::getWorkerPoolNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a build + * resource. + * + * @param string $project + * @param string $location + * @param string $build + * + * @return string The formatted build resource. + */ + public static function buildName($project, $location, $build) + { + return self::getBuildNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'build' => $build, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName($project, $location, $channel) + { + return self::getChannelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName($project, $location, $connector) + { + return self::getConnectorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName($project, $location, $function) + { + return self::getFunctionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * 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 repository + * resource. + * + * @param string $project + * @param string $location + * @param string $repository + * + * @return string The formatted repository resource. + */ + public static function repositoryName($project, $location, $repository) + { + return self::getRepositoryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'repository' => $repository, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName($project, $topic) + { + return self::getTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a trigger + * resource. + * + * @param string $project + * @param string $location + * @param string $trigger + * + * @return string The formatted trigger resource. + */ + public static function triggerName($project, $location, $trigger) + { + return self::getTriggerNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'trigger' => $trigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a worker_pool + * resource. + * + * @param string $project + * @param string $location + * @param string $workerPool + * + * @return string The formatted worker_pool resource. + */ + public static function workerPoolName($project, $location, $workerPool) + { + return self::getWorkerPoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'worker_pool' => $workerPool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - build: projects/{project}/locations/{location}/builds/{build} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - function: projects/{project}/locations/{location}/functions/{function} + * - location: projects/{project}/locations/{location} + * - repository: projects/{project}/locations/{location}/repositories/{repository} + * - service: projects/{project}/locations/{location}/services/{service} + * - topic: projects/{project}/topics/{topic} + * - trigger: projects/{project}/locations/{location}/triggers/{trigger} + * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'cloudfunctions.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 function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); + * $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 = $functionServiceClient->createFunction($formattedParent, $function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` + * @param PBFunction $function Required. Function to be created. + * @param array $optionalArgs { + * Optional. + * + * @type string $functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createFunction($parent, $function, array $optionalArgs = []) + { + $request = new CreateFunctionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFunction($function); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['functionId'])) { + $request->setFunctionId($optionalArgs['functionId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $operationResponse = $functionServiceClient->deleteFunction($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 = $functionServiceClient->deleteFunction($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'deleteFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which should be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteFunction($name, array $optionalArgs = []) + { + $request = new DeleteFunctionRequest(); + $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $functionServiceClient->generateDownloadUrl($formattedName); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of function for which source code Google Cloud Storage + * signed URL should be generated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\GenerateDownloadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateDownloadUrl($name, array $optionalArgs = []) + { + $request = new GenerateDownloadUrlRequest(); + $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('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, specify this header: + * + * * `content-type: application/zip` + * + * Do not specify this header: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $functionServiceClient->generateUploadUrl($formattedParent); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the Google Cloud Storage signed + * URL should be generated, specified in the format `projects/*/locations/*`. + * @param array $optionalArgs { + * Optional. + * + * @type string $kmsKeyName + * [Preview] Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in intermediate Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to an intermediate Cloud Storage bucket. The source code is + * then copied to a versioned directory in the sources bucket in the consumer + * project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). + * @type int $environment + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * For allowed values, use constants defined on {@see \Google\Cloud\Functions\V2\Environment} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\GenerateUploadUrlResponse + * + * @throws ApiException if the remote call fails + */ + public function generateUploadUrl($parent, array $optionalArgs = []) + { + $request = new GenerateUploadUrlRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['kmsKeyName'])) { + $request->setKmsKeyName($optionalArgs['kmsKeyName']); + } + + if (isset($optionalArgs['environment'])) { + $request->setEnvironment($optionalArgs['environment']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a function with the given name from the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + * $response = $functionServiceClient->getFunction($formattedName); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the function which details should be obtained. + * @param array $optionalArgs { + * Optional. + * + * @type string $revision + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\PBFunction + * + * @throws ApiException if the remote call fails + */ + public function getFunction($name, array $optionalArgs = []) + { + $request = new GetFunctionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['revision'])) { + $request->setRevision($optionalArgs['revision']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFunction', PBFunction::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of functions that belong to the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the function should be + * listed, specified in the format `projects/*/locations/*` If you want to + * list functions in all locations, use "-" in place of a location. When + * listing functions in all locations, if one or more location(s) are + * unreachable, the response will contain functions from all reachable + * locations along with the names of any unreachable 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 string $filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type string $orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listFunctions($parent, array $optionalArgs = []) + { + $request = new ListFunctionsRequest(); + $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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); + } + + /** + * Returns a list of runtimes that are supported for the requested project. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $functionServiceClient->listRuntimes($formattedParent); + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the runtimes should be + * listed, specified in the format `projects/*/locations/*` + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Functions\V2\ListRuntimesResponse + * + * @throws ApiException if the remote call fails + */ + public function listRuntimes($parent, array $optionalArgs = []) + { + $request = new ListRuntimesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ListRuntimes', ListRuntimesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates existing function. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $function = new PBFunction(); + * $operationResponse = $functionServiceClient->updateFunction($function); + * $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 = $functionServiceClient->updateFunction($function); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'updateFunction'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $functionServiceClient->close(); + * } + * ``` + * + * @param PBFunction $function Required. New version of the function. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The list of fields to be updated. + * If no field mask is provided, all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateFunction($function, array $optionalArgs = []) + { + $request = new UpdateFunctionRequest(); + $requestParamHeaders = []; + $request->setFunction($function); + $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $functionServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $functionServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $response = $functionServiceClient->getIamPolicy($resource); + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $functionServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $functionServiceClient->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: + * ``` + * $functionServiceClient = new FunctionServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $functionServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $functionServiceClient->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/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json new file mode 100644 index 000000000000..9e109ca2916e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json @@ -0,0 +1,78 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.functions.v2", + "libraryPackage": "Google\\Cloud\\Functions\\V2", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceGapicClient", + "rpcs": { + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json new file mode 100644 index 000000000000..bfc64e4b21e5 --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json @@ -0,0 +1,82 @@ +{ + "interfaces": { + "google.cloud.functions.v2.FunctionService": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateDownloadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GenerateUploadUrl": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListFunctions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListRuntimes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateFunction": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php new file mode 100644 index 000000000000..b0f8d88bbb90 --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php @@ -0,0 +1,227 @@ + [ + 'google.cloud.functions.v2.FunctionService' => [ + 'CreateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', + 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'function.name', + 'fieldAccessors' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\GenerateDownloadUrlResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\GenerateUploadUrlResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\PBFunction', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListFunctions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFunctions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\ListFunctionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Functions\V2\ListRuntimesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'build' => 'projects/{project}/locations/{location}/builds/{build}', + 'channel' => 'projects/{project}/locations/{location}/channels/{channel}', + 'connector' => 'projects/{project}/locations/{location}/connectors/{connector}', + 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', + 'function' => 'projects/{project}/locations/{location}/functions/{function}', + 'location' => 'projects/{project}/locations/{location}', + 'repository' => 'projects/{project}/locations/{location}/repositories/{repository}', + 'service' => 'projects/{project}/locations/{location}/services/{service}', + 'topic' => 'projects/{project}/topics/{topic}', + 'trigger' => 'projects/{project}/locations/{location}/triggers/{trigger}', + 'workerPool' => 'projects/{project}/locations/{location}/workerPools/{worker_pool}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php new file mode 100644 index 000000000000..44d8f539758e --- /dev/null +++ b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php @@ -0,0 +1,196 @@ + [ + 'google.cloud.functions.v2.FunctionService' => [ + 'CreateFunction' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', + 'body' => 'function', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteFunction' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateDownloadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateUploadUrl' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetFunction' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFunctions' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimes' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/runtimes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFunction' => [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{function.name=projects/*/locations/*/functions/*}', + 'body' => 'function', + 'placeholders' => [ + 'function.name' => [ + 'getters' => [ + 'getFunction', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php new file mode 100644 index 000000000000..6ffff536de95 --- /dev/null +++ b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php @@ -0,0 +1,1157 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FunctionServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FunctionServiceClient($options); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunction($request); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new DeleteFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFunction($request); + $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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new DeleteFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GenerateDownloadUrlRequest()) + ->setName($formattedName); + $response = $gapicClient->generateDownloadUrl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GenerateDownloadUrlRequest()) + ->setName($formattedName); + try { + $gapicClient->generateDownloadUrl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GenerateUploadUrlRequest()) + ->setParent($formattedParent); + $response = $gapicClient->generateUploadUrl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new GenerateUploadUrlRequest()) + ->setParent($formattedParent); + try { + $gapicClient->generateUploadUrl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GetFunctionRequest()) + ->setName($formattedName); + $response = $gapicClient->getFunction($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $request = (new GetFunctionRequest()) + ->setName($formattedName); + try { + $gapicClient->getFunction($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new PBFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFunctionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listFunctions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new ListFunctionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listFunctions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListRuntimesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRuntimesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRuntimes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]'); + $request = (new ListRuntimesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRuntimes($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new PBFunction(); + $request = (new UpdateFunctionRequest()) + ->setFunction($function); + $response = $gapicClient->updateFunction($request); + $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new PBFunction(); + $request = (new UpdateFunctionRequest()) + ->setFunction($function); + $response = $gapicClient->updateFunction($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->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); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $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'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $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(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $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 = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $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 = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFunctionAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $request = (new CreateFunctionRequest()) + ->setParent($formattedParent) + ->setFunction($function); + $response = $gapicClient->createFunctionAsync($request)->wait(); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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()); + } +} diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php new file mode 100644 index 000000000000..3abfab83887a --- /dev/null +++ b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php @@ -0,0 +1,1015 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return FunctionServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FunctionServiceClient($options); + } + + /** @test */ + public function createFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $function = new PBFunction(); + $response = $gapicClient->createFunction($formattedParent, $function); + $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + $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 createFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createFunctionTest'); + $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]'); + $function = new PBFunction(); + $response = $gapicClient->createFunction($formattedParent, $function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + $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 deleteFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteFunctionTest'); + $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->deleteFunction($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $downloadUrl = 'downloadUrl1109408056'; + $expectedResponse = new GenerateDownloadUrlResponse(); + $expectedResponse->setDownloadUrl($downloadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->generateDownloadUrl($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.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateDownloadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->generateDownloadUrl($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 generateUploadUrlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uploadUrl = 'uploadUrl-242738639'; + $expectedResponse = new GenerateUploadUrlResponse(); + $expectedResponse->setUploadUrl($uploadUrl); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->generateUploadUrl($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateUploadUrlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->generateUploadUrl($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 getFunctionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + $response = $gapicClient->getFunction($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.functions.v2.FunctionService/GetFunction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFunctionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); + try { + $gapicClient->getFunction($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 listFunctionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $functionsElement = new PBFunction(); + $functions = [ + $functionsElement, + ]; + $expectedResponse = new ListFunctionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFunctions($functions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listFunctions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFunctionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->listFunctions($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 listRuntimesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListRuntimesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listRuntimes($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->listRuntimes($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 updateFunctionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $url = 'url116079'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new PBFunction(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUrl($url); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFunctionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $function = new PBFunction(); + $response = $gapicClient->updateFunction($function); + $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFunction(); + $this->assertProtobufEquals($function, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + $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 updateFunctionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateFunctionTest'); + $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 + $function = new PBFunction(); + $response = $gapicClient->updateFunction($function); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->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()); + } +} From bf5f60c317074a97f2fe3289765b78c1e798de5c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 8 Aug 2024 04:02:07 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- Functions/metadata/V2/Functions.php | Bin 11429 -> 12405 bytes .../generate_upload_url.php | 4 +- .../src}/V2/AutomaticUpdatePolicy.php | 0 Functions/src/V2/BuildConfig.php | 163 +- .../src/V2/Client/FunctionServiceClient.php | 4 +- Functions/src/V2/EventTrigger.php | 54 + .../V2/Gapic/FunctionServiceGapicClient.php | 29 +- Functions/src/V2/GenerateUploadUrlRequest.php | 46 + Functions/src/V2/GetFunctionRequest.php | 54 + .../src/V2/ListRuntimesResponse/Runtime.php | 88 + .../src}/V2/OnDeployUpdatePolicy.php | 2 +- Functions/src/V2/OperationMetadata.php | 134 +- .../src}/V2/OperationType.php | 0 Functions/src/V2/PBFunction.php | 82 + Functions/src/V2/ServiceConfig.php | 54 +- Functions/src/V2/Source.php | 39 + Functions/src/V2/SourceProvenance.php | 38 + Functions/src/V2/StorageSource.php | 42 + Functions/src/V2/UpdateFunctionRequest.php | 15 +- .../V2/Client/FunctionServiceClientTest.php | 8 + .../Unit/V2/FunctionServiceClientTest.php | 6 + .../Google/Cloud/Functions/V1/Functions.php | Bin 9005 -> 0 bytes .../Google/Cloud/Functions/V1/Operations.php | Bin 1271 -> 0 bytes .../Functions/V1/CallFunctionRequest.php | 101 - .../Functions/V1/CallFunctionResponse.php | 143 -- .../Cloud/Functions/V1/CloudFunction.php | 1639 ----------------- .../CloudFunction/AutomaticUpdatePolicy.php | 37 - .../V1/CloudFunction/DockerRegistry.php | 69 - .../V1/CloudFunction/IngressSettings.php | 73 - .../V1/CloudFunction/OnDeployUpdatePolicy.php | 74 - .../VpcConnectorEgressSettings.php | 67 - .../Functions/V1/CloudFunctionStatus.php | 83 - .../Functions/V1/CreateFunctionRequest.php | 115 -- .../Functions/V1/DeleteFunctionRequest.php | 67 - .../Cloud/Functions/V1/EventTrigger.php | 292 --- .../Cloud/Functions/V1/FailurePolicy.php | 76 - .../Functions/V1/FailurePolicy/Retry.php | 40 - .../V1/GenerateDownloadUrlRequest.php | 109 -- .../V1/GenerateDownloadUrlResponse.php | 71 - .../Functions/V1/GenerateUploadUrlRequest.php | 161 -- .../V1/GenerateUploadUrlResponse.php | 75 - .../Cloud/Functions/V1/GetFunctionRequest.php | 121 -- .../Cloud/Functions/V1/HttpsTrigger.php | 101 - .../V1/HttpsTrigger/SecurityLevel.php | 70 - .../Functions/V1/ListFunctionsRequest.php | 167 -- .../Functions/V1/ListFunctionsResponse.php | 151 -- .../Functions/V1/OperationMetadataV1.php | 349 ---- .../Cloud/Functions/V1/OperationType.php | 68 - .../Cloud/Functions/V1/SecretEnvVar.php | 191 -- .../Cloud/Functions/V1/SecretVolume.php | 213 --- .../V1/SecretVolume/SecretVersion.php | 124 -- .../Cloud/Functions/V1/SourceRepository.php | 154 -- .../Functions/V1/UpdateFunctionRequest.php | 121 -- .../call_function.php | 75 - .../create_function.php | 84 - .../delete_function.php | 81 - .../generate_download_url.php | 57 - .../generate_upload_url.php | 77 - .../get_function.php | 70 - .../get_iam_policy.php | 68 - .../list_functions.php | 58 - .../list_locations.php | 58 - .../set_iam_policy.php | 70 - .../test_iam_permissions.php | 77 - .../update_function.php | 68 - .../v1/src/V1/CloudFunctionsServiceClient.php | 34 - .../CloudFunctionsServiceGapicClient.php | 1154 ------------ .../Functions/v1/src/V1/gapic_metadata.json | 78 - ...cloud_functions_service_client_config.json | 105 -- ...ud_functions_service_descriptor_config.php | 79 - ...d_functions_service_rest_client_config.php | 188 -- .../V1/CloudFunctionsServiceClientTest.php | 1091 ----------- .../Google/Cloud/Functions/V2/Functions.php | Bin 12405 -> 0 bytes .../Google/Cloud/Functions/V2/BuildConfig.php | 599 ------ .../V2/BuildConfig/DockerRegistry.php | 69 - .../Functions/V2/CreateFunctionRequest.php | 184 -- .../Functions/V2/DeleteFunctionRequest.php | 81 - .../Google/Cloud/Functions/V2/Environment.php | 61 - .../Google/Cloud/Functions/V2/EventFilter.php | 147 -- .../Cloud/Functions/V2/EventTrigger.php | 432 ----- .../Functions/V2/EventTrigger/RetryPolicy.php | 66 - .../V2/GenerateDownloadUrlRequest.php | 71 - .../V2/GenerateDownloadUrlResponse.php | 71 - .../Functions/V2/GenerateUploadUrlRequest.php | 199 -- .../V2/GenerateUploadUrlResponse.php | 139 -- .../Cloud/Functions/V2/GetFunctionRequest.php | 135 -- .../Functions/V2/ListFunctionsRequest.php | 278 --- .../Functions/V2/ListFunctionsResponse.php | 143 -- .../Functions/V2/ListRuntimesRequest.php | 124 -- .../Functions/V2/ListRuntimesResponse.php | 67 - .../V2/ListRuntimesResponse/Runtime.php | 295 --- .../V2/ListRuntimesResponse/RuntimeStage.php | 92 - .../Cloud/Functions/V2/LocationMetadata.php | 67 - .../Cloud/Functions/V2/OperationMetadata.php | 495 ----- .../Google/Cloud/Functions/V2/PBFunction.php | 592 ------ .../Cloud/Functions/V2/PBFunction/State.php | 86 - .../Google/Cloud/Functions/V2/RepoSource.php | 309 ---- .../Cloud/Functions/V2/SecretEnvVar.php | 191 -- .../Cloud/Functions/V2/SecretVolume.php | 203 -- .../V2/SecretVolume/SecretVersion.php | 124 -- .../Cloud/Functions/V2/ServiceConfig.php | 848 --------- .../V2/ServiceConfig/IngressSettings.php | 73 - .../V2/ServiceConfig/SecurityLevel.php | 71 - .../VpcConnectorEgressSettings.php | 67 - .../src/Google/Cloud/Functions/V2/Source.php | 150 -- .../Cloud/Functions/V2/SourceProvenance.php | 168 -- .../src/Google/Cloud/Functions/V2/Stage.php | 237 --- .../Google/Cloud/Functions/V2/Stage/Name.php | 92 - .../Google/Cloud/Functions/V2/Stage/State.php | 71 - .../Cloud/Functions/V2/StateMessage.php | 135 -- .../Functions/V2/StateMessage/Severity.php | 71 - .../Cloud/Functions/V2/StorageSource.php | 197 -- .../Functions/V2/UpdateFunctionRequest.php | 141 -- .../FunctionServiceClient/create_function.php | 88 - .../FunctionServiceClient/delete_function.php | 82 - .../generate_download_url.php | 76 - .../generate_upload_url.php | 94 - .../V2/FunctionServiceClient/get_function.php | 71 - .../FunctionServiceClient/get_iam_policy.php | 72 - .../FunctionServiceClient/list_functions.php | 81 - .../FunctionServiceClient/list_locations.php | 62 - .../FunctionServiceClient/list_runtimes.php | 72 - .../FunctionServiceClient/set_iam_policy.php | 77 - .../test_iam_permissions.php | 84 - .../FunctionServiceClient/update_function.php | 71 - .../src/V2/Client/FunctionServiceClient.php | 832 --------- .../v2/src/V2/FunctionServiceClient.php | 34 - .../V2/Gapic/FunctionServiceGapicClient.php | 1431 -------------- .../Functions/v2/src/V2/gapic_metadata.json | 78 - .../function_service_client_config.json | 82 - .../function_service_descriptor_config.php | 227 --- .../function_service_rest_client_config.php | 196 -- .../V2/Client/FunctionServiceClientTest.php | 1157 ------------ .../Unit/V2/FunctionServiceClientTest.php | 1015 ---------- 134 files changed, 791 insertions(+), 22388 deletions(-) rename {owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions => Functions/src}/V2/AutomaticUpdatePolicy.php (100%) rename {owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions => Functions/src}/V2/OnDeployUpdatePolicy.php (98%) rename {owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions => Functions/src}/V2/OperationType.php (100%) delete mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Operations.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php delete mode 100644 owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/Gapic/CloudFunctionsServiceGapicClient.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php delete mode 100644 owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php delete mode 100644 owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php delete mode 100644 owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/Gapic/FunctionServiceGapicClient.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php delete mode 100644 owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php delete mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php delete mode 100644 owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php diff --git a/Functions/metadata/V2/Functions.php b/Functions/metadata/V2/Functions.php index 4565d6db8a5e1bec88b5c5a3db9955a231e1c528..67d1301d26f56e0946fa7041a44867ba9a09b719 100644 GIT binary patch delta 1035 zcmZ{j%TE(g6vmmELYX_1wwKbGK0qx|3u;Lk7Df}Lk3orqmeM8=4P$99bz(cyOs7rC zhQytbjk)eL8UbNTG7EMlF5MVS+_*6DKX7H@PVb#kc?7rL{hc%C`_7qn%fBA(A8`0K z=i~G3I(m>Unh3w;WXI+b7=M0m+!}Itm|)Of(e+9dO`3$6EE6VHH*`~ve6ue0w%Kbi z2waV#sW#SB)KKc{4JmYG}REeW+cYBikps!OH zvG7l@or3ODOk~Rmgk)2#mQ%X6rdHr05Q|MyuaT)sF` zx=6t$vNmwH2j+mNYf2fBDch&2$L;D#yf6^*XSB49oUFFCgfJU`B5*g5(Nc-qVyUDz zHPcRw$M0QlLP-$}8$=?Bo$Md^YAJ(z+ysn*(5k8xjkZF3Jkkwyome459hwknGBja^ z^t)xH;R?&Vw6=Xaj34@d^YF_Oe}vufA22HZzrhxCP zwZJfNcLQ%B!?wW`5o0m?uKz$!g1MJtjMciGxB7}V>? z=-8uHB!TFI@hA-mXU2Gr{BhRz(J;GF1FlRLB_e_&Adtz*xkP?8GoN41%1U8=F)OEL zXJ+NJrw0xJcPb|*^0G2hm`_p2!%(r1O`i~1DyHQ*`8df=RL2+jckLz4;$Lz8F4ReZ*FF3XR{{_90HSE51#@esL*Boa70.google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; */ private $docker_registry = 0; /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' * for every deployed region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. @@ -105,6 +104,14 @@ class BuildConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { */ private $docker_repository = ''; + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + */ + private $service_account = ''; + protected $runtime_update_policy; /** * Constructor. @@ -112,6 +119,8 @@ class BuildConfig extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $automatic_update_policy + * @type \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $on_deploy_update_policy * @type string $build * Output only. The Cloud Build name of the latest successful deployment of * the function. @@ -150,21 +159,23 @@ class BuildConfig extends \Google\Protobuf\Internal\Message * Docker Registry to use for this deployment. This configuration is only * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. * @type string $docker_repository - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' * for every deployed region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. * Cross-location repositories are not supported. * Repository format must be 'DOCKER'. + * @type string $service_account + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. * } */ public function __construct($data = NULL) { @@ -172,6 +183,60 @@ public function __construct($data = NULL) { parent::__construct($data); } + /** + * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; + * @return \Google\Cloud\Functions\V2\AutomaticUpdatePolicy|null + */ + public function getAutomaticUpdatePolicy() + { + return $this->readOneof(40); + } + + public function hasAutomaticUpdatePolicy() + { + return $this->hasOneof(40); + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; + * @param \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $var + * @return $this + */ + public function setAutomaticUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\AutomaticUpdatePolicy::class); + $this->writeOneof(40, $var); + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @return \Google\Cloud\Functions\V2\OnDeployUpdatePolicy|null + */ + public function getOnDeployUpdatePolicy() + { + return $this->readOneof(41); + } + + public function hasOnDeployUpdatePolicy() + { + return $this->hasOneof(41); + } + + /** + * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; + * @param \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $var + * @return $this + */ + public function setOnDeployUpdatePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\OnDeployUpdatePolicy::class); + $this->writeOneof(41, $var); + + return $this; + } + /** * Output only. The Cloud Build name of the latest successful deployment of * the function. @@ -418,10 +483,9 @@ public function setEnvironmentVariables($var) * Docker Registry to use for this deployment. This configuration is only * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. * * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; * @return int @@ -435,10 +499,9 @@ public function getDockerRegistry() * Docker Registry to use for this deployment. This configuration is only * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact * Registry. - * If `docker_repository` field is specified, this field will be automatically - * set as `ARTIFACT_REGISTRY`. - * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. - * This field may be overridden by the backend for eligible deployments. + * If unspecified, it defaults to `ARTIFACT_REGISTRY`. + * If `docker_repository` field is specified, this field should either be left + * unspecified or set to `ARTIFACT_REGISTRY`. * * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; * @param int $var @@ -453,10 +516,10 @@ public function setDockerRegistry($var) } /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' * for every deployed region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. @@ -473,10 +536,10 @@ public function getDockerRepository() } /** - * User managed repository created in Artifact Registry optionally - * with a customer managed encryption key. This is the repository to which the - * function docker image will be pushed after it is built by Cloud Build. - * If unspecified, GCF will create and use a repository named 'gcf-artifacts' + * Repository in Artifact Registry to which the function docker image will be + * pushed after it is built by Cloud Build. If specified by user, it is + * created and managed by user with a customer managed encryption key. + * Otherwise, GCF will create and use a repository named 'gcf-artifacts' * for every deployed region. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. @@ -496,5 +559,41 @@ public function setDockerRepository($var) return $this; } + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Service account to be used for building the container. The format of this + * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. + * + * Generated from protobuf field string service_account = 27; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * @return string + */ + public function getRuntimeUpdatePolicy() + { + return $this->whichOneof("runtime_update_policy"); + } + } diff --git a/Functions/src/V2/Client/FunctionServiceClient.php b/Functions/src/V2/Client/FunctionServiceClient.php index 6d90b95620cc..aeb3c083d3c8 100644 --- a/Functions/src/V2/Client/FunctionServiceClient.php +++ b/Functions/src/V2/Client/FunctionServiceClient.php @@ -580,11 +580,11 @@ public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $ * attached, the identity from the credentials would be used, but that * identity does not have permissions to upload files to the URL. * - * When making a HTTP PUT request, these two headers need to be specified: + * When making a HTTP PUT request, specify this header: * * * `content-type: application/zip` * - * And this header SHOULD NOT be specified: + * Do not specify this header: * * * `Authorization: Bearer YOUR_TOKEN` * diff --git a/Functions/src/V2/EventTrigger.php b/Functions/src/V2/EventTrigger.php index 5e4f55d57599..29910994cc7f 100644 --- a/Functions/src/V2/EventTrigger.php +++ b/Functions/src/V2/EventTrigger.php @@ -82,6 +82,17 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $channel = ''; + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $service = ''; /** * Constructor. @@ -123,6 +134,13 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * Optional. The name of the channel associated with the trigger in * `projects/{project}/locations/{location}/channels/{channel}` format. * You must provide a channel to receive events from Eventarc SaaS partners. + * @type string $service + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. * } */ public function __construct($data = NULL) { @@ -374,5 +392,41 @@ public function setChannel($var) return $this; } + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Optional. The hostname of the service that 1st Gen function should be + * observed. + * If no string is provided, the default service implementing the API will + * be used. For example, `storage.googleapis.com` is the default for all + * event types in the `google.storage` namespace. + * The field is only applicable to 1st Gen functions. + * + * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + } diff --git a/Functions/src/V2/Gapic/FunctionServiceGapicClient.php b/Functions/src/V2/Gapic/FunctionServiceGapicClient.php index 370c847ece95..83a42277b879 100644 --- a/Functions/src/V2/Gapic/FunctionServiceGapicClient.php +++ b/Functions/src/V2/Gapic/FunctionServiceGapicClient.php @@ -38,6 +38,7 @@ use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Functions\V2\CreateFunctionRequest; use Google\Cloud\Functions\V2\DeleteFunctionRequest; +use Google\Cloud\Functions\V2\Environment; use Google\Cloud\Functions\V2\GenerateDownloadUrlRequest; use Google\Cloud\Functions\V2\GenerateDownloadUrlResponse; use Google\Cloud\Functions\V2\GenerateUploadUrlRequest; @@ -930,11 +931,11 @@ public function generateDownloadUrl($name, array $optionalArgs = []) * attached, the identity from the credentials would be used, but that * identity does not have permissions to upload files to the URL. * - * When making a HTTP PUT request, these two headers need to be specified: + * When making a HTTP PUT request, specify this header: * * * `content-type: application/zip` * - * And this header SHOULD NOT be specified: + * Do not specify this header: * * * `Authorization: Bearer YOUR_TOKEN` * @@ -970,6 +971,12 @@ public function generateDownloadUrl($name, array $optionalArgs = []) * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the * Key/KeyRing/Project/Organization (least access preferred). + * @type int $environment + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * For allowed values, use constants defined on {@see \Google\Cloud\Functions\V2\Environment} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -990,6 +997,10 @@ public function generateUploadUrl($parent, array $optionalArgs = []) $request->setKmsKeyName($optionalArgs['kmsKeyName']); } + if (isset($optionalArgs['environment'])) { + $request->setEnvironment($optionalArgs['environment']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); @@ -1022,6 +1033,13 @@ public function generateUploadUrl($parent, array $optionalArgs = []) * @param array $optionalArgs { * Optional. * + * @type string $revision + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -1038,6 +1056,10 @@ public function getFunction($name, array $optionalArgs = []) $requestParamHeaders = []; $request->setName($name); $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['revision'])) { + $request->setRevision($optionalArgs['revision']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); @@ -1250,8 +1272,7 @@ public function listRuntimes($parent, array $optionalArgs = []) * * @type FieldMask $updateMask * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on diff --git a/Functions/src/V2/GenerateUploadUrlRequest.php b/Functions/src/V2/GenerateUploadUrlRequest.php index 96d70b54076d..0f5c56485a99 100644 --- a/Functions/src/V2/GenerateUploadUrlRequest.php +++ b/Functions/src/V2/GenerateUploadUrlRequest.php @@ -40,6 +40,15 @@ class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { */ private $kms_key_name = ''; + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + */ + private $environment = 0; /** * Constructor. @@ -64,6 +73,11 @@ class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the * Key/KeyRing/Project/Organization (least access preferred). + * @type int $environment + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. * } */ public function __construct($data = NULL) { @@ -149,5 +163,37 @@ public function setKmsKeyName($var) return $this; } + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + * @return int + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * The function environment the generated upload url will be used for. + * The upload url for 2nd Gen functions can also be used for 1st gen + * functions, but not vice versa. If not specified, 2nd generation-style + * upload URLs are generated. + * + * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; + * @param int $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); + $this->environment = $var; + + return $this; + } + } diff --git a/Functions/src/V2/GetFunctionRequest.php b/Functions/src/V2/GetFunctionRequest.php index 8273a4788678..af6825784c6b 100644 --- a/Functions/src/V2/GetFunctionRequest.php +++ b/Functions/src/V2/GetFunctionRequest.php @@ -21,6 +21,17 @@ class GetFunctionRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ private $name = ''; + /** + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $revision = ''; /** * @param string $name Required. The name of the function which details should be obtained. Please see @@ -44,6 +55,13 @@ public static function build(string $name): self * * @type string $name * Required. The name of the function which details should be obtained. + * @type string $revision + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. * } */ public function __construct($data = NULL) { @@ -77,5 +95,41 @@ public function setName($var) return $this; } + /** + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Optional. The version of the 1st gen function whose details should + * be obtained. The version of a 1st gen function is an integer that starts + * from 1 and gets incremented on redeployments. GCF may keep historical + * configs for old versions of 1st gen function. This field can be specified + * to fetch the historical configs. This field is valid only for GCF 1st gen + * function. + * + * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkString($var, True); + $this->revision = $var; + + return $this; + } + } diff --git a/Functions/src/V2/ListRuntimesResponse/Runtime.php b/Functions/src/V2/ListRuntimesResponse/Runtime.php index 9b4bdbf98280..2c3e404ea024 100644 --- a/Functions/src/V2/ListRuntimesResponse/Runtime.php +++ b/Functions/src/V2/ListRuntimesResponse/Runtime.php @@ -46,6 +46,18 @@ class Runtime extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; */ private $environment = 0; + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + */ + private $deprecation_date = null; + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + */ + private $decommission_date = null; /** * Constructor. @@ -63,6 +75,10 @@ class Runtime extends \Google\Protobuf\Internal\Message * Warning messages, e.g., a deprecation warning. * @type int $environment * The environment for the runtime. + * @type \Google\Type\Date $deprecation_date + * Deprecation date for the runtime. + * @type \Google\Type\Date $decommission_date + * Decommission date for the runtime. * } */ public function __construct($data = NULL) { @@ -200,6 +216,78 @@ public function setEnvironment($var) return $this; } + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + * @return \Google\Type\Date|null + */ + public function getDeprecationDate() + { + return $this->deprecation_date; + } + + public function hasDeprecationDate() + { + return isset($this->deprecation_date); + } + + public function clearDeprecationDate() + { + unset($this->deprecation_date); + } + + /** + * Deprecation date for the runtime. + * + * Generated from protobuf field .google.type.Date deprecation_date = 6; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDeprecationDate($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->deprecation_date = $var; + + return $this; + } + + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + * @return \Google\Type\Date|null + */ + public function getDecommissionDate() + { + return $this->decommission_date; + } + + public function hasDecommissionDate() + { + return isset($this->decommission_date); + } + + public function clearDecommissionDate() + { + unset($this->decommission_date); + } + + /** + * Decommission date for the runtime. + * + * Generated from protobuf field .google.type.Date decommission_date = 7; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDecommissionDate($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->decommission_date = $var; + + return $this; + } + } diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php b/Functions/src/V2/OnDeployUpdatePolicy.php similarity index 98% rename from owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php rename to Functions/src/V2/OnDeployUpdatePolicy.php index 471df8d867e2..d5741067278f 100644 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OnDeployUpdatePolicy.php +++ b/Functions/src/V2/OnDeployUpdatePolicy.php @@ -21,7 +21,7 @@ class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - protected $runtime_version = ''; + private $runtime_version = ''; /** * Constructor. diff --git a/Functions/src/V2/OperationMetadata.php b/Functions/src/V2/OperationMetadata.php index cbb19c797021..1858fd59d1e1 100644 --- a/Functions/src/V2/OperationMetadata.php +++ b/Functions/src/V2/OperationMetadata.php @@ -48,9 +48,10 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message /** * 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`. + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. * * Generated from protobuf field bool cancel_requested = 6; */ @@ -73,6 +74,25 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; */ private $stages; + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + */ + private $source_token = ''; + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + */ + private $build_name = ''; + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + */ + private $operation_type = 0; /** * Constructor. @@ -93,15 +113,23 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * @type bool $cancel_requested * 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`. + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. * @type string $api_version * API version used to start the operation. * @type \Google\Protobuf\Any $request_resource * The original request that started the operation. * @type array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $stages * Mechanism for reporting in-progress stages + * @type string $source_token + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * @type string $build_name + * The build name of the function for create and update operations. + * @type int $operation_type + * The operation type. * } */ public function __construct($data = NULL) { @@ -262,9 +290,10 @@ public function setStatusDetail($var) /** * 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`. + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. * * Generated from protobuf field bool cancel_requested = 6; * @return bool @@ -277,9 +306,10 @@ public function getCancelRequested() /** * 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`. + * have + * [google.longrunning.Operation.error][google.longrunning.Operation.error] + * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. * * Generated from protobuf field bool cancel_requested = 6; * @param bool $var @@ -381,5 +411,85 @@ public function setStages($var) return $this; } + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + * @return string + */ + public function getSourceToken() + { + return $this->source_token; + } + + /** + * An identifier for Firebase function sources. Disclaimer: This field is only + * supported for Firebase function deployments. + * + * Generated from protobuf field string source_token = 10; + * @param string $var + * @return $this + */ + public function setSourceToken($var) + { + GPBUtil::checkString($var, True); + $this->source_token = $var; + + return $this; + } + + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + * @return string + */ + public function getBuildName() + { + return $this->build_name; + } + + /** + * The build name of the function for create and update operations. + * + * Generated from protobuf field string build_name = 13; + * @param string $var + * @return $this + */ + public function setBuildName($var) + { + GPBUtil::checkString($var, True); + $this->build_name = $var; + + return $this; + } + + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + * @return int + */ + public function getOperationType() + { + return $this->operation_type; + } + + /** + * The operation type. + * + * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; + * @param int $var + * @return $this + */ + public function setOperationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\OperationType::class); + $this->operation_type = $var; + + return $this; + } + } diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php b/Functions/src/V2/OperationType.php similarity index 100% rename from owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationType.php rename to Functions/src/V2/OperationType.php diff --git a/Functions/src/V2/PBFunction.php b/Functions/src/V2/PBFunction.php index 266b232c4f90..494c5e10a7b3 100644 --- a/Functions/src/V2/PBFunction.php +++ b/Functions/src/V2/PBFunction.php @@ -95,6 +95,19 @@ class PBFunction extends \Google\Protobuf\Internal\Message * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { */ private $kms_key_name = ''; + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $satisfies_pzs = false; + /** + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $create_time = null; /** * Constructor. @@ -133,6 +146,11 @@ class PBFunction extends \Google\Protobuf\Internal\Message * encrypt/decrypt function resources. * It must match the pattern * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * @type bool $satisfies_pzs + * Output only. Reserved for future use. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. * } */ public function __construct($data = NULL) { @@ -506,5 +524,69 @@ public function setKmsKeyName($var) return $this; } + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getSatisfiesPzs() + { + return $this->satisfies_pzs; + } + + /** + * Output only. Reserved for future use. + * + * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setSatisfiesPzs($var) + { + GPBUtil::checkBool($var); + $this->satisfies_pzs = $var; + + return $this; + } + + /** + * Output only. The create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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 create timestamp of a Cloud Function. This is only + * applicable to 2nd Gen functions. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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; + } + } diff --git a/Functions/src/V2/ServiceConfig.php b/Functions/src/V2/ServiceConfig.php index 5deba31d6ba9..680bce83fc8b 100644 --- a/Functions/src/V2/ServiceConfig.php +++ b/Functions/src/V2/ServiceConfig.php @@ -44,7 +44,7 @@ class ServiceConfig extends \Google\Protobuf\Internal\Message */ private $available_memory = ''; /** - * [Preview] The number of CPUs used in a single container instance. + * The number of CPUs used in a single container instance. * Default value is calculated from available memory. * Supports the same values as Cloud Run, see * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements @@ -150,7 +150,7 @@ class ServiceConfig extends \Google\Protobuf\Internal\Message */ private $revision = ''; /** - * [Preview] Sets the maximum number of concurrent requests that each instance + * Sets the maximum number of concurrent requests that each instance * can receive. Defaults to 1. * * Generated from protobuf field int32 max_instance_request_concurrency = 20; @@ -165,6 +165,13 @@ class ServiceConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; */ private $security_level = 0; + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $binary_authorization_policy = ''; /** * Constructor. @@ -188,7 +195,7 @@ class ServiceConfig extends \Google\Protobuf\Internal\Message * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go * a full description. * @type string $available_cpu - * [Preview] The number of CPUs used in a single container instance. + * The number of CPUs used in a single container instance. * Default value is calculated from available memory. * Supports the same values as Cloud Run, see * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements @@ -242,13 +249,16 @@ class ServiceConfig extends \Google\Protobuf\Internal\Message * @type string $revision * Output only. The name of service revision. * @type int $max_instance_request_concurrency - * [Preview] Sets the maximum number of concurrent requests that each instance + * Sets the maximum number of concurrent requests that each instance * can receive. Defaults to 1. * @type int $security_level * Security level configure whether the function only accepts https. * This configuration is only applicable to 1st Gen functions with Http * trigger. By default https is optional for 1st Gen functions; 2nd Gen * functions are https ONLY. + * @type string $binary_authorization_policy + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. * } */ public function __construct($data = NULL) { @@ -353,7 +363,7 @@ public function setAvailableMemory($var) } /** - * [Preview] The number of CPUs used in a single container instance. + * The number of CPUs used in a single container instance. * Default value is calculated from available memory. * Supports the same values as Cloud Run, see * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements @@ -368,7 +378,7 @@ public function getAvailableCpu() } /** - * [Preview] The number of CPUs used in a single container instance. + * The number of CPUs used in a single container instance. * Default value is calculated from available memory. * Supports the same values as Cloud Run, see * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements @@ -747,7 +757,7 @@ public function setRevision($var) } /** - * [Preview] Sets the maximum number of concurrent requests that each instance + * Sets the maximum number of concurrent requests that each instance * can receive. Defaults to 1. * * Generated from protobuf field int32 max_instance_request_concurrency = 20; @@ -759,7 +769,7 @@ public function getMaxInstanceRequestConcurrency() } /** - * [Preview] Sets the maximum number of concurrent requests that each instance + * Sets the maximum number of concurrent requests that each instance * can receive. Defaults to 1. * * Generated from protobuf field int32 max_instance_request_concurrency = 20; @@ -806,5 +816,33 @@ public function setSecurityLevel($var) return $this; } + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getBinaryAuthorizationPolicy() + { + return $this->binary_authorization_policy; + } + + /** + * Optional. The binary authorization policy to be checked when deploying the + * Cloud Run service. + * + * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setBinaryAuthorizationPolicy($var) + { + GPBUtil::checkString($var, True); + $this->binary_authorization_policy = $var; + + return $this; + } + } diff --git a/Functions/src/V2/Source.php b/Functions/src/V2/Source.php index c2bf044c6339..b16cd2dea16e 100644 --- a/Functions/src/V2/Source.php +++ b/Functions/src/V2/Source.php @@ -28,6 +28,10 @@ class Source extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Functions\V2\RepoSource $repo_source * If provided, get the source from this location in a Cloud Source * Repository. + * @type string $git_uri + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// * } */ public function __construct($data = NULL) { @@ -99,6 +103,41 @@ public function setRepoSource($var) return $this; } + /** + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// + * + * Generated from protobuf field string git_uri = 3; + * @return string + */ + public function getGitUri() + { + return $this->readOneof(3); + } + + public function hasGitUri() + { + return $this->hasOneof(3); + } + + /** + * If provided, get the source from GitHub repository. This option is valid + * only for GCF 1st Gen function. + * Example: https://github.com///blob// + * + * Generated from protobuf field string git_uri = 3; + * @param string $var + * @return $this + */ + public function setGitUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + /** * @return string */ diff --git a/Functions/src/V2/SourceProvenance.php b/Functions/src/V2/SourceProvenance.php index 328e8fe66f23..509576e3ad74 100644 --- a/Functions/src/V2/SourceProvenance.php +++ b/Functions/src/V2/SourceProvenance.php @@ -30,6 +30,13 @@ class SourceProvenance extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; */ private $resolved_repo_source = null; + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + */ + private $git_uri = ''; /** * Constructor. @@ -43,6 +50,9 @@ class SourceProvenance extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Functions\V2\RepoSource $resolved_repo_source * A copy of the build's `source.repo_source`, if exists, with any * revisions resolved. + * @type string $git_uri + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. * } */ public function __construct($data = NULL) { @@ -126,5 +136,33 @@ public function setResolvedRepoSource($var) return $this; } + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + * @return string + */ + public function getGitUri() + { + return $this->git_uri; + } + + /** + * A copy of the build's `source.git_uri`, if exists, with any commits + * resolved. + * + * Generated from protobuf field string git_uri = 3; + * @param string $var + * @return $this + */ + public function setGitUri($var) + { + GPBUtil::checkString($var, True); + $this->git_uri = $var; + + return $this; + } + } diff --git a/Functions/src/V2/StorageSource.php b/Functions/src/V2/StorageSource.php index 57ea291cc12e..7eeaad663a45 100644 --- a/Functions/src/V2/StorageSource.php +++ b/Functions/src/V2/StorageSource.php @@ -38,6 +38,14 @@ class StorageSource extends \Google\Protobuf\Internal\Message * Generated from protobuf field int64 generation = 3; */ private $generation = 0; + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + */ + private $source_upload_url = ''; /** * Constructor. @@ -56,6 +64,10 @@ class StorageSource extends \Google\Protobuf\Internal\Message * @type int|string $generation * Google Cloud Storage generation for the object. If the generation is * omitted, the latest generation will be used. + * @type string $source_upload_url + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. * } */ public function __construct($data = NULL) { @@ -151,5 +163,35 @@ public function setGeneration($var) return $this; } + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + * @return string + */ + public function getSourceUploadUrl() + { + return $this->source_upload_url; + } + + /** + * When the specified storage bucket is a 1st gen function uploard url bucket, + * this field should be set as the generated upload url for 1st gen + * deployment. + * + * Generated from protobuf field string source_upload_url = 4; + * @param string $var + * @return $this + */ + public function setSourceUploadUrl($var) + { + GPBUtil::checkString($var, True); + $this->source_upload_url = $var; + + return $this; + } + } diff --git a/Functions/src/V2/UpdateFunctionRequest.php b/Functions/src/V2/UpdateFunctionRequest.php index ceec23a08564..71dbe9d9b87a 100644 --- a/Functions/src/V2/UpdateFunctionRequest.php +++ b/Functions/src/V2/UpdateFunctionRequest.php @@ -23,8 +23,7 @@ class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message private $function = null; /** * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ @@ -33,8 +32,7 @@ class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message /** * @param \Google\Cloud\Functions\V2\PBFunction $function Required. New version of the function. * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * * @return \Google\Cloud\Functions\V2\UpdateFunctionRequest * @@ -57,8 +55,7 @@ public static function build(\Google\Cloud\Functions\V2\PBFunction $function, \G * Required. New version of the function. * @type \Google\Protobuf\FieldMask $update_mask * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * } */ public function __construct($data = NULL) { @@ -104,8 +101,7 @@ public function setFunction($var) /** * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; * @return \Google\Protobuf\FieldMask|null @@ -127,8 +123,7 @@ public function clearUpdateMask() /** * The list of fields to be updated. - * If no field mask is provided, all provided fields in the request will be - * updated. + * If no field mask is provided, all fields will be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; * @param \Google\Protobuf\FieldMask $var diff --git a/Functions/tests/Unit/V2/Client/FunctionServiceClientTest.php b/Functions/tests/Unit/V2/Client/FunctionServiceClientTest.php index 6f796f2e78cb..2c1b2f95c319 100644 --- a/Functions/tests/Unit/V2/Client/FunctionServiceClientTest.php +++ b/Functions/tests/Unit/V2/Client/FunctionServiceClientTest.php @@ -109,11 +109,13 @@ public function createFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -481,11 +483,13 @@ public function getFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name2); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); @@ -697,11 +701,13 @@ public function updateFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -1096,11 +1102,13 @@ public function createFunctionAsyncTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/Functions/tests/Unit/V2/FunctionServiceClientTest.php b/Functions/tests/Unit/V2/FunctionServiceClientTest.php index efb29653ea5e..cf60859f1ec2 100644 --- a/Functions/tests/Unit/V2/FunctionServiceClientTest.php +++ b/Functions/tests/Unit/V2/FunctionServiceClientTest.php @@ -97,11 +97,13 @@ public function createFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -451,11 +453,13 @@ public function getFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name2); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); @@ -655,11 +659,13 @@ public function updateFunctionTest() $description = 'description-1724546052'; $url = 'url116079'; $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; $expectedResponse = new PBFunction(); $expectedResponse->setName($name); $expectedResponse->setDescription($description); $expectedResponse->setUrl($url); $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php b/owl-bot-staging/Functions/v1/proto/src/GPBMetadata/Google/Cloud/Functions/V1/Functions.php deleted file mode 100644 index 8933e0a4c3f52d8552d2fc8b7f0ecec2ccddff9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9005 zcmbtaOLN=S6%Hj!mag8A718t~G@Le)Vv)6+*HE?-@Fg>*NtUGKaYi!;1YSvqKmY|m z*@~-8H=Qo~n(jN@^cQrdn`}E?bdl~d(`h=>RenNNJ@*9yq(oDR7Z!SS;&`~ zw}8~MJFbp1$phOyFmYNp?M^Gb-?4Pxuq`ire7E~0MY$qmX>IH|nvRoOwd@n@Yc0*! zcDE>l-5g=CTNDg-ckXT?q??-OC4-0PB}&3Sr?Y1odeZYXAO5^;c&cF;zM+}Mmte_* z<2C+PgYjBSi;WOPp&W>GnqamA0&OZgTvC3Nf-Ma*V?3d69%Wjr`Dts~aUNmLG_d7gjHYN{vz5h%+Oc7~7bC4>9xg*G*&hzORfojt#cVBU zZHS~@_*1hXW=@7zn^RtttZZ8cZpX3=>);0|9K>9{!;BqXB<344Y|iMK)v`y{s2Js#YA1815hlrE28zO;6}YIYE&eD6)Z*U;Jo z7U7TT&|u{2iRgM{?KWRCyJ3|+SAfIuD&69-!v$R9OoDYxqJu9A01pioL792K3GGS$v3;>$0w z4^4F(DDPOM!l$XMM4zmth$LpiGD64L^&m)8qZOY8qEWVxN8_LdHof>yTyfHwh!@3v?s$Sj7i`fS&4M--puX#g}2*>_%>AOLiPRCu9^TuLfr& z)zLh#jIxhY_8$$+zQh;=Jny6Fqqe6W;S-et(N$tq_NU(~x6v&cGqB2;1G;-D=yTIK z_XIk-$M{6LiWb-@64zoEQpz^t3F??7G{Kf2K(A4zH2WZO*<&j0R(IhEy6#~eI=gcs z;s%X~fq>JX^biFQYtqMPmh(Hd%?=dY_|0KC>`($QZkj`@Zy#YR{+3YolJqHBXxTck zIE1<~T~B|n+(B!a>l^!;?z{NF@F1mnUD!olsfOkPUTkyxHgKBV_;Bb$%~M_KTo$D7 zvexnKHtG6RjxMZN##eyz)W*Z1IV*zCHU%lx_N3p~vx_Um?ypH%2bTc~`u3p1I?x4f~m{>=vJGGpet5zz7T(eqN z3tROJ_ETq>VrkUG7;> zDtUD)SI*9l%Acdzo)~`%UCUQT@OANr9|5pfMq<{y(f*Of zxBQP7nhy74(tL=JwGK}xV0K)?KT%ES)Jz)hvm5UZ$mB4~6u>W~E)!z;DVm8qkZz(x zqmbLKmzvMia$%=X?m4gpARy}nh?J+wvj&{iBAVlmsIaesp#p`mm0R`7ML@v?~MbEiwWIgR+ihA`hVEj6nf| z2ArJ7)WG&MLYS%(sz+}mE~7E}F*||Ap?W}nC)dz)q^?D<0ZiwyNBTf^Uzmj^nHEBB zCm1dOkK79;<*&ejj3qC0z@<$aQ%Ca;c`OaXc?(T&&K_JjNV_>GR>C4ltbnI>SPz>> z(OBs|Anmx&nT0molc;jkMEQ>~w3Kr(bj>0g>-ZNPxKm4;XhI|&GbFqEtujKp8S%WY zohkFAh2xtL2}*rAwJ|6bBJDFtp%M8vpcgA+y?TXNv*5TGYbhPv6Uc>=tJi-|2*wh! zgQP9&_v)d9@0;0s)HmxF!@cO;gB%FGd&HnBT`5DeBSd=QOg=#4j^;vw@)Kdr#o9WEcC#hhlE!mq-uKc2I+fG&~AG6N14 z!jI9Fs4(u!D`*|rk=avEJdLlV~=q9!!bpqk4MQ9=;p?dKL5c!ZRTj%9$Jqme+_OY%K* z?M(WvyIPzroug2pYrl)ZQHGlcHkXiof^Ox?)$P1m+^*zEp;H@8rMcbPsUb8DT}x@F z0HtvXU9J|3W$13^MUCH*Carb2iptq%|!+9&iJ8W-gI-zaos7g3X3X3tSF)c&oVO8<$W*=XgG z2DvD@RVaHy*cKXgrh=ir{L5F$+r4wf#b8;yPTINqjj|v>_>RCyYSpHkrp_0u=U5hU zel5h*sC5ul0Wwi)!YzgG!D!4o&?0m2!ion*i6|d)C)VioQb1q|?uzKj)eTvlSRv z9m{uRyp-2FE;U8Q$ zdz*o}&fcF#Mz?as?-ct&^IIioPF^zy3P!~ShM7_D?d0@3<;5_=_QtS+V02k0?;g@G z$yncokEdx}%{{=f~yiVN^c}lL%JwEsN+q zCjlo+Q0_^nq7a(r=;iMPu%#nW#OR`8Y=C8fxV#aw1WV;L<2_gsR}7mA z@@wO$Y~6dLrP;a?Z@dO89Dh%xIp(5lT|e3`S_?^*blflim|&jBfcHsgE=lB~VT1LQ z$yDRM5^X-r+IQ#Lwe`j(SRJG!3Khk&M6Vg!;8DI?eL=tB*j&k~@~|AIcF0^+wL=0P z-xj_Do_0L$?4BuU%Jw&5|niyvD8Kf+{xL z&+aU8@#F`1CVvIR9P^iUV(P`!l9DW+Ug>K!#~1d~u|1+QzY4^N{9EVgoogle.cloud.functions.v1.CallFunctionRequest - */ -class CallFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function to be called. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $data = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function to be called. - * @type string $data - * Required. Input to be passed to the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function to be called. - * - * 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 function to be called. - * - * 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; - } - - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getData() - { - return $this->data; - } - - /** - * Required. Input to be passed to the function. - * - * Generated from protobuf field string data = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setData($var) - { - GPBUtil::checkString($var, True); - $this->data = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php deleted file mode 100644 index bb7004f8e9d2..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CallFunctionResponse.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.functions.v1.CallFunctionResponse - */ -class CallFunctionResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - */ - protected $execution_id = ''; - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - */ - protected $result = ''; - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - */ - protected $error = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $execution_id - * Execution id of function invocation. - * @type string $result - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * @type string $error - * Either system or user-function generated error. Set if execution - * was not successful. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - * @return string - */ - public function getExecutionId() - { - return $this->execution_id; - } - - /** - * Execution id of function invocation. - * - * Generated from protobuf field string execution_id = 1; - * @param string $var - * @return $this - */ - public function setExecutionId($var) - { - GPBUtil::checkString($var, True); - $this->execution_id = $var; - - return $this; - } - - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - * @return string - */ - public function getResult() - { - return $this->result; - } - - /** - * Result populated for successful execution of synchronous function. Will - * not be populated if function does not return a result through context. - * - * Generated from protobuf field string result = 2; - * @param string $var - * @return $this - */ - public function setResult($var) - { - GPBUtil::checkString($var, True); - $this->result = $var; - - return $this; - } - - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - * @return string - */ - public function getError() - { - return $this->error; - } - - /** - * Either system or user-function generated error. Set if execution - * was not successful. - * - * Generated from protobuf field string error = 3; - * @param string $var - * @return $this - */ - public function setError($var) - { - GPBUtil::checkString($var, True); - $this->error = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php deleted file mode 100644 index dcb6a3476b51..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction.php +++ /dev/null @@ -1,1639 +0,0 @@ -google.cloud.functions.v1.CloudFunction - */ -class CloudFunction extends \Google\Protobuf\Internal\Message -{ - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $status = 0; - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - */ - protected $entry_point = ''; - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - */ - protected $runtime = ''; - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - */ - protected $timeout = null; - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - */ - protected $available_memory_mb = 0; - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - */ - protected $service_account_email = ''; - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $version_id = 0; - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - */ - private $labels; - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - */ - private $environment_variables; - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - */ - private $build_environment_variables; - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @deprecated - */ - protected $network = ''; - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - */ - protected $max_instances = 0; - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - */ - protected $min_instances = 0; - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - */ - protected $vpc_connector = ''; - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - */ - protected $vpc_connector_egress_settings = 0; - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - */ - protected $ingress_settings = 0; - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - */ - protected $build_worker_pool = ''; - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $build_id = ''; - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $build_name = ''; - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - */ - private $secret_environment_variables; - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - */ - private $secret_volumes; - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $source_token = ''; - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - */ - protected $docker_repository = ''; - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - */ - protected $docker_registry = 0; - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - */ - protected $build_service_account = ''; - protected $source_code; - protected $trigger; - protected $runtime_update_policy; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * @type string $description - * User-provided description of a function. - * @type string $source_archive_url - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * @type \Google\Cloud\Functions\V1\SourceRepository $source_repository - * **Beta Feature** - * The source repository where a function is hosted. - * @type string $source_upload_url - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * @type \Google\Cloud\Functions\V1\HttpsTrigger $https_trigger - * An HTTPS endpoint type of source that can be triggered via URL. - * @type \Google\Cloud\Functions\V1\EventTrigger $event_trigger - * A source that fires events in response to a condition in another service. - * @type int $status - * Output only. Status of the function deployment. - * @type string $entry_point - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * @type string $runtime - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * @type \Google\Protobuf\Duration $timeout - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * @type int $available_memory_mb - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * @type string $service_account_email - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The last update timestamp of a Cloud Function. - * @type int|string $version_id - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels associated with this Cloud Function. - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * Environment variables that shall be available during function execution. - * @type array|\Google\Protobuf\Internal\MapField $build_environment_variables - * Build environment variables that shall be available during build time. - * @type string $network - * Deprecated: use vpc_connector - * @type int $max_instances - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * @type int $min_instances - * A lower bound for the number function instances that may coexist at a - * given time. - * @type string $vpc_connector - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * @type int $vpc_connector_egress_settings - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * @type int $ingress_settings - * The ingress settings for the function, controlling what traffic can reach - * it. - * @type string $kms_key_name - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * @type string $build_worker_pool - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * @type string $build_id - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * @type string $build_name - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * @type array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables - * Secret environment variables configuration. - * @type array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes - * Secret volumes configuration. - * @type string $source_token - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * @type string $docker_repository - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * @type int $docker_registry - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * @type \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $automatic_update_policy - * @type \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $on_deploy_update_policy - * @type string $build_service_account - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * - * Generated from protobuf field string source_archive_url = 3; - * @return string - */ - public function getSourceArchiveUrl() - { - return $this->readOneof(3); - } - - public function hasSourceArchiveUrl() - { - return $this->hasOneof(3); - } - - /** - * The Google Cloud Storage URL, starting with `gs://`, pointing to the zip - * archive which contains the function. - * - * Generated from protobuf field string source_archive_url = 3; - * @param string $var - * @return $this - */ - public function setSourceArchiveUrl($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * **Beta Feature** - * The source repository where a function is hosted. - * - * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; - * @return \Google\Cloud\Functions\V1\SourceRepository|null - */ - public function getSourceRepository() - { - return $this->readOneof(4); - } - - public function hasSourceRepository() - { - return $this->hasOneof(4); - } - - /** - * **Beta Feature** - * The source repository where a function is hosted. - * - * Generated from protobuf field .google.cloud.functions.v1.SourceRepository source_repository = 4; - * @param \Google\Cloud\Functions\V1\SourceRepository $var - * @return $this - */ - public function setSourceRepository($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\SourceRepository::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * - * Generated from protobuf field string source_upload_url = 16; - * @return string - */ - public function getSourceUploadUrl() - { - return $this->readOneof(16); - } - - public function hasSourceUploadUrl() - { - return $this->hasOneof(16); - } - - /** - * The Google Cloud Storage signed URL used for source uploading, generated - * by calling [google.cloud.functions.v1.GenerateUploadUrl]. - * The signature is validated on write methods (Create, Update) - * The signature is stripped from the Function object on read methods (Get, - * List) - * - * Generated from protobuf field string source_upload_url = 16; - * @param string $var - * @return $this - */ - public function setSourceUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(16, $var); - - return $this; - } - - /** - * An HTTPS endpoint type of source that can be triggered via URL. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; - * @return \Google\Cloud\Functions\V1\HttpsTrigger|null - */ - public function getHttpsTrigger() - { - return $this->readOneof(5); - } - - public function hasHttpsTrigger() - { - return $this->hasOneof(5); - } - - /** - * An HTTPS endpoint type of source that can be triggered via URL. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger https_trigger = 5; - * @param \Google\Cloud\Functions\V1\HttpsTrigger $var - * @return $this - */ - public function setHttpsTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\HttpsTrigger::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * A source that fires events in response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; - * @return \Google\Cloud\Functions\V1\EventTrigger|null - */ - public function getEventTrigger() - { - return $this->readOneof(6); - } - - public function hasEventTrigger() - { - return $this->hasOneof(6); - } - - /** - * A source that fires events in response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v1.EventTrigger event_trigger = 6; - * @param \Google\Cloud\Functions\V1\EventTrigger $var - * @return $this - */ - public function setEventTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\EventTrigger::class); - $this->writeOneof(6, $var); - - return $this; - } - - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getStatus() - { - return $this->status; - } - - /** - * Output only. Status of the function deployment. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunctionStatus status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setStatus($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunctionStatus::class); - $this->status = $var; - - return $this; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - * @return string - */ - public function getEntryPoint() - { - return $this->entry_point; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix (ID of the function), if not - * specified. - * - * Generated from protobuf field string entry_point = 8; - * @param string $var - * @return $this - */ - public function setEntryPoint($var) - { - GPBUtil::checkString($var, True); - $this->entry_point = $var; - - return $this; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - * @return string - */ - public function getRuntime() - { - return $this->runtime; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 19; - * @param string $var - * @return $this - */ - public function setRuntime($var) - { - GPBUtil::checkString($var, True); - $this->runtime = $var; - - return $this; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - * @return \Google\Protobuf\Duration|null - */ - public function getTimeout() - { - return $this->timeout; - } - - public function hasTimeout() - { - return isset($this->timeout); - } - - public function clearTimeout() - { - unset($this->timeout); - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field .google.protobuf.Duration timeout = 9; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setTimeout($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->timeout = $var; - - return $this; - } - - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - * @return int - */ - public function getAvailableMemoryMb() - { - return $this->available_memory_mb; - } - - /** - * The amount of memory in MB available for a function. - * Defaults to 256MB. - * - * Generated from protobuf field int32 available_memory_mb = 10; - * @param int $var - * @return $this - */ - public function setAvailableMemoryMb($var) - { - GPBUtil::checkInt32($var); - $this->available_memory_mb = $var; - - return $this; - } - - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * The email of the function's service account. If empty, defaults to - * `{project_id}@appspot.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 11; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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 last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.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; - } - - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Output only. The version identifier of the Cloud Function. Each deployment - * attempt results in a new version of a function being created. - * - * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 15; - * @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; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 17; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - * @return \Google\Protobuf\Internal\MapField - */ - public function getBuildEnvironmentVariables() - { - return $this->build_environment_variables; - } - - /** - * Build environment variables that shall be available during build time. - * - * Generated from protobuf field map build_environment_variables = 28; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setBuildEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->build_environment_variables = $arr; - - return $this; - } - - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @return string - * @deprecated - */ - public function getNetwork() - { - @trigger_error('network is deprecated.', E_USER_DEPRECATED); - return $this->network; - } - - /** - * Deprecated: use vpc_connector - * - * Generated from protobuf field string network = 18 [deprecated = true]; - * @param string $var - * @return $this - * @deprecated - */ - public function setNetwork($var) - { - @trigger_error('network is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->network = $var; - - return $this; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - * @return int - */ - public function getMaxInstances() - { - return $this->max_instances; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instances = 20; - * @param int $var - * @return $this - */ - public function setMaxInstances($var) - { - GPBUtil::checkInt32($var); - $this->max_instances = $var; - - return $this; - } - - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - * @return int - */ - public function getMinInstances() - { - return $this->min_instances; - } - - /** - * A lower bound for the number function instances that may coexist at a - * given time. - * - * Generated from protobuf field int32 min_instances = 32; - * @param int $var - * @return $this - */ - public function setMinInstances($var) - { - GPBUtil::checkInt32($var); - $this->min_instances = $var; - - return $this; - } - - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - * @return string - */ - public function getVpcConnector() - { - return $this->vpc_connector; - } - - /** - * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network - * connector resource. The format of this field is - * `projects/*/locations/*/connectors/*` - * This field is mutually exclusive with `network` field and will eventually - * replace it. - * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for - * more information on connecting Cloud projects. - * - * Generated from protobuf field string vpc_connector = 22; - * @param string $var - * @return $this - */ - public function setVpcConnector($var) - { - GPBUtil::checkString($var, True); - $this->vpc_connector = $var; - - return $this; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - * @return int - */ - public function getVpcConnectorEgressSettings() - { - return $this->vpc_connector_egress_settings; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings vpc_connector_egress_settings = 23; - * @param int $var - * @return $this - */ - public function setVpcConnectorEgressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\VpcConnectorEgressSettings::class); - $this->vpc_connector_egress_settings = $var; - - return $this; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - * @return int - */ - public function getIngressSettings() - { - return $this->ingress_settings; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.IngressSettings ingress_settings = 24; - * @param int $var - * @return $this - */ - public function setIngressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\IngressSettings::class); - $this->ingress_settings = $var; - - return $this; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * If specified, you must also provide an artifact registry repository using - * the `docker_repository` field that was created with the same KMS crypto - * key. - * The following service accounts need to be granted the role 'Cloud KMS - * CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' - * on the Key/KeyRing/Project/Organization (least access preferred). - * 1. Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - - * Required to protect the function's image. - * 2. Google Storage service account - * (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - - * Required to protect the function's source code. - * If this service account does not exist, deploying a function without a - * KMS key or retrieving the service agent name provisions it. For more - * information, see - * https://cloud.google.com/storage/docs/projects#service-agents and - * https://cloud.google.com/storage/docs/getting-service-agent#gsutil. - * Google Cloud Functions delegates access to service agents to protect - * function resources in internal projects that are not accessible by the - * end user. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - * @return string - */ - public function getBuildWorkerPool() - { - return $this->build_worker_pool; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * `{project}` and `{region}` are the project id and region respectively where - * the worker pool is defined and `{workerPool}` is the short name of the - * worker pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must - * be granted the role Cloud Build Custom Workers Builder - * (`roles/cloudbuild.customworkers.builder`) in the project. - * - * Generated from protobuf field string build_worker_pool = 26; - * @param string $var - * @return $this - */ - public function setBuildWorkerPool($var) - { - GPBUtil::checkString($var, True); - $this->build_worker_pool = $var; - - return $this; - } - - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getBuildId() - { - return $this->build_id; - } - - /** - * Output only. The Cloud Build ID of the latest successful deployment of the - * function. - * - * Generated from protobuf field string build_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setBuildId($var) - { - GPBUtil::checkString($var, True); - $this->build_id = $var; - - return $this; - } - - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getBuildName() - { - return $this->build_name; - } - - /** - * Output only. The Cloud Build Name of the function deployment. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setBuildName($var) - { - GPBUtil::checkString($var, True); - $this->build_name = $var; - - return $this; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretEnvironmentVariables() - { - return $this->secret_environment_variables; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretEnvVar secret_environment_variables = 29; - * @param array<\Google\Cloud\Functions\V1\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretEnvironmentVariables($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretEnvVar::class); - $this->secret_environment_variables = $arr; - - return $this; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretVolumes() - { - return $this->secret_volumes; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume secret_volumes = 30; - * @param array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretVolumes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume::class); - $this->secret_volumes = $arr; - - return $this; - } - - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return string - */ - public function getSourceToken() - { - return $this->source_token; - } - - /** - * Input only. An identifier for Firebase function sources. Disclaimer: This - * field is only supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setSourceToken($var) - { - GPBUtil::checkString($var, True); - $this->source_token = $var; - - return $this; - } - - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - * @return string - */ - public function getDockerRepository() - { - return $this->docker_repository; - } - - /** - * User-managed repository created in Artifact Registry to which the - * function's Docker image will be pushed after it is built by Cloud Build. - * May optionally be encrypted with a customer-managed encryption key (CMEK). - * If unspecified and `docker_registry` is not explicitly set to - * `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry - * repository named 'gcf-artifacts' in the region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 34 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDockerRepository($var) - { - GPBUtil::checkString($var, True); - $this->docker_repository = $var; - - return $this; - } - - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - * @return int - */ - public function getDockerRegistry() - { - return $this->docker_registry; - } - - /** - * Docker Registry to use for this deployment. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.DockerRegistry docker_registry = 35; - * @param int $var - * @return $this - */ - public function setDockerRegistry($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\CloudFunction\DockerRegistry::class); - $this->docker_registry = $var; - - return $this; - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; - * @return \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy|null - */ - public function getAutomaticUpdatePolicy() - { - return $this->readOneof(40); - } - - public function hasAutomaticUpdatePolicy() - { - return $this->hasOneof(40); - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy automatic_update_policy = 40; - * @param \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy $var - * @return $this - */ - public function setAutomaticUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\AutomaticUpdatePolicy::class); - $this->writeOneof(40, $var); - - return $this; - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @return \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy|null - */ - public function getOnDeployUpdatePolicy() - { - return $this->readOneof(41); - } - - public function hasOnDeployUpdatePolicy() - { - return $this->hasOneof(41); - } - - /** - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @param \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy $var - * @return $this - */ - public function setOnDeployUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction\OnDeployUpdatePolicy::class); - $this->writeOneof(41, $var); - - return $this; - } - - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - * @return string - */ - public function getBuildServiceAccount() - { - return $this->build_service_account; - } - - /** - * A service account the user provides for use with Cloud Build. The format of - * this field is - * `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string build_service_account = 43; - * @param string $var - * @return $this - */ - public function setBuildServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->build_service_account = $var; - - return $this; - } - - /** - * @return string - */ - public function getSourceCode() - { - return $this->whichOneof("source_code"); - } - - /** - * @return string - */ - public function getTrigger() - { - return $this->whichOneof("trigger"); - } - - /** - * @return string - */ - public function getRuntimeUpdatePolicy() - { - return $this->whichOneof("runtime_update_policy"); - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php deleted file mode 100644 index 02f5ae78823a..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/AutomaticUpdatePolicy.php +++ /dev/null @@ -1,37 +0,0 @@ -google.cloud.functions.v1.CloudFunction.AutomaticUpdatePolicy - */ -class AutomaticUpdatePolicy extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AutomaticUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_AutomaticUpdatePolicy::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php deleted file mode 100644 index 0dc3a8279ff9..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/DockerRegistry.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.functions.v1.CloudFunction.DockerRegistry - */ -class DockerRegistry -{ - /** - * Unspecified. - * - * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; - */ - const DOCKER_REGISTRY_UNSPECIFIED = 0; - /** - * Docker images will be stored in multi-regional Container Registry - * repositories named `gcf`. - * - * Generated from protobuf enum CONTAINER_REGISTRY = 1; - */ - const CONTAINER_REGISTRY = 1; - /** - * Docker images will be stored in regional Artifact Registry repositories. - * By default, GCF will create and use repositories named `gcf-artifacts` - * in every region in which a function is deployed. But the repository to - * use can also be specified by the user using the `docker_repository` - * field. - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 2; - */ - const ARTIFACT_REGISTRY = 2; - - private static $valueToName = [ - self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', - self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DockerRegistry::class, \Google\Cloud\Functions\V1\CloudFunction_DockerRegistry::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php deleted file mode 100644 index f01e9ad97124..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/IngressSettings.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.functions.v1.CloudFunction.IngressSettings - */ -class IngressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const INGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Allow HTTP traffic from public and private sources. - * - * Generated from protobuf enum ALLOW_ALL = 1; - */ - const ALLOW_ALL = 1; - /** - * Allow HTTP traffic from only private VPC sources. - * - * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; - */ - const ALLOW_INTERNAL_ONLY = 2; - /** - * Allow HTTP traffic from private VPC sources and through GCLB. - * - * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; - */ - const ALLOW_INTERNAL_AND_GCLB = 3; - - private static $valueToName = [ - self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', - self::ALLOW_ALL => 'ALLOW_ALL', - self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', - self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IngressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_IngressSettings::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php deleted file mode 100644 index 1183812ad6bb..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/OnDeployUpdatePolicy.php +++ /dev/null @@ -1,74 +0,0 @@ -google.cloud.functions.v1.CloudFunction.OnDeployUpdatePolicy - */ -class OnDeployUpdatePolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $runtime_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $runtime_version - * Output only. Contains the runtime version which was used during latest - * function deployment. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRuntimeVersion() - { - return $this->runtime_version; - } - - /** - * Output only. Contains the runtime version which was used during latest - * function deployment. - * - * Generated from protobuf field string runtime_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRuntimeVersion($var) - { - GPBUtil::checkString($var, True); - $this->runtime_version = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(OnDeployUpdatePolicy::class, \Google\Cloud\Functions\V1\CloudFunction_OnDeployUpdatePolicy::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php deleted file mode 100644 index a357c173fb54..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunction/VpcConnectorEgressSettings.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings - */ -class VpcConnectorEgressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Use the VPC Access Connector only for private IP space from RFC1918. - * - * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; - */ - const PRIVATE_RANGES_ONLY = 1; - /** - * Force the use of VPC Access Connector for all egress traffic from the - * function. - * - * Generated from protobuf enum ALL_TRAFFIC = 2; - */ - const ALL_TRAFFIC = 2; - - private static $valueToName = [ - self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', - self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', - self::ALL_TRAFFIC => 'ALL_TRAFFIC', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V1\CloudFunction_VpcConnectorEgressSettings::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php deleted file mode 100644 index 50cab779a116..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CloudFunctionStatus.php +++ /dev/null @@ -1,83 +0,0 @@ -google.cloud.functions.v1.CloudFunctionStatus - */ -class CloudFunctionStatus -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - */ - const CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - /** - * Function has been successfully deployed and is serving. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Function deployment failed and the function isn’t serving. - * - * Generated from protobuf enum OFFLINE = 2; - */ - const OFFLINE = 2; - /** - * Function is being created or updated. - * - * Generated from protobuf enum DEPLOY_IN_PROGRESS = 3; - */ - const DEPLOY_IN_PROGRESS = 3; - /** - * Function is being deleted. - * - * Generated from protobuf enum DELETE_IN_PROGRESS = 4; - */ - const DELETE_IN_PROGRESS = 4; - /** - * Function deployment failed and the function serving state is undefined. - * The function should be updated or deleted to move it out of this state. - * - * Generated from protobuf enum UNKNOWN = 5; - */ - const UNKNOWN = 5; - - private static $valueToName = [ - self::CLOUD_FUNCTION_STATUS_UNSPECIFIED => 'CLOUD_FUNCTION_STATUS_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::OFFLINE => 'OFFLINE', - self::DEPLOY_IN_PROGRESS => 'DEPLOY_IN_PROGRESS', - self::DELETE_IN_PROGRESS => 'DELETE_IN_PROGRESS', - self::UNKNOWN => 'UNKNOWN', - ]; - - 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php deleted file mode 100644 index cb11a65978b1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/CreateFunctionRequest.php +++ /dev/null @@ -1,115 +0,0 @@ -google.cloud.functions.v1.CreateFunctionRequest - */ -class CreateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $location = ''; - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $location - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @type \Google\Cloud\Functions\V1\CloudFunction $function - * Required. Function to be created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setLocation($var) - { - GPBUtil::checkString($var, True); - $this->location = $var; - - return $this; - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V1\CloudFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V1\CloudFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->function = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php deleted file mode 100644 index 9fa98e38b5ea..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/DeleteFunctionRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v1.DeleteFunctionRequest - */ -class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which should be deleted. - * - * 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. The name of the function which should be deleted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which should be deleted. - * - * 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 function which should be deleted. - * - * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php deleted file mode 100644 index a85d3f80fc84..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/EventTrigger.php +++ /dev/null @@ -1,292 +0,0 @@ -google.cloud.functions.v1.EventTrigger - */ -class EventTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - */ - protected $event_type = ''; - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - */ - protected $resource = ''; - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - */ - protected $service = ''; - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - */ - protected $failure_policy = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $event_type - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * @type string $resource - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * @type string $service - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * @type \Google\Cloud\Functions\V1\FailurePolicy $failure_policy - * Specifies policy for failed executions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - * @return string - */ - public function getEventType() - { - return $this->event_type; - } - - /** - * Required. The type of event to observe. For example: - * `providers/cloud.storage/eventTypes/object.change` and - * `providers/cloud.pubsub/eventTypes/topic.publish`. - * Event types match pattern `providers/*/eventTypes/*.*`. - * The pattern contains: - * 1. namespace: For example, `cloud.storage` and - * `google.firebase.analytics`. - * 2. resource type: The type of resource on which event occurs. For - * example, the Google Cloud Storage API includes the type `object`. - * 3. action: The action that generates the event. For example, action for - * a Google Cloud Storage Object is 'change'. - * These parts are lower case. - * - * Generated from protobuf field string event_type = 1; - * @param string $var - * @return $this - */ - public function setEventType($var) - { - GPBUtil::checkString($var, True); - $this->event_type = $var; - - return $this; - } - - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - * @return string - */ - public function getResource() - { - return $this->resource; - } - - /** - * Required. The resource(s) from which to observe events, for example, - * `projects/_/buckets/myBucket`. - * Not all syntactically correct values are accepted by all services. For - * example: - * 1. The authorization model must support it. Google Cloud Functions - * only allows EventTriggers to be deployed that observe resources in the - * same project as the `CloudFunction`. - * 2. The resource type must match the pattern expected for an - * `event_type`. For example, an `EventTrigger` that has an - * `event_type` of "google.pubsub.topic.publish" should have a resource - * that matches Google Cloud Pub/Sub topics. - * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" - * format. - * See each *service's* documentation for supported formats. - * - * Generated from protobuf field string resource = 2; - * @param string $var - * @return $this - */ - public function setResource($var) - { - GPBUtil::checkString($var, True); - $this->resource = $var; - - return $this; - } - - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - * @return string - */ - public function getService() - { - return $this->service; - } - - /** - * The hostname of the service that should be observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * - * Generated from protobuf field string service = 3; - * @param string $var - * @return $this - */ - public function setService($var) - { - GPBUtil::checkString($var, True); - $this->service = $var; - - return $this; - } - - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - * @return \Google\Cloud\Functions\V1\FailurePolicy|null - */ - public function getFailurePolicy() - { - return $this->failure_policy; - } - - public function hasFailurePolicy() - { - return isset($this->failure_policy); - } - - public function clearFailurePolicy() - { - unset($this->failure_policy); - } - - /** - * Specifies policy for failed executions. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy failure_policy = 5; - * @param \Google\Cloud\Functions\V1\FailurePolicy $var - * @return $this - */ - public function setFailurePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy::class); - $this->failure_policy = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php deleted file mode 100644 index f81b50f6d779..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy.php +++ /dev/null @@ -1,76 +0,0 @@ -google.cloud.functions.v1.FailurePolicy - */ -class FailurePolicy extends \Google\Protobuf\Internal\Message -{ - protected $action; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry - * If specified, then the function will be retried in case of a failure. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * If specified, then the function will be retried in case of a failure. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; - * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null - */ - public function getRetry() - { - return $this->readOneof(1); - } - - public function hasRetry() - { - return $this->hasOneof(1); - } - - /** - * If specified, then the function will be retried in case of a failure. - * - * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; - * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var - * @return $this - */ - public function setRetry($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy\Retry::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getAction() - { - return $this->whichOneof("action"); - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php deleted file mode 100644 index a2188ed7d6ef..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/FailurePolicy/Retry.php +++ /dev/null @@ -1,40 +0,0 @@ -google.cloud.functions.v1.FailurePolicy.Retry - */ -class Retry extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Retry::class, \Google\Cloud\Functions\V1\FailurePolicy_Retry::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php deleted file mode 100644 index 072629f3be02..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.functions.v1.GenerateDownloadUrlRequest - */ -class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - */ - protected $version_id = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @type int|string $version_id - * The optional version of function. If not set, default, current version - * is used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * The optional version of function. If not set, default, current version - * is used. - * - * Generated from protobuf field uint64 version_id = 2; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkUint64($var); - $this->version_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php deleted file mode 100644 index 54d5d55e458f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateDownloadUrlResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v1.GenerateDownloadUrlResponse - */ -class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - */ - protected $download_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $download_url - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @return string - */ - public function getDownloadUrl() - { - return $this->download_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @param string $var - * @return $this - */ - public function setDownloadUrl($var) - { - GPBUtil::checkString($var, True); - $this->download_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php deleted file mode 100644 index 94a0f06d4816..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlRequest.php +++ /dev/null @@ -1,161 +0,0 @@ -google.cloud.functions.v1.GenerateUploadUrlRequest - */ -class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - */ - protected $parent = ''; - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * @type string $kms_key_name - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php deleted file mode 100644 index 41557ee9aa0e..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GenerateUploadUrlResponse.php +++ /dev/null @@ -1,75 +0,0 @@ -google.cloud.functions.v1.GenerateUploadUrlResponse - */ -class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - */ - protected $upload_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $upload_url - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @return string - */ - public function getUploadUrl() - { - return $this->upload_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @param string $var - * @return $this - */ - public function setUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->upload_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php deleted file mode 100644 index 72f3e59339fc..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/GetFunctionRequest.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.functions.v1.GetFunctionRequest - */ -class GetFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which details should be obtained. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $version_id = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which details should be obtained. - * @type int|string $version_id - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which details should be obtained. - * - * 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 function which details should be obtained. - * - * 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. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * - * Generated from protobuf field int64 version_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php deleted file mode 100644 index 24ca96c54a24..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.functions.v1.HttpsTrigger - */ -class HttpsTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $url = ''; - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - */ - protected $security_level = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $url - * Output only. The deployed url for the function. - * @type int $security_level - * The security level for the function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - * @return int - */ - public function getSecurityLevel() - { - return $this->security_level; - } - - /** - * The security level for the function. - * - * Generated from protobuf field .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; - * @param int $var - * @return $this - */ - public function setSecurityLevel($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\HttpsTrigger\SecurityLevel::class); - $this->security_level = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php deleted file mode 100644 index 26f38ca940f8..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/HttpsTrigger/SecurityLevel.php +++ /dev/null @@ -1,70 +0,0 @@ -google.cloud.functions.v1.HttpsTrigger.SecurityLevel - */ -class SecurityLevel -{ - /** - * Unspecified. - * - * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; - */ - const SECURITY_LEVEL_UNSPECIFIED = 0; - /** - * Requests for a URL that match this handler that do not use HTTPS are - * automatically redirected to the HTTPS URL with the same path. Query - * parameters are reserved for the redirect. - * - * Generated from protobuf enum SECURE_ALWAYS = 1; - */ - const SECURE_ALWAYS = 1; - /** - * Both HTTP and HTTPS requests with URLs that match the handler succeed - * without redirects. The application can examine the request to determine - * which protocol was used and respond accordingly. - * - * Generated from protobuf enum SECURE_OPTIONAL = 2; - */ - const SECURE_OPTIONAL = 2; - - private static $valueToName = [ - self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', - self::SECURE_ALWAYS => 'SECURE_ALWAYS', - self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecurityLevel::class, \Google\Cloud\Functions\V1\HttpsTrigger_SecurityLevel::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php deleted file mode 100644 index 31a224ea16e1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsRequest.php +++ /dev/null @@ -1,167 +0,0 @@ -google.cloud.functions.v1.ListFunctionsRequest - */ -class ListFunctionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Maximum number of functions to return per call. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @type int $page_size - * Maximum number of functions to return per call. - * @type string $page_token - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.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 functions to return per call. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of functions 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php deleted file mode 100644 index 354f44b97f4e..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/ListFunctionsResponse.php +++ /dev/null @@ -1,151 +0,0 @@ -google.cloud.functions.v1.ListFunctionsResponse - */ -class ListFunctionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - */ - private $functions; - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Locations that could not be reached. The response does not include any - * functions from these locations. - * - * 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\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $functions - * The functions that match the request. - * @type string $next_page_token - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. The response does not include any - * functions from these locations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.CloudFunction functions = 1; - * @param array<\Google\Cloud\Functions\V1\CloudFunction>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setFunctions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->functions = $arr; - - return $this; - } - - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * If not empty, indicates that there may be more functions that match - * the request; this value should be passed in a new - * [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] - * to get more functions. - * - * 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. The response does not include any - * functions from these locations. - * - * 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. The response does not include any - * functions from these locations. - * - * 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php deleted file mode 100644 index 0f72c0be190f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationMetadataV1.php +++ /dev/null @@ -1,349 +0,0 @@ -google.cloud.functions.v1.OperationMetadataV1 - */ -class OperationMetadataV1 extends \Google\Protobuf\Internal\Message -{ - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - */ - protected $target = ''; - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - */ - protected $type = 0; - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - */ - protected $request = null; - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - */ - protected $version_id = 0; - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - */ - protected $update_time = null; - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - */ - protected $build_id = ''; - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - */ - protected $source_token = ''; - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - */ - protected $build_name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $target - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * @type int $type - * Type of operation. - * @type \Google\Protobuf\Any $request - * The original request that started the operation. - * @type int|string $version_id - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * @type \Google\Protobuf\Timestamp $update_time - * The last update timestamp of the operation. - * @type string $build_id - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * @type string $source_token - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * @type string $build_name - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Operations::initOnce(); - parent::__construct($data); - } - - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Target of the operation - for example - * `projects/project-1/locations/region-1/functions/function-1` - * - * Generated from protobuf field string target = 1; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * Type of operation. - * - * Generated from protobuf field .google.cloud.functions.v1.OperationType type = 2; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V1\OperationType::class); - $this->type = $var; - - return $this; - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - * @return \Google\Protobuf\Any|null - */ - public function getRequest() - { - return $this->request; - } - - public function hasRequest() - { - return isset($this->request); - } - - public function clearRequest() - { - unset($this->request); - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request = 3; - * @param \Google\Protobuf\Any $var - * @return $this - */ - public function setRequest($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); - $this->request = $var; - - return $this; - } - - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - * @return int|string - */ - public function getVersionId() - { - return $this->version_id; - } - - /** - * Version id of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field int64 version_id = 4; - * @param int|string $var - * @return $this - */ - public function setVersionId($var) - { - GPBUtil::checkInt64($var); - $this->version_id = $var; - - return $this; - } - - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - * @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); - } - - /** - * The last update timestamp of the operation. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - * @return string - */ - public function getBuildId() - { - return $this->build_id; - } - - /** - * The Cloud Build ID of the function created or updated by an API call. - * This field is only populated for Create and Update operations. - * - * Generated from protobuf field string build_id = 6; - * @param string $var - * @return $this - */ - public function setBuildId($var) - { - GPBUtil::checkString($var, True); - $this->build_id = $var; - - return $this; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - * @return string - */ - public function getSourceToken() - { - return $this->source_token; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 7; - * @param string $var - * @return $this - */ - public function setSourceToken($var) - { - GPBUtil::checkString($var, True); - $this->source_token = $var; - - return $this; - } - - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - * @return string - */ - public function getBuildName() - { - return $this->build_name; - } - - /** - * The Cloud Build Name of the function deployment. - * This field is only populated for Create and Update operations. - * `projects//locations//builds/`. - * - * Generated from protobuf field string build_name = 8; - * @param string $var - * @return $this - */ - public function setBuildName($var) - { - GPBUtil::checkString($var, True); - $this->build_name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php deleted file mode 100644 index 665dca661df7..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/OperationType.php +++ /dev/null @@ -1,68 +0,0 @@ -google.cloud.functions.v1.OperationType - */ -class OperationType -{ - /** - * Unknown operation type. - * - * Generated from protobuf enum OPERATION_UNSPECIFIED = 0; - */ - const OPERATION_UNSPECIFIED = 0; - /** - * Triggered by CreateFunction call - * - * Generated from protobuf enum CREATE_FUNCTION = 1; - */ - const CREATE_FUNCTION = 1; - /** - * Triggered by UpdateFunction call - * - * Generated from protobuf enum UPDATE_FUNCTION = 2; - */ - const UPDATE_FUNCTION = 2; - /** - * Triggered by DeleteFunction call. - * - * Generated from protobuf enum DELETE_FUNCTION = 3; - */ - const DELETE_FUNCTION = 3; - - private static $valueToName = [ - self::OPERATION_UNSPECIFIED => 'OPERATION_UNSPECIFIED', - self::CREATE_FUNCTION => 'CREATE_FUNCTION', - self::UPDATE_FUNCTION => 'UPDATE_FUNCTION', - self::DELETE_FUNCTION => 'DELETE_FUNCTION', - ]; - - 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/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php deleted file mode 100644 index c47df271d7a9..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretEnvVar.php +++ /dev/null @@ -1,191 +0,0 @@ -google.cloud.functions.v1.SecretEnvVar - */ -class SecretEnvVar extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - */ - protected $key = ''; - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - */ - protected $version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $key - * Name of the environment variable. - * @type string $project_id - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @param string $var - * @return $this - */ - public function setKey($var) - { - GPBUtil::checkString($var, True); - $this->key = $var; - - return $this; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances start. - * - * Generated from protobuf field string version = 4; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php deleted file mode 100644 index 66e6c00d8ac1..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume.php +++ /dev/null @@ -1,213 +0,0 @@ -google.cloud.functions.v1.SecretVolume - */ -class SecretVolume extends \Google\Protobuf\Internal\Message -{ - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - */ - protected $mount_path = ''; - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - */ - private $versions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $mount_path - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * @type string $project_id - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - * @return string - */ - public function getMountPath() - { - return $this->mount_path; - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount paths: /etc/secrets - * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log - * - * Generated from protobuf field string mount_path = 1; - * @param string $var - * @return $this - */ - public function setMountPath($var) - { - GPBUtil::checkString($var, True); - $this->mount_path = $var; - - return $this; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getVersions() - { - return $this->versions; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; - * @param array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setVersions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V1\SecretVolume\SecretVersion::class); - $this->versions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php deleted file mode 100644 index a44fd6355ac6..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SecretVolume/SecretVersion.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v1.SecretVolume.SecretVersion - */ -class SecretVersion extends \Google\Protobuf\Internal\Message -{ - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - */ - protected $version = ''; - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - */ - protected $path = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * @type string $path - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @param string $var - * @return $this - */ - public function setPath($var) - { - GPBUtil::checkString($var, True); - $this->path = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecretVersion::class, \Google\Cloud\Functions\V1\SecretVolume_SecretVersion::class); - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php deleted file mode 100644 index 6f58de5fd44f..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/SourceRepository.php +++ /dev/null @@ -1,154 +0,0 @@ -google.cloud.functions.v1.SourceRepository - */ -class SourceRepository extends \Google\Protobuf\Internal\Message -{ - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - */ - protected $url = ''; - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $deployed_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $url - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * @type string $deployed_url - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * The URL pointing to the hosted repository where the function is defined. - * There are supported Cloud Source Repository URLs in the following - * formats: - * To refer to a specific commit: - * `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` - * To refer to a moveable alias (branch): - * `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` - * In particular, to refer to HEAD use `master` moveable alias. - * To refer to a specific fixed alias (tag): - * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. The function - * response may add an empty `/paths/` to the URL. - * - * Generated from protobuf field string url = 1; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getDeployedUrl() - { - return $this->deployed_url; - } - - /** - * Output only. The URL pointing to the hosted repository where the function - * were defined at the time of deployment. It always points to a specific - * commit in the format described above. - * - * Generated from protobuf field string deployed_url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setDeployedUrl($var) - { - GPBUtil::checkString($var, True); - $this->deployed_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php deleted file mode 100644 index 9d09690f55e7..000000000000 --- a/owl-bot-staging/Functions/v1/proto/src/Google/Cloud/Functions/V1/UpdateFunctionRequest.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.functions.v1.UpdateFunctionRequest - */ -class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - */ - protected $update_mask = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V1\CloudFunction $function - * Required. New version of the function. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. The list of fields in `CloudFunction` that have to be updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V1\CloudFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v1.CloudFunction function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V1\CloudFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\CloudFunction::class); - $this->function = $var; - - return $this; - } - - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @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); - } - - /** - * Required. The list of fields in `CloudFunction` that have to be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php deleted file mode 100644 index 48ae28d54e29..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/call_function.php +++ /dev/null @@ -1,75 +0,0 @@ -callFunction($formattedName, $data); - 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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - $data = '[DATA]'; - - call_function_sample($formattedName, $data); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php deleted file mode 100644 index a1bbed30bfe9..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/create_function.php +++ /dev/null @@ -1,84 +0,0 @@ -createFunction($formattedLocation, $function); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var CloudFunction $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 -{ - $formattedLocation = CloudFunctionsServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - create_function_sample($formattedLocation); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php deleted file mode 100644 index 8b01ac67ecd1..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/delete_function.php +++ /dev/null @@ -1,81 +0,0 @@ -deleteFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - - delete_function_sample($formattedName); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php deleted file mode 100644 index 8f47e47eabf2..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_download_url.php +++ /dev/null @@ -1,57 +0,0 @@ -generateDownloadUrl(); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php deleted file mode 100644 index fff703d3d6d1..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php +++ /dev/null @@ -1,77 +0,0 @@ -generateUploadUrl(); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php deleted file mode 100644 index 8cdd9c74f902..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_function.php +++ /dev/null @@ -1,70 +0,0 @@ -getFunction($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 = CloudFunctionsServiceClient::cloudFunctionName( - '[PROJECT]', - '[LOCATION]', - '[FUNCTION]' - ); - - get_function_sample($formattedName); -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php deleted file mode 100644 index 7d5f9df65ad5..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/get_iam_policy.php +++ /dev/null @@ -1,68 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php deleted file mode 100644 index 9a163ed63d13..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_functions.php +++ /dev/null @@ -1,58 +0,0 @@ -listFunctions(); - - /** @var CloudFunction $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 cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php deleted file mode 100644 index e8bcd3814df5..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/list_locations.php +++ /dev/null @@ -1,58 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php deleted file mode 100644 index b1a06b2632ff..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/set_iam_policy.php +++ /dev/null @@ -1,70 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php deleted file mode 100644 index f7ce83e8395c..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php +++ /dev/null @@ -1,77 +0,0 @@ -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 cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php b/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php deleted file mode 100644 index c3a85dedaa99..000000000000 --- a/owl-bot-staging/Functions/v1/samples/V1/CloudFunctionsServiceClient/update_function.php +++ /dev/null @@ -1,68 +0,0 @@ -updateFunction($function); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var CloudFunction $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()); - } -} -// [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php b/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php deleted file mode 100644 index e423650fbff2..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/CloudFunctionsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $data = 'data'; - * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); - * } finally { - * $cloudFunctionsServiceClient->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 CloudFunctionsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.functions.v1.CloudFunctionsService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $cloudFunctionNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $locationNameTemplate; - - private static $repositoryNameTemplate; - - 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/cloud_functions_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/cloud_functions_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/cloud_functions_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/cloud_functions_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getCloudFunctionNameTemplate() - { - if (self::$cloudFunctionNameTemplate == null) { - self::$cloudFunctionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); - } - - return self::$cloudFunctionNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getRepositoryNameTemplate() - { - if (self::$repositoryNameTemplate == null) { - self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); - } - - return self::$repositoryNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'cloudFunction' => self::getCloudFunctionNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'repository' => self::getRepositoryNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * cloud_function resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted cloud_function resource. - */ - public static function cloudFunctionName($project, $location, $function) - { - return self::getCloudFunctionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) - { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName($project, $location, $repository) - { - return self::getRepositoryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - cloudFunction: projects/{project}/locations/{location}/functions/{function} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - * 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 'cloudfunctions.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); - } - - /** - * Synchronously invokes a deployed Cloud Function. To be used for testing - * purposes as very limited traffic is allowed. For more information on - * the actual limits, refer to - * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $data = 'data'; - * $response = $cloudFunctionsServiceClient->callFunction($formattedName, $data); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function to be called. - * @param string $data Required. Input to be passed to the function. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\CallFunctionResponse - * - * @throws ApiException if the remote call fails - */ - public function callFunction($name, $data, array $optionalArgs = []) - { - $request = new CallFunctionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setData($data); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CallFunction', CallFunctionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedLocation = $cloudFunctionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $function = new CloudFunction(); - * $operationResponse = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); - * $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 = $cloudFunctionsServiceClient->createFunction($formattedLocation, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $location Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @param CloudFunction $function Required. Function 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 createFunction($location, $function, array $optionalArgs = []) - { - $request = new CreateFunctionRequest(); - $requestParamHeaders = []; - $request->setLocation($location); - $request->setFunction($function); - $requestParamHeaders['location'] = $location; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $operationResponse = $cloudFunctionsServiceClient->deleteFunction($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 = $cloudFunctionsServiceClient->deleteFunction($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'deleteFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which should be deleted. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFunction($name, array $optionalArgs = []) - { - $request = new DeleteFunctionRequest(); - $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * minutes after generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $response = $cloudFunctionsServiceClient->generateDownloadUrl(); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @type int $versionId - * The optional version of function. If not set, default, current version - * is used. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\GenerateDownloadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateDownloadUrl(array $optionalArgs = []) - { - $request = new GenerateDownloadUrlRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['versionId'])) { - $request->setVersionId($optionalArgs['versionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * Source file size should not exceed 100MB limit. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * * `x-goog-content-length-range: 0,104857600` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $response = $cloudFunctionsServiceClient->generateUploadUrl(); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/*/locations/*`. - * @type string $kmsKeyName - * Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). GCF will - * delegate access to the Google Storage service account in the internal - * project. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\GenerateUploadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateUploadUrl(array $optionalArgs = []) - { - $request = new GenerateUploadUrlRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['parent'])) { - $request->setParent($optionalArgs['parent']); - $requestParamHeaders['parent'] = $optionalArgs['parent']; - } - - if (isset($optionalArgs['kmsKeyName'])) { - $request->setKmsKeyName($optionalArgs['kmsKeyName']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $formattedName = $cloudFunctionsServiceClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $cloudFunctionsServiceClient->getFunction($formattedName); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which details should be obtained. - * @param array $optionalArgs { - * Optional. - * - * @type int $versionId - * Optional. The optional version of the function whose details should be - * obtained. The version of a 1st Gen function is an integer that starts from - * 1 and gets incremented on redeployments. Each deployment creates a config - * version of the underlying function. GCF may keep historical configs for old - * versions. This field can be specified to fetch the historical configs. - * Leave it blank or set to 0 to get the latest version of the function. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V1\CloudFunction - * - * @throws ApiException if the remote call fails - */ - public function getFunction($name, array $optionalArgs = []) - { - $request = new GetFunctionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['versionId'])) { - $request->setVersionId($optionalArgs['versionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetFunction', CloudFunction::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the IAM access control policy for a function. - * Returns an empty policy if the function exists and does not have a policy - * set. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $response = $cloudFunctionsServiceClient->getIamPolicy($resource); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $cloudFunctionsServiceClient->listFunctions(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $parent - * The project and location from which the function should be listed, - * specified in the format `projects/*/locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @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 listFunctions(array $optionalArgs = []) - { - $request = new ListFunctionsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['parent'])) { - $request->setParent($optionalArgs['parent']); - $requestParamHeaders['parent'] = $optionalArgs['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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); - } - - /** - * Sets the IAM access control policy on the specified function. - * Replaces any existing policy. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $cloudFunctionsServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Tests the specified permissions against the IAM access control policy - * for a function. - * If the function does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $cloudFunctionsServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates existing function. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * $function = new CloudFunction(); - * $operationResponse = $cloudFunctionsServiceClient->updateFunction($function); - * $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 = $cloudFunctionsServiceClient->updateFunction($function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $cloudFunctionsServiceClient->resumeOperation($operationName, 'updateFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param CloudFunction $function Required. New version of the function. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Required. The list of fields in `CloudFunction` that have to be updated. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFunction($function, array $optionalArgs = []) - { - $request = new UpdateFunctionRequest(); - $requestParamHeaders = []; - $request->setFunction($function); - $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $cloudFunctionsServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); - } -} diff --git a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json deleted file mode 100644 index eeb514889328..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/gapic_metadata.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.functions.v1", - "libraryPackage": "Google\\Cloud\\Functions\\V1", - "services": { - "CloudFunctionsService": { - "clients": { - "grpc": { - "libraryClient": "CloudFunctionsServiceGapicClient", - "rpcs": { - "CallFunction": { - "methods": [ - "callFunction" - ] - }, - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json deleted file mode 100644 index fd458597923c..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_client_config.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v1.CloudFunctionsService": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_1_codes": [ - "UNAVAILABLE", - "DEADLINE_EXCEEDED" - ], - "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 - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 600000, - "total_timeout_millis": 600000 - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 600000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CallFunction": { - "timeout_millis": 600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "CreateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "DeleteFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GenerateDownloadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateUploadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListFunctions": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "UpdateFunction": { - "timeout_millis": 600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListLocations": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php deleted file mode 100644 index 0fa06f2e23bd..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_descriptor_config.php +++ /dev/null @@ -1,79 +0,0 @@ - [ - 'google.cloud.functions.v1.CloudFunctionsService' => [ - 'CreateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'UpdateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V1\CloudFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V1\OperationMetadataV1', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListFunctions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getFunctions', - ], - ], - 'ListLocations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getLocations', - ], - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - ], - ], -]; diff --git a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php b/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php deleted file mode 100644 index 5cbbcec88874..000000000000 --- a/owl-bot-staging/Functions/v1/src/V1/resources/cloud_functions_service_rest_client_config.php +++ /dev/null @@ -1,188 +0,0 @@ - [ - 'google.cloud.functions.v1.CloudFunctionsService' => [ - 'CallFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:call', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CreateFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{location=projects/*/locations/*}/functions', - 'body' => 'function', - 'placeholders' => [ - 'location' => [ - 'getters' => [ - 'getLocation', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'ListFunctions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/functions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{function.name=projects/*/locations/*/functions/*}', - 'body' => 'function', - 'placeholders' => [ - 'function.name' => [ - 'getters' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.location.Locations' => [ - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/operations', - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php deleted file mode 100644 index 8fb42777775e..000000000000 --- a/owl-bot-staging/Functions/v1/tests/Unit/V1/CloudFunctionsServiceClientTest.php +++ /dev/null @@ -1,1091 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return CloudFunctionsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new CloudFunctionsServiceClient($options); - } - - /** @test */ - public function callFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $executionId = 'executionId-1217171550'; - $result = 'result-934426595'; - $error = 'error96784904'; - $expectedResponse = new CallFunctionResponse(); - $expectedResponse->setExecutionId($executionId); - $expectedResponse->setResult($result); - $expectedResponse->setError($error); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $data = 'data3076010'; - $response = $gapicClient->callFunction($formattedName, $data); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/CallFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getData(); - $this->assertProtobufEquals($data, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function callFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $data = 'data3076010'; - try { - $gapicClient->callFunction($formattedName, $data); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId = 670497310; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new CloudFunction(); - $response = $gapicClient->createFunction($formattedLocation, $function); - $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.functions.v1.CloudFunctionsService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLocation(); - $this->assertProtobufEquals($formattedLocation, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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 - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new CloudFunction(); - $response = $gapicClient->createFunction($formattedLocation, $function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($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.functions.v1.CloudFunctionsService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - $response = $gapicClient->generateDownloadUrl(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateDownloadUrl', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->generateDownloadUrl(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - $response = $gapicClient->generateUploadUrl(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/GenerateUploadUrl', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->generateUploadUrl(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId2 = 102817515; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId2); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->getFunction($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.functions.v1.CloudFunctionsService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->cloudFunctionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->getFunction($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 getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/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 listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new CloudFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listFunctions(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/ListFunctions', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->listFunctions(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v1.CloudFunctionsService/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $sourceArchiveUrl = 'sourceArchiveUrl-289007026'; - $entryPoint = 'entryPoint-799136893'; - $runtime = 'runtime1550962648'; - $availableMemoryMb = 1964533661; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $versionId = 670497310; - $network = 'network1843485230'; - $maxInstances = 330682013; - $minInstances = 1491624145; - $vpcConnector = 'vpcConnector1732864119'; - $kmsKeyName = 'kmsKeyName2094986649'; - $buildWorkerPool = 'buildWorkerPool1575447532'; - $buildId = 'buildId-1430655860'; - $buildName = 'buildName-470597188'; - $sourceToken = 'sourceToken1671283925'; - $dockerRepository = 'dockerRepository-1273385271'; - $buildServiceAccount = 'buildServiceAccount-1152257326'; - $expectedResponse = new CloudFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSourceArchiveUrl($sourceArchiveUrl); - $expectedResponse->setEntryPoint($entryPoint); - $expectedResponse->setRuntime($runtime); - $expectedResponse->setAvailableMemoryMb($availableMemoryMb); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setNetwork($network); - $expectedResponse->setMaxInstances($maxInstances); - $expectedResponse->setMinInstances($minInstances); - $expectedResponse->setVpcConnector($vpcConnector); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setBuildWorkerPool($buildWorkerPool); - $expectedResponse->setBuildId($buildId); - $expectedResponse->setBuildName($buildName); - $expectedResponse->setSourceToken($sourceToken); - $expectedResponse->setDockerRepository($dockerRepository); - $expectedResponse->setBuildServiceAccount($buildServiceAccount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new CloudFunction(); - $response = $gapicClient->updateFunction($function); - $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.functions.v1.CloudFunctionsService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new CloudFunction(); - $response = $gapicClient->updateFunction($function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php b/owl-bot-staging/Functions/v2/proto/src/GPBMetadata/Google/Cloud/Functions/V2/Functions.php deleted file mode 100644 index 67d1301d26f56e0946fa7041a44867ba9a09b719..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12405 zcmcIq&2t;sabJ+)2OdZW9FZbKNnU8Q(NbIqu%WfGOMUDPfFTza1i%1DSuQ4%0Wbu| z0x|H+fD%{5q$ERO*^>{cO4T0n2k4aF`N-Y!{H$duG1G{Ccr#hC^=^B|<*BZ1lyMtcKHLaeLImjOW zNHea4^z?nh>FX^cwOP$QHC(-|yZX*1W3ZE_40bj=20Po?2ZXe`y5pq$m*h1`;a`8y z?3%5V>^jgO1?G)!p$9~Yau<}PK zPoyeU1{ASV?74>B)4Mwb!)e)O-?i*2hOV!74A)m7eY1L7OiS6ByQx(!k*)WZ6 zJ7?_a2c~78kF;h8a~WI6lGW?jgI>?$?%@S$nu{Atg*ob*9t%T2^n@>?9}g zHkQ4W=Il>VcRELh=ho?g;*N|2lUgEA?7Ok#sR)t^Q+oSb2^uXs#6 z^{0Jr;Z&cI>8{>1x=wO7H3@xXJc5(vnf7NbF$%Tk+J{mBilahka6(7#7)~NWE@0M&JM=#V&BnT7>63On=9-a+hiV9buz|I$fb1^KM6=9X>vYQBaq zvFzK_ymFVsf=Y{#Nr)z_d7exi=-q+A?Rb6SlZgChWQwUsS|SVehSE^At#ZAp=8GFe zwUBsEB4k?0H;UV8B0`@xlwt|*C!~22EvVH}<$1BZnV5vv%ofy=+MvHKNHH?ARen;g zJS!)r*8lt)iH=~^v*ykuT`k4MMZOXju5 z^=K{XJv!N0?@|6;gv2mWK5F4s#u``r*z43ehnf{sQB8bw4vxJYJ%O|n=J zl{d(&KQu`e>*}^zD>j~w=r&5G)LN}lgKD9%XG*P1)i)u{k_*N1MkO&R|0$WTBb$M- z*I7O%#mRJY(0XCGVn^}YYEp#>Nw7y9o;1>MMFZ2MbcHPN<6Rr{yO!S8s0GuQ6P5oy zLP*W%TY~!%i8XD#*V^NzOv$5PyeCOy*3~=w9izj$MPz^0{=VsI&YsQ!5FbgzwrOTt zh`2zaHm2a@Jb=O|+osK;PZXTy%pSJG)oi0u=AkOD=@+lp7+TV zJBYcZ<#s;A>GVdqLEdN4hJ6|hy=BTJ)=R6Jr`%vp!$i?{1O5gMLm3d1n zdn3d~_^wM&d|!hf2m`=*M=k85w^AS53_k!Klh{kkeqq><%Ib0_%iVsX+#(;Gy})OT zf>t|{MwS96opzwxrrzx0+?;0T=I0>-1CM}bTUYe!1 zS{8PjovqQ82jt4xD|-8J86T1PeR8!>$v;tRT20+7)*H3aD1Vtq`AWH=6w84z2>Cd0 zm0F{?f#cODO-$sL$&xV5VK0&YgWxb2$^-9_8L>p+05Y@xYh(o+MpYw7sa~kvTLVOH z0|{)~VMoW5lq3oLKsS-2b!m#VPjx>J%Z)hTbq{BwC5{>dh&RdyM8+qW z1aiVr9U;Hwq87Qql3WfKxM9rn%7}g8PDd&UgLJZ<#SgVuexA`$d~}jVfHj+ z#Iv7_&A!MP_&iyjY9c}Q^VI8PNf?VJ{6RDJvE9sLqtY$%9lhH{MWOHRBI+YlcaeEI z^ibxfa54d2v(i&?4Q2xSj%?*R{IZph5>rYgtx;1pHj4Sgg#3zJ z95uESxdxVD>`^U%OXZn{zhH{l_|Iawq1MVuiO)76T_wvSACz)I+sv18NQR%$_!m_4 zcgRXz&2O>Hx`Y(FG_t4#5YX=`rhTS7uVdy*Yr?E@x>+YUNjK|@;NoECS2drt?9Cow@ zr$ntn-D;c5wUTDaJAOe^AWvovb)ckS!m%aFzq~-^)F5W?37PTW1~xvBZNch$u5PzR z!>I>1Tqbcr%JKvsM_DF>k!q}zV$}vsd?tWT2!LbP>;l^LmL6K9QyBo6VYu`unF9vx z44Rs2_05(@oNoR>iM&y+ldJsO31R6_Nj@t|Qlx}c{1L>9Ip~q)ip-%Y{t?gK3yBs% zMW$<%mZ!yZwGj!LZSCnedAcl9j55taROGQ|X*SQtqjvH$06)}6*UJN*Fr@@9|0K&DBv*2UWPvN_ta-%Y*j+#mq}E2vB}K=P$h03Y$v55 z#DVWF0yaklaW4Ct9+6EVZ5pnJ1k`xAMzI!v<8oJVua^>X^kwO$y!B9GE4o?A8#7eJL} zExV00x_QWrRX!q1BLX^obP){cJ~;+CplBKqZiZN%w?dls^^8|E{`j)^mCv9Dmt+tqwL2hhG09-Fo&#rO!!H+!e;8(}d zgl(n#Hy3zxJDx%aR79pMrWK*%k3&Mou#}udTJT)?^#qv_&m$cZx@yzucXfe>(_$?O zT!eNUIy@-Gvk$-JyZ~c61`U@lb({7c9UiZw5v!yi<=9p!eMAy~rEG(v%o>He7&IBn zE_h@%RpQ_~sPG2CzN~!vV!a?Dj+E9SCPm_sF1t@!*5J2!XHIJ;lkeC8Y8!xE&%G0OC zdL5}P-c8Fu6HW!>jr7GtflXw0-(0&^`KJT zCJQn>=|J&B}d0O+=8IzcTIU}9AowzhH?9w(txERIZJq_ zuD?kL`+p;H!0O4%# z7v2ZY_qT_2BB)xuHw=^KyH8Pt;Z`AsJjZSo(%j+#6Mc~+$_o5-xGi=nc*p!Tw^c0B z1{pd!b+xu#%&Tx&{AkpQo11D4ehZG`i&m?YN;xI}1m26cV#x8^X}SEC_8cMx&DIf2 zYBUJ2dc9cIspMIQg>t@N0z?9)J1o|MjzpjC7aYn0iec zypIGL;AGYUoyoO8Lvrm%`b~t)59RMtSa)M+q$g!qk7a~_pUv{)uN6_f3<=E(nlr=> zG*YFXPmuU<(l3PxF+9{0`?|LmflDB1-{jl<@Xi`snO2K07bCeXU&O ztGu%-iUj`w)dJJTr!wEdaka7T*DBI4pqJq?BUCTLL&wz1Z~ve4vgj*h!25W#reO-n zW$!ba_6DTKHSU0B{yTz{W2p2A)y(kFF*Wm7&`g0W32X2VVRrrNoJJCG=(Te?^j8tG z;N|*$F(!p!J|{+d>;2gCkW*5HQ;39f|A1{;LH>+w+Spdy5jRMEnb#w0((fbWk~dSJ zD3ZdU#Z$(63kt)@PbCveDzPPP$jZ55D=u~NOR)jT>7xD#kZZ7Hkyw~<_q2x?l&L! z;`W=rnwZ?oZ+xRz=jzNV{t5b)J3jP=1MBAEa#ZHE|LgGR8|C@id;IsuorWdgn1KBc z-sYI?^|9B%oA|UPk68j8ea!Wv&|dBOxJwY7J+K!~VBH?8(fN4XDg0h4Ch?y!&7Yi& zQhWIS*vk-I0?Z(u!ufkB_}Kgf%uZLp0d(;HJiH-r;}rd{t^yU3whX}H)i^i(>ZdUB zG1K79HeA=MQD`Icn%*h2@pzPJc^3w$=7kL=P{Qv*} diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php deleted file mode 100644 index ad0033887c63..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig.php +++ /dev/null @@ -1,599 +0,0 @@ -google.cloud.functions.v2.BuildConfig - */ -class BuildConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $build = ''; - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - */ - protected $runtime = ''; - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - */ - protected $entry_point = ''; - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - */ - protected $source = null; - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $source_provenance = null; - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - */ - protected $worker_pool = ''; - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - */ - private $environment_variables; - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - */ - protected $docker_registry = 0; - /** - * Repository in Artifact Registry to which the function docker image will be - * pushed after it is built by Cloud Build. If specified by user, it is - * created and managed by user with a customer managed encryption key. - * Otherwise, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - */ - protected $docker_repository = ''; - /** - * Service account to be used for building the container. The format of this - * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string service_account = 27; - */ - protected $service_account = ''; - protected $runtime_update_policy; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $automatic_update_policy - * @type \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $on_deploy_update_policy - * @type string $build - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * @type string $runtime - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * @type string $entry_point - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * @type \Google\Cloud\Functions\V2\Source $source - * The location of the function source code. - * @type \Google\Cloud\Functions\V2\SourceProvenance $source_provenance - * Output only. A permanent fixed identifier for source. - * @type string $worker_pool - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * User-provided build-time environment variables for the function - * @type int $docker_registry - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * @type string $docker_repository - * Repository in Artifact Registry to which the function docker image will be - * pushed after it is built by Cloud Build. If specified by user, it is - * created and managed by user with a customer managed encryption key. - * Otherwise, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * @type string $service_account - * Service account to be used for building the container. The format of this - * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; - * @return \Google\Cloud\Functions\V2\AutomaticUpdatePolicy|null - */ - public function getAutomaticUpdatePolicy() - { - return $this->readOneof(40); - } - - public function hasAutomaticUpdatePolicy() - { - return $this->hasOneof(40); - } - - /** - * Generated from protobuf field .google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40; - * @param \Google\Cloud\Functions\V2\AutomaticUpdatePolicy $var - * @return $this - */ - public function setAutomaticUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\AutomaticUpdatePolicy::class); - $this->writeOneof(40, $var); - - return $this; - } - - /** - * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @return \Google\Cloud\Functions\V2\OnDeployUpdatePolicy|null - */ - public function getOnDeployUpdatePolicy() - { - return $this->readOneof(41); - } - - public function hasOnDeployUpdatePolicy() - { - return $this->hasOneof(41); - } - - /** - * Generated from protobuf field .google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41; - * @param \Google\Cloud\Functions\V2\OnDeployUpdatePolicy $var - * @return $this - */ - public function setOnDeployUpdatePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\OnDeployUpdatePolicy::class); - $this->writeOneof(41, $var); - - return $this; - } - - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getBuild() - { - return $this->build; - } - - /** - * Output only. The Cloud Build name of the latest successful deployment of - * the function. - * - * Generated from protobuf field string build = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setBuild($var) - { - GPBUtil::checkString($var, True); - $this->build = $var; - - return $this; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - * @return string - */ - public function getRuntime() - { - return $this->runtime; - } - - /** - * The runtime in which to run the function. Required when deploying a new - * function, optional when updating an existing function. For a complete - * list of possible choices, see the - * [`gcloud` command - * reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). - * - * Generated from protobuf field string runtime = 2; - * @param string $var - * @return $this - */ - public function setRuntime($var) - { - GPBUtil::checkString($var, True); - $this->runtime = $var; - - return $this; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - * @return string - */ - public function getEntryPoint() - { - return $this->entry_point; - } - - /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. - * - * Generated from protobuf field string entry_point = 3; - * @param string $var - * @return $this - */ - public function setEntryPoint($var) - { - GPBUtil::checkString($var, True); - $this->entry_point = $var; - - return $this; - } - - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - * @return \Google\Cloud\Functions\V2\Source|null - */ - public function getSource() - { - return $this->source; - } - - public function hasSource() - { - return isset($this->source); - } - - public function clearSource() - { - unset($this->source); - } - - /** - * The location of the function source code. - * - * Generated from protobuf field .google.cloud.functions.v2.Source source = 4; - * @param \Google\Cloud\Functions\V2\Source $var - * @return $this - */ - public function setSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\Source::class); - $this->source = $var; - - return $this; - } - - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Functions\V2\SourceProvenance|null - */ - public function getSourceProvenance() - { - return $this->source_provenance; - } - - public function hasSourceProvenance() - { - return isset($this->source_provenance); - } - - public function clearSourceProvenance() - { - unset($this->source_provenance); - } - - /** - * Output only. A permanent fixed identifier for source. - * - * Generated from protobuf field .google.cloud.functions.v2.SourceProvenance source_provenance = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Functions\V2\SourceProvenance $var - * @return $this - */ - public function setSourceProvenance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\SourceProvenance::class); - $this->source_provenance = $var; - - return $this; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - * @return string - */ - public function getWorkerPool() - { - return $this->worker_pool; - } - - /** - * Name of the Cloud Build Custom Worker Pool that should be used to build the - * function. The format of this field is - * `projects/{project}/locations/{region}/workerPools/{workerPool}` where - * {project} and {region} are the project id and region respectively where the - * worker pool is defined and {workerPool} is the short name of the worker - * pool. - * If the project id is not the same as the function, then the Cloud - * Functions Service Agent - * (service-@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role Cloud Build Custom Workers Builder - * (roles/cloudbuild.customworkers.builder) in the project. - * - * Generated from protobuf field string worker_pool = 5 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setWorkerPool($var) - { - GPBUtil::checkString($var, True); - $this->worker_pool = $var; - - return $this; - } - - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * User-provided build-time environment variables for the function - * - * Generated from protobuf field map environment_variables = 6; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - * @return int - */ - public function getDockerRegistry() - { - return $this->docker_registry; - } - - /** - * Docker Registry to use for this deployment. This configuration is only - * applicable to 1st Gen functions, 2nd Gen functions can only use Artifact - * Registry. - * If unspecified, it defaults to `ARTIFACT_REGISTRY`. - * If `docker_repository` field is specified, this field should either be left - * unspecified or set to `ARTIFACT_REGISTRY`. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig.DockerRegistry docker_registry = 10; - * @param int $var - * @return $this - */ - public function setDockerRegistry($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\BuildConfig\DockerRegistry::class); - $this->docker_registry = $var; - - return $this; - } - - /** - * Repository in Artifact Registry to which the function docker image will be - * pushed after it is built by Cloud Build. If specified by user, it is - * created and managed by user with a customer managed encryption key. - * Otherwise, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - * @return string - */ - public function getDockerRepository() - { - return $this->docker_repository; - } - - /** - * Repository in Artifact Registry to which the function docker image will be - * pushed after it is built by Cloud Build. If specified by user, it is - * created and managed by user with a customer managed encryption key. - * Otherwise, GCF will create and use a repository named 'gcf-artifacts' - * for every deployed region. - * It must match the pattern - * `projects/{project}/locations/{location}/repositories/{repository}`. - * Cross-project repositories are not supported. - * Cross-location repositories are not supported. - * Repository format must be 'DOCKER'. - * - * Generated from protobuf field string docker_repository = 7 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDockerRepository($var) - { - GPBUtil::checkString($var, True); - $this->docker_repository = $var; - - return $this; - } - - /** - * Service account to be used for building the container. The format of this - * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string service_account = 27; - * @return string - */ - public function getServiceAccount() - { - return $this->service_account; - } - - /** - * Service account to be used for building the container. The format of this - * field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - * - * Generated from protobuf field string service_account = 27; - * @param string $var - * @return $this - */ - public function setServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->service_account = $var; - - return $this; - } - - /** - * @return string - */ - public function getRuntimeUpdatePolicy() - { - return $this->whichOneof("runtime_update_policy"); - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php deleted file mode 100644 index dc5838f431f2..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/BuildConfig/DockerRegistry.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.functions.v2.BuildConfig.DockerRegistry - */ -class DockerRegistry -{ - /** - * Unspecified. - * - * Generated from protobuf enum DOCKER_REGISTRY_UNSPECIFIED = 0; - */ - const DOCKER_REGISTRY_UNSPECIFIED = 0; - /** - * Docker images will be stored in multi-regional Container Registry - * repositories named `gcf`. - * - * Generated from protobuf enum CONTAINER_REGISTRY = 1; - */ - const CONTAINER_REGISTRY = 1; - /** - * Docker images will be stored in regional Artifact Registry repositories. - * By default, GCF will create and use repositories named `gcf-artifacts` - * in every region in which a function is deployed. But the repository to - * use can also be specified by the user using the `docker_repository` - * field. - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 2; - */ - const ARTIFACT_REGISTRY = 2; - - private static $valueToName = [ - self::DOCKER_REGISTRY_UNSPECIFIED => 'DOCKER_REGISTRY_UNSPECIFIED', - self::CONTAINER_REGISTRY => 'CONTAINER_REGISTRY', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DockerRegistry::class, \Google\Cloud\Functions\V2\BuildConfig_DockerRegistry::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php deleted file mode 100644 index 903e08f50551..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/CreateFunctionRequest.php +++ /dev/null @@ -1,184 +0,0 @@ -google.cloud.functions.v2.CreateFunctionRequest - */ -class CreateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - */ - protected $function_id = ''; - - /** - * @param string $parent Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. - * @param \Google\Cloud\Functions\V2\PBFunction $function Required. Function to be created. - * @param string $functionId The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * @return \Google\Cloud\Functions\V2\CreateFunctionRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Functions\V2\PBFunction $function, string $functionId): self - { - return (new self()) - ->setParent($parent) - ->setFunction($function) - ->setFunctionId($functionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @type \Google\Cloud\Functions\V2\PBFunction $function - * Required. Function to be created. - * @type string $function_id - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the function should be created, - * 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 in which the function should be created, - * 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; - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V2\PBFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. Function to be created. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V2\PBFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); - $this->function = $var; - - return $this; - } - - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - * @return string - */ - public function getFunctionId() - { - return $this->function_id; - } - - /** - * The ID to use for the function, which will become the final component of - * the function's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * - * Generated from protobuf field string function_id = 3; - * @param string $var - * @return $this - */ - public function setFunctionId($var) - { - GPBUtil::checkString($var, True); - $this->function_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php deleted file mode 100644 index cd7afb9522a6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/DeleteFunctionRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.functions.v2.DeleteFunctionRequest - */ -class DeleteFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which should be deleted. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the function which should be deleted. Please see - * {@see FunctionServiceClient::functionName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\DeleteFunctionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which should be deleted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which should be deleted. - * - * 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 function which should be deleted. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php deleted file mode 100644 index a1fd8153a794..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Environment.php +++ /dev/null @@ -1,61 +0,0 @@ -google.cloud.functions.v2.Environment - */ -class Environment -{ - /** - * Unspecified - * - * Generated from protobuf enum ENVIRONMENT_UNSPECIFIED = 0; - */ - const ENVIRONMENT_UNSPECIFIED = 0; - /** - * Gen 1 - * - * Generated from protobuf enum GEN_1 = 1; - */ - const GEN_1 = 1; - /** - * Gen 2 - * - * Generated from protobuf enum GEN_2 = 2; - */ - const GEN_2 = 2; - - private static $valueToName = [ - self::ENVIRONMENT_UNSPECIFIED => 'ENVIRONMENT_UNSPECIFIED', - self::GEN_1 => 'GEN_1', - self::GEN_2 => 'GEN_2', - ]; - - 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php deleted file mode 100644 index 15ec540f1dd6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventFilter.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.functions.v2.EventFilter - */ -class EventFilter extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $attribute = ''; - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $value = ''; - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $operator = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $attribute - * Required. The name of a CloudEvents attribute. - * @type string $value - * Required. The value for the attribute. - * @type string $operator - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getAttribute() - { - return $this->attribute; - } - - /** - * Required. The name of a CloudEvents attribute. - * - * Generated from protobuf field string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setAttribute($var) - { - GPBUtil::checkString($var, True); - $this->attribute = $var; - - return $this; - } - - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Required. The value for the attribute. - * - * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setValue($var) - { - GPBUtil::checkString($var, True); - $this->value = $var; - - return $this; - } - - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getOperator() - { - return $this->operator; - } - - /** - * Optional. The operator used for matching the events with the value of the - * filter. If not specified, only events that have an exact key-value pair - * specified in the filter are matched. The only allowed value is - * `match-path-pattern`. - * - * Generated from protobuf field string operator = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setOperator($var) - { - GPBUtil::checkString($var, True); - $this->operator = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php deleted file mode 100644 index 62813744547d..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger.php +++ /dev/null @@ -1,432 +0,0 @@ -google.cloud.functions.v2.EventTrigger - */ -class EventTrigger extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $trigger = ''; - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - */ - protected $trigger_region = ''; - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $event_type = ''; - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - */ - private $event_filters; - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $pubsub_topic = ''; - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service_account_email = ''; - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $retry_policy = 0; - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $channel = ''; - /** - * Optional. The hostname of the service that 1st Gen function should be - * observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * The field is only applicable to 1st Gen functions. - * - * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $trigger - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * @type string $trigger_region - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * @type string $event_type - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * @type array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $event_filters - * Criteria used to filter events. - * @type string $pubsub_topic - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * @type string $service_account_email - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * @type int $retry_policy - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * @type string $channel - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * @type string $service - * Optional. The hostname of the service that 1st Gen function should be - * observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * The field is only applicable to 1st Gen functions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getTrigger() - { - return $this->trigger; - } - - /** - * Output only. The resource name of the Eventarc trigger. The format of this - * field is `projects/{project}/locations/{region}/triggers/{trigger}`. - * - * Generated from protobuf field string trigger = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTrigger($var) - { - GPBUtil::checkString($var, True); - $this->trigger = $var; - - return $this; - } - - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - * @return string - */ - public function getTriggerRegion() - { - return $this->trigger_region; - } - - /** - * The region that the trigger will be in. The trigger will only receive - * events originating in this region. It can be the same - * region as the function, a different region or multi-region, or the global - * region. If not provided, defaults to the same region as the function. - * - * Generated from protobuf field string trigger_region = 2; - * @param string $var - * @return $this - */ - public function setTriggerRegion($var) - { - GPBUtil::checkString($var, True); - $this->trigger_region = $var; - - return $this; - } - - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getEventType() - { - return $this->event_type; - } - - /** - * Required. The type of event to observe. For example: - * `google.cloud.audit.log.v1.written` or - * `google.cloud.pubsub.topic.v1.messagePublished`. - * - * Generated from protobuf field string event_type = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setEventType($var) - { - GPBUtil::checkString($var, True); - $this->event_type = $var; - - return $this; - } - - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEventFilters() - { - return $this->event_filters; - } - - /** - * Criteria used to filter events. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.EventFilter event_filters = 4; - * @param array<\Google\Cloud\Functions\V2\EventFilter>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEventFilters($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\EventFilter::class); - $this->event_filters = $arr; - - return $this; - } - - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getPubsubTopic() - { - return $this->pubsub_topic; - } - - /** - * Optional. The name of a Pub/Sub topic in the same project that will be used - * as the transport topic for the event delivery. Format: - * `projects/{project}/topics/{topic}`. - * This is only valid for events of type - * `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here - * will not be deleted at function deletion. - * - * Generated from protobuf field string pubsub_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setPubsubTopic($var) - { - GPBUtil::checkString($var, True); - $this->pubsub_topic = $var; - - return $this; - } - - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * Optional. The email of the trigger's service account. The service account - * must have permission to invoke Cloud Run services, the permission is - * `run.routes.invoke`. - * If empty, defaults to the Compute Engine default service account: - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getRetryPolicy() - { - return $this->retry_policy; - } - - /** - * Optional. If unset, then defaults to ignoring failures (i.e. not retrying - * them). - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger.RetryPolicy retry_policy = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setRetryPolicy($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\EventTrigger\RetryPolicy::class); - $this->retry_policy = $var; - - return $this; - } - - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getChannel() - { - return $this->channel; - } - - /** - * Optional. The name of the channel associated with the trigger in - * `projects/{project}/locations/{location}/channels/{channel}` format. - * You must provide a channel to receive events from Eventarc SaaS partners. - * - * Generated from protobuf field string channel = 8 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setChannel($var) - { - GPBUtil::checkString($var, True); - $this->channel = $var; - - return $this; - } - - /** - * Optional. The hostname of the service that 1st Gen function should be - * observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * The field is only applicable to 1st Gen functions. - * - * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getService() - { - return $this->service; - } - - /** - * Optional. The hostname of the service that 1st Gen function should be - * observed. - * If no string is provided, the default service implementing the API will - * be used. For example, `storage.googleapis.com` is the default for all - * event types in the `google.storage` namespace. - * The field is only applicable to 1st Gen functions. - * - * Generated from protobuf field string service = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setService($var) - { - GPBUtil::checkString($var, True); - $this->service = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php deleted file mode 100644 index fe9035ebeee4..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/EventTrigger/RetryPolicy.php +++ /dev/null @@ -1,66 +0,0 @@ -google.cloud.functions.v2.EventTrigger.RetryPolicy - */ -class RetryPolicy -{ - /** - * Not specified. - * - * Generated from protobuf enum RETRY_POLICY_UNSPECIFIED = 0; - */ - const RETRY_POLICY_UNSPECIFIED = 0; - /** - * Do not retry. - * - * Generated from protobuf enum RETRY_POLICY_DO_NOT_RETRY = 1; - */ - const RETRY_POLICY_DO_NOT_RETRY = 1; - /** - * Retry on any failure, retry up to 7 days with an exponential backoff - * (capped at 10 seconds). - * - * Generated from protobuf enum RETRY_POLICY_RETRY = 2; - */ - const RETRY_POLICY_RETRY = 2; - - private static $valueToName = [ - self::RETRY_POLICY_UNSPECIFIED => 'RETRY_POLICY_UNSPECIFIED', - self::RETRY_POLICY_DO_NOT_RETRY => 'RETRY_POLICY_DO_NOT_RETRY', - self::RETRY_POLICY_RETRY => 'RETRY_POLICY_RETRY', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(RetryPolicy::class, \Google\Cloud\Functions\V2\EventTrigger_RetryPolicy::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php deleted file mode 100644 index 6e003ddc46aa..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.GenerateDownloadUrlRequest - */ -class GenerateDownloadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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 function for which source code Google Cloud Storage - * signed URL should be generated. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php deleted file mode 100644 index c49cbe0ed3f5..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateDownloadUrlResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.GenerateDownloadUrlResponse - */ -class GenerateDownloadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - */ - protected $download_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $download_url - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @return string - */ - public function getDownloadUrl() - { - return $this->download_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for - * function source code download. - * - * Generated from protobuf field string download_url = 1; - * @param string $var - * @return $this - */ - public function setDownloadUrl($var) - { - GPBUtil::checkString($var, True); - $this->download_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php deleted file mode 100644 index e61cc8639a76..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlRequest.php +++ /dev/null @@ -1,199 +0,0 @@ -google.cloud.functions.v2.GenerateUploadUrlRequest - */ -class GenerateUploadUrlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * The function environment the generated upload url will be used for. - * The upload url for 2nd Gen functions can also be used for 1st gen - * functions, but not vice versa. If not specified, 2nd generation-style - * upload URLs are generated. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; - */ - protected $environment = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * @type string $kms_key_name - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @type int $environment - * The function environment the generated upload url will be used for. - * The upload url for 2nd Gen functions can also be used for 1st gen - * functions, but not vice versa. If not specified, 2nd generation-style - * upload URLs are generated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, 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 in which the Google Cloud Storage signed - * URL should be generated, 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; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * The function environment the generated upload url will be used for. - * The upload url for 2nd Gen functions can also be used for 1st gen - * functions, but not vice versa. If not specified, 2nd generation-style - * upload URLs are generated. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; - * @return int - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * The function environment the generated upload url will be used for. - * The upload url for 2nd Gen functions can also be used for 1st gen - * functions, but not vice versa. If not specified, 2nd generation-style - * upload URLs are generated. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 3; - * @param int $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); - $this->environment = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php deleted file mode 100644 index ec4ee0a82cfa..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GenerateUploadUrlResponse.php +++ /dev/null @@ -1,139 +0,0 @@ -google.cloud.functions.v2.GenerateUploadUrlResponse - */ -class GenerateUploadUrlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - */ - protected $upload_url = ''; - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - */ - protected $storage_source = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $upload_url - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * @type \Google\Cloud\Functions\V2\StorageSource $storage_source - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @return string - */ - public function getUploadUrl() - { - return $this->upload_url; - } - - /** - * The generated Google Cloud Storage signed URL that should be used for a - * function source code upload. The uploaded file should be a zip archive - * which contains a function. - * - * Generated from protobuf field string upload_url = 1; - * @param string $var - * @return $this - */ - public function setUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->upload_url = $var; - - return $this; - } - - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getStorageSource() - { - return $this->storage_source; - } - - public function hasStorageSource() - { - return isset($this->storage_source); - } - - public function clearStorageSource() - { - unset($this->storage_source); - } - - /** - * The location of the source code in the upload bucket. - * Once the archive is uploaded using the `upload_url` use this field to - * set the `function.build_config.source.storage_source` - * during CreateFunction and UpdateFunction. - * Generation defaults to 0, as Cloud Storage provides a new generation only - * upon uploading a new object or version of an object. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 2; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->storage_source = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php deleted file mode 100644 index 015177d21580..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/GetFunctionRequest.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.functions.v2.GetFunctionRequest - */ -class GetFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the function which details should be obtained. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Optional. The version of the 1st gen function whose details should - * be obtained. The version of a 1st gen function is an integer that starts - * from 1 and gets incremented on redeployments. GCF may keep historical - * configs for old versions of 1st gen function. This field can be specified - * to fetch the historical configs. This field is valid only for GCF 1st gen - * function. - * - * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $revision = ''; - - /** - * @param string $name Required. The name of the function which details should be obtained. Please see - * {@see FunctionServiceClient::functionName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\GetFunctionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the function which details should be obtained. - * @type string $revision - * Optional. The version of the 1st gen function whose details should - * be obtained. The version of a 1st gen function is an integer that starts - * from 1 and gets incremented on redeployments. GCF may keep historical - * configs for old versions of 1st gen function. This field can be specified - * to fetch the historical configs. This field is valid only for GCF 1st gen - * function. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the function which details should be obtained. - * - * 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 function which details should be obtained. - * - * 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. The version of the 1st gen function whose details should - * be obtained. The version of a 1st gen function is an integer that starts - * from 1 and gets incremented on redeployments. GCF may keep historical - * configs for old versions of 1st gen function. This field can be specified - * to fetch the historical configs. This field is valid only for GCF 1st gen - * function. - * - * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getRevision() - { - return $this->revision; - } - - /** - * Optional. The version of the 1st gen function whose details should - * be obtained. The version of a 1st gen function is an integer that starts - * from 1 and gets incremented on redeployments. GCF may keep historical - * configs for old versions of 1st gen function. This field can be specified - * to fetch the historical configs. This field is valid only for GCF 1st gen - * function. - * - * Generated from protobuf field string revision = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setRevision($var) - { - GPBUtil::checkString($var, True); - $this->revision = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php deleted file mode 100644 index 993b0f979c80..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsRequest.php +++ /dev/null @@ -1,278 +0,0 @@ -google.cloud.functions.v2.ListFunctionsRequest - */ -class ListFunctionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - */ - protected $filter = ''; - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - */ - protected $order_by = ''; - - /** - * @param string $parent Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. Please see - * {@see FunctionServiceClient::locationName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\ListFunctionsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable locations. - * @type int $page_size - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * @type string $page_token - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @type string $filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type string $order_by - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of functions to return per call. The largest allowed - * page_size is 1,000, if the page_size is omitted or specified as greater - * than 1,000 then it will be replaced as 1,000. The size of the list - * response can be less than specified when used with filters. - * - * 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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 - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` 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; - } - - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 4; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * - * Generated from protobuf field string order_by = 5; - * @param string $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkString($var, True); - $this->order_by = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php deleted file mode 100644 index edfa21aa7abe..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListFunctionsResponse.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.functions.v2.ListFunctionsResponse - */ -class ListFunctionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - */ - private $functions; - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Locations that could not be reached. The response does not include any - * functions from these locations. - * - * 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\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $functions - * The functions that match the request. - * @type string $next_page_token - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. The response does not include any - * functions from these locations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * The functions that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Function functions = 1; - * @param array<\Google\Cloud\Functions\V2\PBFunction>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setFunctions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\PBFunction::class); - $this->functions = $arr; - - return $this; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * 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. The response does not include any - * functions from these locations. - * - * 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. The response does not include any - * functions from these locations. - * - * 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/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php deleted file mode 100644 index 7b4e50584294..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesRequest.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v2.ListRuntimesRequest - */ -class ListRuntimesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project and location from which the runtimes 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 = ''; - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - - /** - * @param string $parent Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * Please see {@see FunctionServiceClient::locationName()} for help formatting this field. - * - * @return \Google\Cloud\Functions\V2\ListRuntimesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * @type string $filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project and location from which the runtimes 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 runtimes 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; - } - - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php deleted file mode 100644 index b833f9d472e1..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse - */ -class ListRuntimesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - */ - private $runtimes; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $runtimes - * The runtimes that match the request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getRuntimes() - { - return $this->runtimes; - } - - /** - * The runtimes that match the request. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.ListRuntimesResponse.Runtime runtimes = 1; - * @param array<\Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setRuntimes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\ListRuntimesResponse\Runtime::class); - $this->runtimes = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php deleted file mode 100644 index 2928581dd1a4..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/Runtime.php +++ /dev/null @@ -1,295 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse.Runtime - */ -class Runtime extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - */ - protected $display_name = ''; - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - */ - protected $stage = 0; - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - */ - private $warnings; - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - */ - protected $environment = 0; - /** - * Deprecation date for the runtime. - * - * Generated from protobuf field .google.type.Date deprecation_date = 6; - */ - protected $deprecation_date = null; - /** - * Decommission date for the runtime. - * - * Generated from protobuf field .google.type.Date decommission_date = 7; - */ - protected $decommission_date = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * @type string $display_name - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * @type int $stage - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * @type array|\Google\Protobuf\Internal\RepeatedField $warnings - * Warning messages, e.g., a deprecation warning. - * @type int $environment - * The environment for the runtime. - * @type \Google\Type\Date $deprecation_date - * Deprecation date for the runtime. - * @type \Google\Type\Date $decommission_date - * Decommission date for the runtime. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the runtime, e.g., 'go113', 'nodejs12', etc. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The user facing name, eg 'Go 1.13', 'Node.js 12', etc. - * - * Generated from protobuf field string display_name = 5; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - * @return int - */ - public function getStage() - { - return $this->stage; - } - - /** - * The stage of life this runtime is in, e.g., BETA, GA, etc. - * - * Generated from protobuf field .google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage stage = 2; - * @param int $var - * @return $this - */ - public function setStage($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ListRuntimesResponse\RuntimeStage::class); - $this->stage = $var; - - return $this; - } - - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWarnings() - { - return $this->warnings; - } - - /** - * Warning messages, e.g., a deprecation warning. - * - * Generated from protobuf field repeated string warnings = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWarnings($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->warnings = $arr; - - return $this; - } - - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - * @return int - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * The environment for the runtime. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 4; - * @param int $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); - $this->environment = $var; - - return $this; - } - - /** - * Deprecation date for the runtime. - * - * Generated from protobuf field .google.type.Date deprecation_date = 6; - * @return \Google\Type\Date|null - */ - public function getDeprecationDate() - { - return $this->deprecation_date; - } - - public function hasDeprecationDate() - { - return isset($this->deprecation_date); - } - - public function clearDeprecationDate() - { - unset($this->deprecation_date); - } - - /** - * Deprecation date for the runtime. - * - * Generated from protobuf field .google.type.Date deprecation_date = 6; - * @param \Google\Type\Date $var - * @return $this - */ - public function setDeprecationDate($var) - { - GPBUtil::checkMessage($var, \Google\Type\Date::class); - $this->deprecation_date = $var; - - return $this; - } - - /** - * Decommission date for the runtime. - * - * Generated from protobuf field .google.type.Date decommission_date = 7; - * @return \Google\Type\Date|null - */ - public function getDecommissionDate() - { - return $this->decommission_date; - } - - public function hasDecommissionDate() - { - return isset($this->decommission_date); - } - - public function clearDecommissionDate() - { - unset($this->decommission_date); - } - - /** - * Decommission date for the runtime. - * - * Generated from protobuf field .google.type.Date decommission_date = 7; - * @param \Google\Type\Date $var - * @return $this - */ - public function setDecommissionDate($var) - { - GPBUtil::checkMessage($var, \Google\Type\Date::class); - $this->decommission_date = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Runtime::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_Runtime::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php deleted file mode 100644 index 60d76ac6285e..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ListRuntimesResponse/RuntimeStage.php +++ /dev/null @@ -1,92 +0,0 @@ -google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage - */ -class RuntimeStage -{ - /** - * Not specified. - * - * Generated from protobuf enum RUNTIME_STAGE_UNSPECIFIED = 0; - */ - const RUNTIME_STAGE_UNSPECIFIED = 0; - /** - * The runtime is in development. - * - * Generated from protobuf enum DEVELOPMENT = 1; - */ - const DEVELOPMENT = 1; - /** - * The runtime is in the Alpha stage. - * - * Generated from protobuf enum ALPHA = 2; - */ - const ALPHA = 2; - /** - * The runtime is in the Beta stage. - * - * Generated from protobuf enum BETA = 3; - */ - const BETA = 3; - /** - * The runtime is generally available. - * - * Generated from protobuf enum GA = 4; - */ - const GA = 4; - /** - * The runtime is deprecated. - * - * Generated from protobuf enum DEPRECATED = 5; - */ - const DEPRECATED = 5; - /** - * The runtime is no longer supported. - * - * Generated from protobuf enum DECOMMISSIONED = 6; - */ - const DECOMMISSIONED = 6; - - private static $valueToName = [ - self::RUNTIME_STAGE_UNSPECIFIED => 'RUNTIME_STAGE_UNSPECIFIED', - self::DEVELOPMENT => 'DEVELOPMENT', - self::ALPHA => 'ALPHA', - self::BETA => 'BETA', - self::GA => 'GA', - self::DEPRECATED => 'DEPRECATED', - self::DECOMMISSIONED => 'DECOMMISSIONED', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(RuntimeStage::class, \Google\Cloud\Functions\V2\ListRuntimesResponse_RuntimeStage::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php deleted file mode 100644 index f6f8e06ea974..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/LocationMetadata.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.LocationMetadata - */ -class LocationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - */ - private $environments; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $environments - * The Cloud Function environments this location supports. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEnvironments() - { - return $this->environments; - } - - /** - * The Cloud Function environments this location supports. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Environment environments = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEnvironments($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Functions\V2\Environment::class); - $this->environments = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php deleted file mode 100644 index b6394ceb74f7..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/OperationMetadata.php +++ /dev/null @@ -1,495 +0,0 @@ -google.cloud.functions.v2.OperationMetadata - */ -class OperationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - protected $create_time = null; - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - */ - protected $end_time = null; - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - */ - protected $target = ''; - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - */ - protected $verb = ''; - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - */ - protected $status_detail = ''; - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have - * [google.longrunning.Operation.error][google.longrunning.Operation.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool cancel_requested = 6; - */ - protected $cancel_requested = false; - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - */ - protected $api_version = ''; - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - */ - protected $request_resource = null; - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - */ - private $stages; - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 10; - */ - protected $source_token = ''; - /** - * The build name of the function for create and update operations. - * - * Generated from protobuf field string build_name = 13; - */ - protected $build_name = ''; - /** - * The operation type. - * - * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; - */ - protected $operation_type = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $create_time - * The time the operation was created. - * @type \Google\Protobuf\Timestamp $end_time - * The time the operation finished running. - * @type string $target - * Server-defined resource path for the target of the operation. - * @type string $verb - * Name of the verb executed by the operation. - * @type string $status_detail - * Human-readable status of the operation, if any. - * @type bool $cancel_requested - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have - * [google.longrunning.Operation.error][google.longrunning.Operation.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * @type string $api_version - * API version used to start the operation. - * @type \Google\Protobuf\Any $request_resource - * The original request that started the operation. - * @type array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $stages - * Mechanism for reporting in-progress stages - * @type string $source_token - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * @type string $build_name - * The build name of the function for create and update operations. - * @type int $operation_type - * The operation type. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @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); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @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); - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @return string - */ - public function getVerb() - { - return $this->verb; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @param string $var - * @return $this - */ - public function setVerb($var) - { - GPBUtil::checkString($var, True); - $this->verb = $var; - - return $this; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @return string - */ - public function getStatusDetail() - { - return $this->status_detail; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @param string $var - * @return $this - */ - public function setStatusDetail($var) - { - GPBUtil::checkString($var, True); - $this->status_detail = $var; - - return $this; - } - - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have - * [google.longrunning.Operation.error][google.longrunning.Operation.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool cancel_requested = 6; - * @return bool - */ - public function getCancelRequested() - { - return $this->cancel_requested; - } - - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have - * [google.longrunning.Operation.error][google.longrunning.Operation.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool cancel_requested = 6; - * @param bool $var - * @return $this - */ - public function setCancelRequested($var) - { - GPBUtil::checkBool($var); - $this->cancel_requested = $var; - - return $this; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - * @return string - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - * @param string $var - * @return $this - */ - public function setApiVersion($var) - { - GPBUtil::checkString($var, True); - $this->api_version = $var; - - return $this; - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - * @return \Google\Protobuf\Any|null - */ - public function getRequestResource() - { - return $this->request_resource; - } - - public function hasRequestResource() - { - return isset($this->request_resource); - } - - public function clearRequestResource() - { - unset($this->request_resource); - } - - /** - * The original request that started the operation. - * - * Generated from protobuf field .google.protobuf.Any request_resource = 8; - * @param \Google\Protobuf\Any $var - * @return $this - */ - public function setRequestResource($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); - $this->request_resource = $var; - - return $this; - } - - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStages() - { - return $this->stages; - } - - /** - * Mechanism for reporting in-progress stages - * - * Generated from protobuf field repeated .google.cloud.functions.v2.Stage stages = 9; - * @param array<\Google\Cloud\Functions\V2\Stage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\Stage::class); - $this->stages = $arr; - - return $this; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 10; - * @return string - */ - public function getSourceToken() - { - return $this->source_token; - } - - /** - * An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. - * - * Generated from protobuf field string source_token = 10; - * @param string $var - * @return $this - */ - public function setSourceToken($var) - { - GPBUtil::checkString($var, True); - $this->source_token = $var; - - return $this; - } - - /** - * The build name of the function for create and update operations. - * - * Generated from protobuf field string build_name = 13; - * @return string - */ - public function getBuildName() - { - return $this->build_name; - } - - /** - * The build name of the function for create and update operations. - * - * Generated from protobuf field string build_name = 13; - * @param string $var - * @return $this - */ - public function setBuildName($var) - { - GPBUtil::checkString($var, True); - $this->build_name = $var; - - return $this; - } - - /** - * The operation type. - * - * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; - * @return int - */ - public function getOperationType() - { - return $this->operation_type; - } - - /** - * The operation type. - * - * Generated from protobuf field .google.cloud.functions.v2.OperationType operation_type = 11; - * @param int $var - * @return $this - */ - public function setOperationType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\OperationType::class); - $this->operation_type = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php deleted file mode 100644 index f910190061c4..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction.php +++ /dev/null @@ -1,592 +0,0 @@ -google.cloud.functions.v2.Function - */ -class PBFunction extends \Google\Protobuf\Internal\Message -{ - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - */ - protected $build_config = null; - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - */ - protected $service_config = null; - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - */ - protected $event_trigger = null; - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - */ - private $labels; - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $state_messages; - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - */ - protected $environment = 0; - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $url = ''; - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Output only. Reserved for future use. - * - * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $satisfies_pzs = false; - /** - * Output only. The create timestamp of a Cloud Function. This is only - * applicable to 2nd Gen functions. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * @type string $description - * User-provided description of a function. - * @type \Google\Cloud\Functions\V2\BuildConfig $build_config - * Describes the Build step of the function that builds a container from the - * given source. - * @type \Google\Cloud\Functions\V2\ServiceConfig $service_config - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * @type \Google\Cloud\Functions\V2\EventTrigger $event_trigger - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * @type int $state - * Output only. State of the function. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The last update timestamp of a Cloud Function. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels associated with this Cloud Function. - * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages - * Output only. State Messages for this Cloud Function. - * @type int $environment - * Describe whether the function is 1st Gen or 2nd Gen. - * @type string $url - * Output only. The deployed url for the function. - * @type string $kms_key_name - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * @type bool $satisfies_pzs - * Output only. Reserved for future use. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The create timestamp of a Cloud Function. This is only - * applicable to 2nd Gen functions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * A user-defined name of the function. Function names must be unique - * globally and match pattern `projects/*/locations/*/functions/*` - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * User-provided description of a function. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - * @return \Google\Cloud\Functions\V2\BuildConfig|null - */ - public function getBuildConfig() - { - return $this->build_config; - } - - public function hasBuildConfig() - { - return isset($this->build_config); - } - - public function clearBuildConfig() - { - unset($this->build_config); - } - - /** - * Describes the Build step of the function that builds a container from the - * given source. - * - * Generated from protobuf field .google.cloud.functions.v2.BuildConfig build_config = 3; - * @param \Google\Cloud\Functions\V2\BuildConfig $var - * @return $this - */ - public function setBuildConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\BuildConfig::class); - $this->build_config = $var; - - return $this; - } - - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - * @return \Google\Cloud\Functions\V2\ServiceConfig|null - */ - public function getServiceConfig() - { - return $this->service_config; - } - - public function hasServiceConfig() - { - return isset($this->service_config); - } - - public function clearServiceConfig() - { - unset($this->service_config); - } - - /** - * Describes the Service being deployed. Currently deploys services to Cloud - * Run (fully managed). - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig service_config = 4; - * @param \Google\Cloud\Functions\V2\ServiceConfig $var - * @return $this - */ - public function setServiceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\ServiceConfig::class); - $this->service_config = $var; - - return $this; - } - - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - * @return \Google\Cloud\Functions\V2\EventTrigger|null - */ - public function getEventTrigger() - { - return $this->event_trigger; - } - - public function hasEventTrigger() - { - return isset($this->event_trigger); - } - - public function clearEventTrigger() - { - unset($this->event_trigger); - } - - /** - * An Eventarc trigger managed by Google Cloud Functions that fires events in - * response to a condition in another service. - * - * Generated from protobuf field .google.cloud.functions.v2.EventTrigger event_trigger = 5; - * @param \Google\Cloud\Functions\V2\EventTrigger $var - * @return $this - */ - public function setEventTrigger($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\EventTrigger::class); - $this->event_trigger = $var; - - return $this; - } - - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. State of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\PBFunction\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. The last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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 last update timestamp of a Cloud Function. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.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; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels associated with this Cloud Function. - * - * Generated from protobuf field map labels = 8; - * @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; - } - - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStateMessages() - { - return $this->state_messages; - } - - /** - * Output only. State Messages for this Cloud Function. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStateMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); - $this->state_messages = $arr; - - return $this; - } - - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - * @return int - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Describe whether the function is 1st Gen or 2nd Gen. - * - * Generated from protobuf field .google.cloud.functions.v2.Environment environment = 10; - * @param int $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Environment::class); - $this->environment = $var; - - return $this; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Output only. The deployed url for the function. - * - * Generated from protobuf field string url = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUrl($var) - { - GPBUtil::checkString($var, True); - $this->url = $var; - - return $this; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function resources. - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * Generated from protobuf field string kms_key_name = 25 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Output only. Reserved for future use. - * - * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return bool - */ - public function getSatisfiesPzs() - { - return $this->satisfies_pzs; - } - - /** - * Output only. Reserved for future use. - * - * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param bool $var - * @return $this - */ - public function setSatisfiesPzs($var) - { - GPBUtil::checkBool($var); - $this->satisfies_pzs = $var; - - return $this; - } - - /** - * Output only. The create timestamp of a Cloud Function. This is only - * applicable to 2nd Gen functions. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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 create timestamp of a Cloud Function. This is only - * applicable to 2nd Gen functions. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 28 [(.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; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php deleted file mode 100644 index f6e8c8a0e5cd..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/PBFunction/State.php +++ /dev/null @@ -1,86 +0,0 @@ -google.cloud.functions.v2.Function.State - */ -class State -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Function has been successfully deployed and is serving. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Function deployment failed and the function is not serving. - * - * Generated from protobuf enum FAILED = 2; - */ - const FAILED = 2; - /** - * Function is being created or updated. - * - * Generated from protobuf enum DEPLOYING = 3; - */ - const DEPLOYING = 3; - /** - * Function is being deleted. - * - * Generated from protobuf enum DELETING = 4; - */ - const DELETING = 4; - /** - * Function deployment failed and the function serving state is undefined. - * The function should be updated or deleted to move it out of this state. - * - * Generated from protobuf enum UNKNOWN = 5; - */ - const UNKNOWN = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::FAILED => 'FAILED', - self::DEPLOYING => 'DEPLOYING', - self::DELETING => 'DELETING', - self::UNKNOWN => 'UNKNOWN', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Functions\V2\Function_State::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php deleted file mode 100644 index 5326f62530e6..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/RepoSource.php +++ /dev/null @@ -1,309 +0,0 @@ -google.cloud.functions.v2.RepoSource - */ -class RepoSource extends \Google\Protobuf\Internal\Message -{ - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - */ - protected $project_id = ''; - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - */ - protected $repo_name = ''; - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - */ - protected $dir = ''; - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - */ - protected $invert_regex = false; - protected $revision; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $branch_name - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * @type string $tag_name - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * @type string $commit_sha - * Explicit commit SHA to build. - * @type string $project_id - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * @type string $repo_name - * Name of the Cloud Source Repository. - * @type string $dir - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * @type bool $invert_regex - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string branch_name = 3; - * @return string - */ - public function getBranchName() - { - return $this->readOneof(3); - } - - public function hasBranchName() - { - return $this->hasOneof(3); - } - - /** - * Regex matching branches to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string branch_name = 3; - * @param string $var - * @return $this - */ - public function setBranchName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string tag_name = 4; - * @return string - */ - public function getTagName() - { - return $this->readOneof(4); - } - - public function hasTagName() - { - return $this->hasOneof(4); - } - - /** - * Regex matching tags to build. - * The syntax of the regular expressions accepted is the syntax accepted by - * RE2 and described at https://github.com/google/re2/wiki/Syntax - * - * Generated from protobuf field string tag_name = 4; - * @param string $var - * @return $this - */ - public function setTagName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Explicit commit SHA to build. - * - * Generated from protobuf field string commit_sha = 5; - * @return string - */ - public function getCommitSha() - { - return $this->readOneof(5); - } - - public function hasCommitSha() - { - return $this->hasOneof(5); - } - - /** - * Explicit commit SHA to build. - * - * Generated from protobuf field string commit_sha = 5; - * @param string $var - * @return $this - */ - public function setCommitSha($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * ID of the project that owns the Cloud Source Repository. If omitted, the - * project ID requesting the build is assumed. - * - * Generated from protobuf field string project_id = 1; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - * @return string - */ - public function getRepoName() - { - return $this->repo_name; - } - - /** - * Name of the Cloud Source Repository. - * - * Generated from protobuf field string repo_name = 2; - * @param string $var - * @return $this - */ - public function setRepoName($var) - { - GPBUtil::checkString($var, True); - $this->repo_name = $var; - - return $this; - } - - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - * @return string - */ - public function getDir() - { - return $this->dir; - } - - /** - * Directory, relative to the source root, in which to run the build. - * This must be a relative path. If a step's `dir` is specified and is an - * absolute path, this value is ignored for that step's execution. - * eg. helloworld (no leading slash allowed) - * - * Generated from protobuf field string dir = 6; - * @param string $var - * @return $this - */ - public function setDir($var) - { - GPBUtil::checkString($var, True); - $this->dir = $var; - - return $this; - } - - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - * @return bool - */ - public function getInvertRegex() - { - return $this->invert_regex; - } - - /** - * Only trigger a build if the revision regex does NOT match the revision - * regex. - * - * Generated from protobuf field bool invert_regex = 7; - * @param bool $var - * @return $this - */ - public function setInvertRegex($var) - { - GPBUtil::checkBool($var); - $this->invert_regex = $var; - - return $this; - } - - /** - * @return string - */ - public function getRevision() - { - return $this->whichOneof("revision"); - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php deleted file mode 100644 index d14b7f6d187b..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretEnvVar.php +++ /dev/null @@ -1,191 +0,0 @@ -google.cloud.functions.v2.SecretEnvVar - */ -class SecretEnvVar extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - */ - protected $key = ''; - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - */ - protected $version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $key - * Name of the environment variable. - * @type string $project_id - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Name of the environment variable. - * - * Generated from protobuf field string key = 1; - * @param string $var - * @return $this - */ - public function setKey($var) - { - GPBUtil::checkString($var, True); - $this->key = $var; - - return $this; - } - - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferably project number but can also be the - * project ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * recommended to use a numeric version for secret environment variables as - * any updates to the secret value is not reflected until new instances - * start. - * - * Generated from protobuf field string version = 4; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php deleted file mode 100644 index 505db9251bf8..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume.php +++ /dev/null @@ -1,203 +0,0 @@ -google.cloud.functions.v2.SecretVolume - */ -class SecretVolume extends \Google\Protobuf\Internal\Message -{ - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - */ - protected $mount_path = ''; - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - */ - protected $project_id = ''; - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - */ - protected $secret = ''; - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - */ - private $versions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $mount_path - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * @type string $project_id - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * @type string $secret - * Name of the secret in secret manager (not the full resource name). - * @type array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - * @return string - */ - public function getMountPath() - { - return $this->mount_path; - } - - /** - * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely - * shadowed and unavailable to mount any other secrets. - * Recommended mount path: /etc/secrets - * - * Generated from protobuf field string mount_path = 1; - * @param string $var - * @return $this - */ - public function setMountPath($var) - { - GPBUtil::checkString($var, True); - $this->mount_path = $var; - - return $this; - } - - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @return string - */ - public function getProjectId() - { - return $this->project_id; - } - - /** - * Project identifier (preferably project number but can also be the project - * ID) of the project that contains the secret. If not set, it is - * assumed that the secret is in the same project as the function. - * - * Generated from protobuf field string project_id = 2; - * @param string $var - * @return $this - */ - public function setProjectId($var) - { - GPBUtil::checkString($var, True); - $this->project_id = $var; - - return $this; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @return string - */ - public function getSecret() - { - return $this->secret; - } - - /** - * Name of the secret in secret manager (not the full resource name). - * - * Generated from protobuf field string secret = 3; - * @param string $var - * @return $this - */ - public function setSecret($var) - { - GPBUtil::checkString($var, True); - $this->secret = $var; - - return $this; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getVersions() - { - return $this->versions; - } - - /** - * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the - * secret under the mount point. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume.SecretVersion versions = 4; - * @param array<\Google\Cloud\Functions\V2\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setVersions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume\SecretVersion::class); - $this->versions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php deleted file mode 100644 index fe99c1e3ddd3..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SecretVolume/SecretVersion.php +++ /dev/null @@ -1,124 +0,0 @@ -google.cloud.functions.v2.SecretVolume.SecretVersion - */ -class SecretVersion extends \Google\Protobuf\Internal\Message -{ - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - */ - protected $version = ''; - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - */ - protected $path = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $version - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * @type string $path - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Version of the secret (version number or the string 'latest'). It is - * preferable to use `latest` version with secret volumes as secret value - * changes are reflected immediately. - * - * Generated from protobuf field string version = 1; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `secret_foo` would mount the - * secret value file at `/etc/secrets/secret_foo`. - * - * Generated from protobuf field string path = 2; - * @param string $var - * @return $this - */ - public function setPath($var) - { - GPBUtil::checkString($var, True); - $this->path = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecretVersion::class, \Google\Cloud\Functions\V2\SecretVolume_SecretVersion::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php deleted file mode 100644 index d0d031b1c59c..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig.php +++ /dev/null @@ -1,848 +0,0 @@ -google.cloud.functions.v2.ServiceConfig - */ -class ServiceConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $service = ''; - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - */ - protected $timeout_seconds = 0; - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - */ - protected $available_memory = ''; - /** - * The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - */ - protected $available_cpu = ''; - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - */ - private $environment_variables; - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - */ - protected $max_instance_count = 0; - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - */ - protected $min_instance_count = 0; - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - */ - protected $vpc_connector = ''; - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - */ - protected $vpc_connector_egress_settings = 0; - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - */ - protected $ingress_settings = 0; - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $uri = ''; - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - */ - protected $service_account_email = ''; - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - */ - protected $all_traffic_on_latest_revision = false; - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - */ - private $secret_environment_variables; - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - */ - private $secret_volumes; - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $revision = ''; - /** - * Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - */ - protected $max_instance_request_concurrency = 0; - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - */ - protected $security_level = 0; - /** - * Optional. The binary authorization policy to be checked when deploying the - * Cloud Run service. - * - * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $binary_authorization_policy = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $service - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * @type int $timeout_seconds - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * @type string $available_memory - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * @type string $available_cpu - * The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * @type array|\Google\Protobuf\Internal\MapField $environment_variables - * Environment variables that shall be available during function execution. - * @type int $max_instance_count - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * @type int $min_instance_count - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * @type string $vpc_connector - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * @type int $vpc_connector_egress_settings - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * @type int $ingress_settings - * The ingress settings for the function, controlling what traffic can reach - * it. - * @type string $uri - * Output only. URI of the Service deployed. - * @type string $service_account_email - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * @type bool $all_traffic_on_latest_revision - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * @type array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $secret_environment_variables - * Secret environment variables configuration. - * @type array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes - * Secret volumes configuration. - * @type string $revision - * Output only. The name of service revision. - * @type int $max_instance_request_concurrency - * Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * @type int $security_level - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * @type string $binary_authorization_policy - * Optional. The binary authorization policy to be checked when deploying the - * Cloud Run service. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getService() - { - return $this->service; - } - - /** - * Output only. Name of the service associated with a Function. - * The format of this field is - * `projects/{project}/locations/{region}/services/{service}` - * - * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setService($var) - { - GPBUtil::checkString($var, True); - $this->service = $var; - - return $this; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - * @return int - */ - public function getTimeoutSeconds() - { - return $this->timeout_seconds; - } - - /** - * The function execution timeout. Execution is considered failed and - * can be terminated if the function is not completed at the end of the - * timeout period. Defaults to 60 seconds. - * - * Generated from protobuf field int32 timeout_seconds = 2; - * @param int $var - * @return $this - */ - public function setTimeoutSeconds($var) - { - GPBUtil::checkInt32($var); - $this->timeout_seconds = $var; - - return $this; - } - - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - * @return string - */ - public function getAvailableMemory() - { - return $this->available_memory; - } - - /** - * The amount of memory available for a function. - * Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is - * supplied the value is interpreted as bytes. - * See - * https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go - * a full description. - * - * Generated from protobuf field string available_memory = 13; - * @param string $var - * @return $this - */ - public function setAvailableMemory($var) - { - GPBUtil::checkString($var, True); - $this->available_memory = $var; - - return $this; - } - - /** - * The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - * @return string - */ - public function getAvailableCpu() - { - return $this->available_cpu; - } - - /** - * The number of CPUs used in a single container instance. - * Default value is calculated from available memory. - * Supports the same values as Cloud Run, see - * https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements - * Example: "1" indicates 1 vCPU - * - * Generated from protobuf field string available_cpu = 22; - * @param string $var - * @return $this - */ - public function setAvailableCpu($var) - { - GPBUtil::checkString($var, True); - $this->available_cpu = $var; - - return $this; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - * @return \Google\Protobuf\Internal\MapField - */ - public function getEnvironmentVariables() - { - return $this->environment_variables; - } - - /** - * Environment variables that shall be available during function execution. - * - * Generated from protobuf field map environment_variables = 4; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setEnvironmentVariables($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->environment_variables = $arr; - - return $this; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - * @return int - */ - public function getMaxInstanceCount() - { - return $this->max_instance_count; - } - - /** - * The limit on the maximum number of function instances that may coexist at a - * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max - * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances - * value than your function can tolerate. - * See the [Max - * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for - * more details. - * - * Generated from protobuf field int32 max_instance_count = 5; - * @param int $var - * @return $this - */ - public function setMaxInstanceCount($var) - { - GPBUtil::checkInt32($var); - $this->max_instance_count = $var; - - return $this; - } - - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - * @return int - */ - public function getMinInstanceCount() - { - return $this->min_instance_count; - } - - /** - * The limit on the minimum number of function instances that may coexist at a - * given time. - * Function instances are kept in idle state for a short period after they - * finished executing the request to reduce cold start time for subsequent - * requests. Setting a minimum instance count will ensure that the given - * number of instances are kept running in idle state always. This can help - * with cold start times when jump in incoming request count occurs after the - * idle instance would have been stopped in the default case. - * - * Generated from protobuf field int32 min_instance_count = 12; - * @param int $var - * @return $this - */ - public function setMinInstanceCount($var) - { - GPBUtil::checkInt32($var); - $this->min_instance_count = $var; - - return $this; - } - - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - * @return string - */ - public function getVpcConnector() - { - return $this->vpc_connector; - } - - /** - * The Serverless VPC Access connector that this cloud function can connect - * to. The format of this field is `projects/*/locations/*/connectors/*`. - * - * Generated from protobuf field string vpc_connector = 6 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setVpcConnector($var) - { - GPBUtil::checkString($var, True); - $this->vpc_connector = $var; - - return $this; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - * @return int - */ - public function getVpcConnectorEgressSettings() - { - return $this->vpc_connector_egress_settings; - } - - /** - * The egress settings for the connector, controlling what traffic is diverted - * through it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings vpc_connector_egress_settings = 7; - * @param int $var - * @return $this - */ - public function setVpcConnectorEgressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\VpcConnectorEgressSettings::class); - $this->vpc_connector_egress_settings = $var; - - return $this; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - * @return int - */ - public function getIngressSettings() - { - return $this->ingress_settings; - } - - /** - * The ingress settings for the function, controlling what traffic can reach - * it. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.IngressSettings ingress_settings = 8; - * @param int $var - * @return $this - */ - public function setIngressSettings($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\IngressSettings::class); - $this->ingress_settings = $var; - - return $this; - } - - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * Output only. URI of the Service deployed. - * - * Generated from protobuf field string uri = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUri($var) - { - GPBUtil::checkString($var, True); - $this->uri = $var; - - return $this; - } - - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * The email of the service's service account. If empty, defaults to - * `{project_number}-compute@developer.gserviceaccount.com`. - * - * Generated from protobuf field string service_account_email = 10; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - * @return bool - */ - public function getAllTrafficOnLatestRevision() - { - return $this->all_traffic_on_latest_revision; - } - - /** - * Whether 100% of traffic is routed to the latest revision. - * On CreateFunction and UpdateFunction, when set to true, the revision being - * deployed will serve 100% of traffic, ignoring any traffic split settings, - * if any. On GetFunction, true will be returned if the latest revision is - * serving 100% of traffic. - * - * Generated from protobuf field bool all_traffic_on_latest_revision = 16; - * @param bool $var - * @return $this - */ - public function setAllTrafficOnLatestRevision($var) - { - GPBUtil::checkBool($var); - $this->all_traffic_on_latest_revision = $var; - - return $this; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretEnvironmentVariables() - { - return $this->secret_environment_variables; - } - - /** - * Secret environment variables configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretEnvVar secret_environment_variables = 17; - * @param array<\Google\Cloud\Functions\V2\SecretEnvVar>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretEnvironmentVariables($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretEnvVar::class); - $this->secret_environment_variables = $arr; - - return $this; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSecretVolumes() - { - return $this->secret_volumes; - } - - /** - * Secret volumes configuration. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.SecretVolume secret_volumes = 19; - * @param array<\Google\Cloud\Functions\V2\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSecretVolumes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\SecretVolume::class); - $this->secret_volumes = $arr; - - return $this; - } - - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRevision() - { - return $this->revision; - } - - /** - * Output only. The name of service revision. - * - * Generated from protobuf field string revision = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRevision($var) - { - GPBUtil::checkString($var, True); - $this->revision = $var; - - return $this; - } - - /** - * Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - * @return int - */ - public function getMaxInstanceRequestConcurrency() - { - return $this->max_instance_request_concurrency; - } - - /** - * Sets the maximum number of concurrent requests that each instance - * can receive. Defaults to 1. - * - * Generated from protobuf field int32 max_instance_request_concurrency = 20; - * @param int $var - * @return $this - */ - public function setMaxInstanceRequestConcurrency($var) - { - GPBUtil::checkInt32($var); - $this->max_instance_request_concurrency = $var; - - return $this; - } - - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - * @return int - */ - public function getSecurityLevel() - { - return $this->security_level; - } - - /** - * Security level configure whether the function only accepts https. - * This configuration is only applicable to 1st Gen functions with Http - * trigger. By default https is optional for 1st Gen functions; 2nd Gen - * functions are https ONLY. - * - * Generated from protobuf field .google.cloud.functions.v2.ServiceConfig.SecurityLevel security_level = 21; - * @param int $var - * @return $this - */ - public function setSecurityLevel($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\ServiceConfig\SecurityLevel::class); - $this->security_level = $var; - - return $this; - } - - /** - * Optional. The binary authorization policy to be checked when deploying the - * Cloud Run service. - * - * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getBinaryAuthorizationPolicy() - { - return $this->binary_authorization_policy; - } - - /** - * Optional. The binary authorization policy to be checked when deploying the - * Cloud Run service. - * - * Generated from protobuf field string binary_authorization_policy = 23 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setBinaryAuthorizationPolicy($var) - { - GPBUtil::checkString($var, True); - $this->binary_authorization_policy = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php deleted file mode 100644 index 0dfd22d07834..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/IngressSettings.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.IngressSettings - */ -class IngressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum INGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const INGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Allow HTTP traffic from public and private sources. - * - * Generated from protobuf enum ALLOW_ALL = 1; - */ - const ALLOW_ALL = 1; - /** - * Allow HTTP traffic from only private VPC sources. - * - * Generated from protobuf enum ALLOW_INTERNAL_ONLY = 2; - */ - const ALLOW_INTERNAL_ONLY = 2; - /** - * Allow HTTP traffic from private VPC sources and through GCLB. - * - * Generated from protobuf enum ALLOW_INTERNAL_AND_GCLB = 3; - */ - const ALLOW_INTERNAL_AND_GCLB = 3; - - private static $valueToName = [ - self::INGRESS_SETTINGS_UNSPECIFIED => 'INGRESS_SETTINGS_UNSPECIFIED', - self::ALLOW_ALL => 'ALLOW_ALL', - self::ALLOW_INTERNAL_ONLY => 'ALLOW_INTERNAL_ONLY', - self::ALLOW_INTERNAL_AND_GCLB => 'ALLOW_INTERNAL_AND_GCLB', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IngressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_IngressSettings::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php deleted file mode 100644 index 5fb4b8b79894..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/SecurityLevel.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.SecurityLevel - */ -class SecurityLevel -{ - /** - * Unspecified. - * - * Generated from protobuf enum SECURITY_LEVEL_UNSPECIFIED = 0; - */ - const SECURITY_LEVEL_UNSPECIFIED = 0; - /** - * Requests for a URL that match this handler that do not use HTTPS are - * automatically redirected to the HTTPS URL with the same path. Query - * parameters are reserved for the redirect. - * - * Generated from protobuf enum SECURE_ALWAYS = 1; - */ - const SECURE_ALWAYS = 1; - /** - * Both HTTP and HTTPS requests with URLs that match the handler succeed - * without redirects. The application can examine the request to determine - * which protocol was used and respond accordingly. - * - * Generated from protobuf enum SECURE_OPTIONAL = 2; - */ - const SECURE_OPTIONAL = 2; - - private static $valueToName = [ - self::SECURITY_LEVEL_UNSPECIFIED => 'SECURITY_LEVEL_UNSPECIFIED', - self::SECURE_ALWAYS => 'SECURE_ALWAYS', - self::SECURE_OPTIONAL => 'SECURE_OPTIONAL', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SecurityLevel::class, \Google\Cloud\Functions\V2\ServiceConfig_SecurityLevel::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php deleted file mode 100644 index 77a3f98e3ae3..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/ServiceConfig/VpcConnectorEgressSettings.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings - */ -class VpcConnectorEgressSettings -{ - /** - * Unspecified. - * - * Generated from protobuf enum VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - */ - const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; - /** - * Use the VPC Access Connector only for private IP space from RFC1918. - * - * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; - */ - const PRIVATE_RANGES_ONLY = 1; - /** - * Force the use of VPC Access Connector for all egress traffic from the - * function. - * - * Generated from protobuf enum ALL_TRAFFIC = 2; - */ - const ALL_TRAFFIC = 2; - - private static $valueToName = [ - self::VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED => 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED', - self::PRIVATE_RANGES_ONLY => 'PRIVATE_RANGES_ONLY', - self::ALL_TRAFFIC => 'ALL_TRAFFIC', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(VpcConnectorEgressSettings::class, \Google\Cloud\Functions\V2\ServiceConfig_VpcConnectorEgressSettings::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php deleted file mode 100644 index b16cd2dea16e..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Source.php +++ /dev/null @@ -1,150 +0,0 @@ -google.cloud.functions.v2.Source - */ -class Source extends \Google\Protobuf\Internal\Message -{ - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\StorageSource $storage_source - * If provided, get the source from this location in Google Cloud Storage. - * @type \Google\Cloud\Functions\V2\RepoSource $repo_source - * If provided, get the source from this location in a Cloud Source - * Repository. - * @type string $git_uri - * If provided, get the source from GitHub repository. This option is valid - * only for GCF 1st Gen function. - * Example: https://github.com///blob// - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * If provided, get the source from this location in Google Cloud Storage. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getStorageSource() - { - return $this->readOneof(1); - } - - public function hasStorageSource() - { - return $this->hasOneof(1); - } - - /** - * If provided, get the source from this location in Google Cloud Storage. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource storage_source = 1; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * If provided, get the source from this location in a Cloud Source - * Repository. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; - * @return \Google\Cloud\Functions\V2\RepoSource|null - */ - public function getRepoSource() - { - return $this->readOneof(2); - } - - public function hasRepoSource() - { - return $this->hasOneof(2); - } - - /** - * If provided, get the source from this location in a Cloud Source - * Repository. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource repo_source = 2; - * @param \Google\Cloud\Functions\V2\RepoSource $var - * @return $this - */ - public function setRepoSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * If provided, get the source from GitHub repository. This option is valid - * only for GCF 1st Gen function. - * Example: https://github.com///blob// - * - * Generated from protobuf field string git_uri = 3; - * @return string - */ - public function getGitUri() - { - return $this->readOneof(3); - } - - public function hasGitUri() - { - return $this->hasOneof(3); - } - - /** - * If provided, get the source from GitHub repository. This option is valid - * only for GCF 1st Gen function. - * Example: https://github.com///blob// - * - * Generated from protobuf field string git_uri = 3; - * @param string $var - * @return $this - */ - public function setGitUri($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php deleted file mode 100644 index 0b1954543663..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/SourceProvenance.php +++ /dev/null @@ -1,168 +0,0 @@ -google.cloud.functions.v2.SourceProvenance - */ -class SourceProvenance extends \Google\Protobuf\Internal\Message -{ - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - */ - protected $resolved_storage_source = null; - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - */ - protected $resolved_repo_source = null; - /** - * A copy of the build's `source.git_uri`, if exists, with any commits - * resolved. - * - * Generated from protobuf field string git_uri = 3; - */ - protected $git_uri = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\StorageSource $resolved_storage_source - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * @type \Google\Cloud\Functions\V2\RepoSource $resolved_repo_source - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * @type string $git_uri - * A copy of the build's `source.git_uri`, if exists, with any commits - * resolved. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - * @return \Google\Cloud\Functions\V2\StorageSource|null - */ - public function getResolvedStorageSource() - { - return $this->resolved_storage_source; - } - - public function hasResolvedStorageSource() - { - return isset($this->resolved_storage_source); - } - - public function clearResolvedStorageSource() - { - unset($this->resolved_storage_source); - } - - /** - * A copy of the build's `source.storage_source`, if exists, with any - * generations resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.StorageSource resolved_storage_source = 1; - * @param \Google\Cloud\Functions\V2\StorageSource $var - * @return $this - */ - public function setResolvedStorageSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class); - $this->resolved_storage_source = $var; - - return $this; - } - - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - * @return \Google\Cloud\Functions\V2\RepoSource|null - */ - public function getResolvedRepoSource() - { - return $this->resolved_repo_source; - } - - public function hasResolvedRepoSource() - { - return isset($this->resolved_repo_source); - } - - public function clearResolvedRepoSource() - { - unset($this->resolved_repo_source); - } - - /** - * A copy of the build's `source.repo_source`, if exists, with any - * revisions resolved. - * - * Generated from protobuf field .google.cloud.functions.v2.RepoSource resolved_repo_source = 2; - * @param \Google\Cloud\Functions\V2\RepoSource $var - * @return $this - */ - public function setResolvedRepoSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class); - $this->resolved_repo_source = $var; - - return $this; - } - - /** - * A copy of the build's `source.git_uri`, if exists, with any commits - * resolved. - * - * Generated from protobuf field string git_uri = 3; - * @return string - */ - public function getGitUri() - { - return $this->git_uri; - } - - /** - * A copy of the build's `source.git_uri`, if exists, with any commits - * resolved. - * - * Generated from protobuf field string git_uri = 3; - * @param string $var - * @return $this - */ - public function setGitUri($var) - { - GPBUtil::checkString($var, True); - $this->git_uri = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php deleted file mode 100644 index e965c5a3023b..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage.php +++ /dev/null @@ -1,237 +0,0 @@ -google.cloud.functions.v2.Stage - */ -class Stage extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - */ - protected $name = 0; - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - */ - protected $message = ''; - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - */ - protected $state = 0; - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - */ - protected $resource = ''; - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - */ - protected $resource_uri = ''; - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - */ - private $state_messages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $name - * Name of the Stage. This will be unique for each Stage. - * @type string $message - * Message describing the Stage - * @type int $state - * Current state of the Stage - * @type string $resource - * Resource of the Stage - * @type string $resource_uri - * Link to the current Stage resource - * @type array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $state_messages - * State messages from the current Stage. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - * @return int - */ - public function getName() - { - return $this->name; - } - - /** - * Name of the Stage. This will be unique for each Stage. - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.Name name = 1; - * @param int $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\Name::class); - $this->name = $var; - - return $this; - } - - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * Message describing the Stage - * - * Generated from protobuf field string message = 2; - * @param string $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkString($var, True); - $this->message = $var; - - return $this; - } - - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Current state of the Stage - * - * Generated from protobuf field .google.cloud.functions.v2.Stage.State state = 3; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\Stage\State::class); - $this->state = $var; - - return $this; - } - - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - * @return string - */ - public function getResource() - { - return $this->resource; - } - - /** - * Resource of the Stage - * - * Generated from protobuf field string resource = 4; - * @param string $var - * @return $this - */ - public function setResource($var) - { - GPBUtil::checkString($var, True); - $this->resource = $var; - - return $this; - } - - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - * @return string - */ - public function getResourceUri() - { - return $this->resource_uri; - } - - /** - * Link to the current Stage resource - * - * Generated from protobuf field string resource_uri = 5; - * @param string $var - * @return $this - */ - public function setResourceUri($var) - { - GPBUtil::checkString($var, True); - $this->resource_uri = $var; - - return $this; - } - - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStateMessages() - { - return $this->state_messages; - } - - /** - * State messages from the current Stage. - * - * Generated from protobuf field repeated .google.cloud.functions.v2.StateMessage state_messages = 6; - * @param array<\Google\Cloud\Functions\V2\StateMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStateMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Functions\V2\StateMessage::class); - $this->state_messages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php deleted file mode 100644 index 6dbaa6f06046..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/Name.php +++ /dev/null @@ -1,92 +0,0 @@ -google.cloud.functions.v2.Stage.Name - */ -class Name -{ - /** - * Not specified. Invalid name. - * - * Generated from protobuf enum NAME_UNSPECIFIED = 0; - */ - const NAME_UNSPECIFIED = 0; - /** - * Artifact Regsitry Stage - * - * Generated from protobuf enum ARTIFACT_REGISTRY = 1; - */ - const ARTIFACT_REGISTRY = 1; - /** - * Build Stage - * - * Generated from protobuf enum BUILD = 2; - */ - const BUILD = 2; - /** - * Service Stage - * - * Generated from protobuf enum SERVICE = 3; - */ - const SERVICE = 3; - /** - * Trigger Stage - * - * Generated from protobuf enum TRIGGER = 4; - */ - const TRIGGER = 4; - /** - * Service Rollback Stage - * - * Generated from protobuf enum SERVICE_ROLLBACK = 5; - */ - const SERVICE_ROLLBACK = 5; - /** - * Trigger Rollback Stage - * - * Generated from protobuf enum TRIGGER_ROLLBACK = 6; - */ - const TRIGGER_ROLLBACK = 6; - - private static $valueToName = [ - self::NAME_UNSPECIFIED => 'NAME_UNSPECIFIED', - self::ARTIFACT_REGISTRY => 'ARTIFACT_REGISTRY', - self::BUILD => 'BUILD', - self::SERVICE => 'SERVICE', - self::TRIGGER => 'TRIGGER', - self::SERVICE_ROLLBACK => 'SERVICE_ROLLBACK', - self::TRIGGER_ROLLBACK => 'TRIGGER_ROLLBACK', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Name::class, \Google\Cloud\Functions\V2\Stage_Name::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php deleted file mode 100644 index 5a0be65fc0dc..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/Stage/State.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.Stage.State - */ -class State -{ - /** - * Not specified. Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Stage has not started. - * - * Generated from protobuf enum NOT_STARTED = 1; - */ - const NOT_STARTED = 1; - /** - * Stage is in progress. - * - * Generated from protobuf enum IN_PROGRESS = 2; - */ - const IN_PROGRESS = 2; - /** - * Stage has completed. - * - * Generated from protobuf enum COMPLETE = 3; - */ - const COMPLETE = 3; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::NOT_STARTED => 'NOT_STARTED', - self::IN_PROGRESS => 'IN_PROGRESS', - self::COMPLETE => 'COMPLETE', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Functions\V2\Stage_State::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php deleted file mode 100644 index 9e318e5af10f..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.functions.v2.StateMessage - */ -class StateMessage extends \Google\Protobuf\Internal\Message -{ - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - */ - protected $severity = 0; - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - */ - protected $type = ''; - /** - * The message. - * - * Generated from protobuf field string message = 3; - */ - protected $message = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $severity - * Severity of the state message. - * @type string $type - * One-word CamelCase type of the state message. - * @type string $message - * The message. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - * @return int - */ - public function getSeverity() - { - return $this->severity; - } - - /** - * Severity of the state message. - * - * Generated from protobuf field .google.cloud.functions.v2.StateMessage.Severity severity = 1; - * @param int $var - * @return $this - */ - public function setSeverity($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Functions\V2\StateMessage\Severity::class); - $this->severity = $var; - - return $this; - } - - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * One-word CamelCase type of the state message. - * - * Generated from protobuf field string type = 2; - * @param string $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkString($var, True); - $this->type = $var; - - return $this; - } - - /** - * The message. - * - * Generated from protobuf field string message = 3; - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * The message. - * - * Generated from protobuf field string message = 3; - * @param string $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkString($var, True); - $this->message = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php deleted file mode 100644 index d201473a95e0..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StateMessage/Severity.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.functions.v2.StateMessage.Severity - */ -class Severity -{ - /** - * Not specified. Invalid severity. - * - * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; - */ - const SEVERITY_UNSPECIFIED = 0; - /** - * ERROR-level severity. - * - * Generated from protobuf enum ERROR = 1; - */ - const ERROR = 1; - /** - * WARNING-level severity. - * - * Generated from protobuf enum WARNING = 2; - */ - const WARNING = 2; - /** - * INFO-level severity. - * - * Generated from protobuf enum INFO = 3; - */ - const INFO = 3; - - private static $valueToName = [ - self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', - self::ERROR => 'ERROR', - self::WARNING => 'WARNING', - self::INFO => 'INFO', - ]; - - 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); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Severity::class, \Google\Cloud\Functions\V2\StateMessage_Severity::class); - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php deleted file mode 100644 index ddeebbd71e96..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/StorageSource.php +++ /dev/null @@ -1,197 +0,0 @@ -google.cloud.functions.v2.StorageSource - */ -class StorageSource extends \Google\Protobuf\Internal\Message -{ - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - */ - protected $bucket = ''; - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - */ - protected $object = ''; - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - */ - protected $generation = 0; - /** - * When the specified storage bucket is a 1st gen function uploard url bucket, - * this field should be set as the generated upload url for 1st gen - * deployment. - * - * Generated from protobuf field string source_upload_url = 4; - */ - protected $source_upload_url = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $bucket - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * @type string $object - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * @type int|string $generation - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * @type string $source_upload_url - * When the specified storage bucket is a 1st gen function uploard url bucket, - * this field should be set as the generated upload url for 1st gen - * deployment. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - * @return string - */ - public function getBucket() - { - return $this->bucket; - } - - /** - * Google Cloud Storage bucket containing the source (see - * [Bucket Name - * Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - * - * Generated from protobuf field string bucket = 1; - * @param string $var - * @return $this - */ - public function setBucket($var) - { - GPBUtil::checkString($var, True); - $this->bucket = $var; - - return $this; - } - - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - * @return string - */ - public function getObject() - { - return $this->object; - } - - /** - * Google Cloud Storage object containing the source. - * This object must be a gzipped archive file (`.tar.gz`) containing source to - * build. - * - * Generated from protobuf field string object = 2; - * @param string $var - * @return $this - */ - public function setObject($var) - { - GPBUtil::checkString($var, True); - $this->object = $var; - - return $this; - } - - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - * @return int|string - */ - public function getGeneration() - { - return $this->generation; - } - - /** - * Google Cloud Storage generation for the object. If the generation is - * omitted, the latest generation will be used. - * - * Generated from protobuf field int64 generation = 3; - * @param int|string $var - * @return $this - */ - public function setGeneration($var) - { - GPBUtil::checkInt64($var); - $this->generation = $var; - - return $this; - } - - /** - * When the specified storage bucket is a 1st gen function uploard url bucket, - * this field should be set as the generated upload url for 1st gen - * deployment. - * - * Generated from protobuf field string source_upload_url = 4; - * @return string - */ - public function getSourceUploadUrl() - { - return $this->source_upload_url; - } - - /** - * When the specified storage bucket is a 1st gen function uploard url bucket, - * this field should be set as the generated upload url for 1st gen - * deployment. - * - * Generated from protobuf field string source_upload_url = 4; - * @param string $var - * @return $this - */ - public function setSourceUploadUrl($var) - { - GPBUtil::checkString($var, True); - $this->source_upload_url = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php b/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php deleted file mode 100644 index 3834e2723d6e..000000000000 --- a/owl-bot-staging/Functions/v2/proto/src/Google/Cloud/Functions/V2/UpdateFunctionRequest.php +++ /dev/null @@ -1,141 +0,0 @@ -google.cloud.functions.v2.UpdateFunctionRequest - */ -class UpdateFunctionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $function = null; - /** - * The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\Functions\V2\PBFunction $function Required. New version of the function. - * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * - * @return \Google\Cloud\Functions\V2\UpdateFunctionRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Functions\V2\PBFunction $function, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setFunction($function) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Functions\V2\PBFunction $function - * Required. New version of the function. - * @type \Google\Protobuf\FieldMask $update_mask - * The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce(); - parent::__construct($data); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Functions\V2\PBFunction|null - */ - public function getFunction() - { - return $this->function; - } - - public function hasFunction() - { - return isset($this->function); - } - - public function clearFunction() - { - unset($this->function); - } - - /** - * Required. New version of the function. - * - * Generated from protobuf field .google.cloud.functions.v2.Function function = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Functions\V2\PBFunction $var - * @return $this - */ - public function setFunction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\PBFunction::class); - $this->function = $var; - - return $this; - } - - /** - * The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @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); - } - - /** - * The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php deleted file mode 100644 index 9973077ba5d3..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/create_function.php +++ /dev/null @@ -1,88 +0,0 @@ -setParent($formattedParent) - ->setFunction($function); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->createFunction($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - create_function_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_CreateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php deleted file mode 100644 index d4b706eed552..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/delete_function.php +++ /dev/null @@ -1,82 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->deleteFunction($request); - $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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - delete_function_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php deleted file mode 100644 index 8c67ca295d6e..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_download_url.php +++ /dev/null @@ -1,76 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var GenerateDownloadUrlResponse $response */ - $response = $functionServiceClient->generateDownloadUrl($request); - 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - generate_download_url_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php deleted file mode 100644 index 450230528989..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/generate_upload_url.php +++ /dev/null @@ -1,94 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var GenerateUploadUrlResponse $response */ - $response = $functionServiceClient->generateUploadUrl($request); - 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 -{ - $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - generate_upload_url_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php deleted file mode 100644 index eee78f27db80..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_function.php +++ /dev/null @@ -1,71 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var PBFunction $response */ - $response = $functionServiceClient->getFunction($request); - 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 = FunctionServiceClient::functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - - get_function_sample($formattedName); -} -// [END cloudfunctions_v2_generated_FunctionService_GetFunction_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php deleted file mode 100644 index 6a84bd75b393..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/get_iam_policy.php +++ /dev/null @@ -1,72 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $functionServiceClient->getIamPolicy($request); - 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 cloudfunctions_v2_generated_FunctionService_GetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php deleted file mode 100644 index 2211ba2247b3..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_functions.php +++ /dev/null @@ -1,81 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $functionServiceClient->listFunctions($request); - - /** @var PBFunction $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 = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - list_functions_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_ListFunctions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php deleted file mode 100644 index 287d79cf8c32..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_locations.php +++ /dev/null @@ -1,62 +0,0 @@ -listLocations($request); - - /** @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 cloudfunctions_v2_generated_FunctionService_ListLocations_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php deleted file mode 100644 index aca8dd8c813e..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/list_runtimes.php +++ /dev/null @@ -1,72 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var ListRuntimesResponse $response */ - $response = $functionServiceClient->listRuntimes($request); - 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 -{ - $formattedParent = FunctionServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - list_runtimes_sample($formattedParent); -} -// [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php deleted file mode 100644 index 97295556fbfc..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $functionServiceClient->setIamPolicy($request); - 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 cloudfunctions_v2_generated_FunctionService_SetIamPolicy_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php deleted file mode 100644 index 93d2ca86cb79..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/test_iam_permissions.php +++ /dev/null @@ -1,84 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $functionServiceClient->testIamPermissions($request); - 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 cloudfunctions_v2_generated_FunctionService_TestIamPermissions_sync] diff --git a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php b/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php deleted file mode 100644 index 600989041e80..000000000000 --- a/owl-bot-staging/Functions/v2/samples/V2/FunctionServiceClient/update_function.php +++ /dev/null @@ -1,71 +0,0 @@ -setFunction($function); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $functionServiceClient->updateFunction($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var PBFunction $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()); - } -} -// [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_sync] diff --git a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php deleted file mode 100644 index 4c68a6e338d2..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/Client/FunctionServiceClient.php +++ /dev/null @@ -1,832 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/function_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * 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; - } - - /** - * Formats a string containing the fully-qualified path to represent a build - * resource. - * - * @param string $project - * @param string $location - * @param string $build - * - * @return string The formatted build resource. - */ - public static function buildName(string $project, string $location, string $build): string - { - return self::getPathTemplate('build')->render([ - 'project' => $project, - 'location' => $location, - 'build' => $build, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a channel - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * - * @return string The formatted channel resource. - */ - public static function channelName(string $project, string $location, string $channel): string - { - return self::getPathTemplate('channel')->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName(string $project, string $location, string $connector): string - { - return self::getPathTemplate('connector')->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string - { - return self::getPathTemplate('cryptoKey')->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a function - * resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted function resource. - */ - public static function functionName(string $project, string $location, string $function): string - { - return self::getPathTemplate('function')->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * 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(string $project, string $location): string - { - return self::getPathTemplate('location')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName(string $project, string $location, string $repository): string - { - return self::getPathTemplate('repository')->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName(string $project, string $location, string $service): string - { - return self::getPathTemplate('service')->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName(string $project, string $topic): string - { - return self::getPathTemplate('topic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trigger - * resource. - * - * @param string $project - * @param string $location - * @param string $trigger - * - * @return string The formatted trigger resource. - */ - public static function triggerName(string $project, string $location, string $trigger): string - { - return self::getPathTemplate('trigger')->render([ - 'project' => $project, - 'location' => $location, - 'trigger' => $trigger, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a worker_pool - * resource. - * - * @param string $project - * @param string $location - * @param string $workerPool - * - * @return string The formatted worker_pool resource. - */ - public static function workerPoolName(string $project, string $location, string $workerPool): string - { - return self::getPathTemplate('workerPool')->render([ - 'project' => $project, - 'location' => $location, - 'worker_pool' => $workerPool, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - build: projects/{project}/locations/{location}/builds/{build} - * - channel: projects/{project}/locations/{location}/channels/{channel} - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - function: projects/{project}/locations/{location}/functions/{function} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - service: projects/{project}/locations/{location}/services/{service} - * - topic: projects/{project}/topics/{topic} - * - trigger: projects/{project}/locations/{location}/triggers/{trigger} - * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * 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 'cloudfunctions.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); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * The async variant is {@see FunctionServiceClient::createFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/create_function.php - * - * @param CreateFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createFunction(CreateFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateFunction', $request, $callOptions)->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * The async variant is {@see FunctionServiceClient::deleteFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/delete_function.php - * - * @param DeleteFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteFunction(DeleteFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteFunction', $request, $callOptions)->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * The async variant is {@see FunctionServiceClient::generateDownloadUrlAsync()} . - * - * @example samples/V2/FunctionServiceClient/generate_download_url.php - * - * @param GenerateDownloadUrlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return GenerateDownloadUrlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $callOptions = []): GenerateDownloadUrlResponse - { - return $this->startApiCall('GenerateDownloadUrl', $request, $callOptions)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, specify this header: - * - * * `content-type: application/zip` - * - * Do not specify this header: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * The async variant is {@see FunctionServiceClient::generateUploadUrlAsync()} . - * - * @example samples/V2/FunctionServiceClient/generate_upload_url.php - * - * @param GenerateUploadUrlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return GenerateUploadUrlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function generateUploadUrl(GenerateUploadUrlRequest $request, array $callOptions = []): GenerateUploadUrlResponse - { - return $this->startApiCall('GenerateUploadUrl', $request, $callOptions)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * The async variant is {@see FunctionServiceClient::getFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/get_function.php - * - * @param GetFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PBFunction - * - * @throws ApiException Thrown if the API call fails. - */ - public function getFunction(GetFunctionRequest $request, array $callOptions = []): PBFunction - { - return $this->startApiCall('GetFunction', $request, $callOptions)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * The async variant is {@see FunctionServiceClient::listFunctionsAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_functions.php - * - * @param ListFunctionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listFunctions(ListFunctionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListFunctions', $request, $callOptions); - } - - /** - * Returns a list of runtimes that are supported for the requested project. - * - * The async variant is {@see FunctionServiceClient::listRuntimesAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_runtimes.php - * - * @param ListRuntimesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ListRuntimesResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listRuntimes(ListRuntimesRequest $request, array $callOptions = []): ListRuntimesResponse - { - return $this->startApiCall('ListRuntimes', $request, $callOptions)->wait(); - } - - /** - * Updates existing function. - * - * The async variant is {@see FunctionServiceClient::updateFunctionAsync()} . - * - * @example samples/V2/FunctionServiceClient/update_function.php - * - * @param UpdateFunctionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateFunction(UpdateFunctionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateFunction', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see FunctionServiceClient::listLocationsAsync()} . - * - * @example samples/V2/FunctionServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see FunctionServiceClient::getIamPolicyAsync()} . - * - * @example samples/V2/FunctionServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see FunctionServiceClient::setIamPolicyAsync()} . - * - * @example samples/V2/FunctionServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->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. - * - * The async variant is {@see FunctionServiceClient::testIamPermissionsAsync()} . - * - * @example samples/V2/FunctionServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php b/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php deleted file mode 100644 index 8b0aa3f05d5e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/FunctionServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); - * $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 = $functionServiceClient->createFunction($formattedParent, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Functions\V2\Client\FunctionServiceClient}. - */ -class FunctionServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.functions.v2.FunctionService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'cloudfunctions.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'cloudfunctions.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 $buildNameTemplate; - - private static $channelNameTemplate; - - private static $connectorNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $functionNameTemplate; - - private static $locationNameTemplate; - - private static $repositoryNameTemplate; - - private static $serviceNameTemplate; - - private static $topicNameTemplate; - - private static $triggerNameTemplate; - - private static $workerPoolNameTemplate; - - 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/function_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/function_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/function_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/function_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getBuildNameTemplate() - { - if (self::$buildNameTemplate == null) { - self::$buildNameTemplate = new PathTemplate('projects/{project}/locations/{location}/builds/{build}'); - } - - return self::$buildNameTemplate; - } - - private static function getChannelNameTemplate() - { - if (self::$channelNameTemplate == null) { - self::$channelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}'); - } - - return self::$channelNameTemplate; - } - - private static function getConnectorNameTemplate() - { - if (self::$connectorNameTemplate == null) { - self::$connectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/connectors/{connector}'); - } - - return self::$connectorNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getFunctionNameTemplate() - { - if (self::$functionNameTemplate == null) { - self::$functionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); - } - - return self::$functionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getRepositoryNameTemplate() - { - if (self::$repositoryNameTemplate == null) { - self::$repositoryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/repositories/{repository}'); - } - - return self::$repositoryNameTemplate; - } - - private static function getServiceNameTemplate() - { - if (self::$serviceNameTemplate == null) { - self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/services/{service}'); - } - - return self::$serviceNameTemplate; - } - - private static function getTopicNameTemplate() - { - if (self::$topicNameTemplate == null) { - self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$topicNameTemplate; - } - - private static function getTriggerNameTemplate() - { - if (self::$triggerNameTemplate == null) { - self::$triggerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/triggers/{trigger}'); - } - - return self::$triggerNameTemplate; - } - - private static function getWorkerPoolNameTemplate() - { - if (self::$workerPoolNameTemplate == null) { - self::$workerPoolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workerPools/{worker_pool}'); - } - - return self::$workerPoolNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'build' => self::getBuildNameTemplate(), - 'channel' => self::getChannelNameTemplate(), - 'connector' => self::getConnectorNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'function' => self::getFunctionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'repository' => self::getRepositoryNameTemplate(), - 'service' => self::getServiceNameTemplate(), - 'topic' => self::getTopicNameTemplate(), - 'trigger' => self::getTriggerNameTemplate(), - 'workerPool' => self::getWorkerPoolNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a build - * resource. - * - * @param string $project - * @param string $location - * @param string $build - * - * @return string The formatted build resource. - */ - public static function buildName($project, $location, $build) - { - return self::getBuildNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'build' => $build, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a channel - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * - * @return string The formatted channel resource. - */ - public static function channelName($project, $location, $channel) - { - return self::getChannelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName($project, $location, $connector) - { - return self::getConnectorNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) - { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a function - * resource. - * - * @param string $project - * @param string $location - * @param string $function - * - * @return string The formatted function resource. - */ - public static function functionName($project, $location, $function) - { - return self::getFunctionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'function' => $function, - ]); - } - - /** - * 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 repository - * resource. - * - * @param string $project - * @param string $location - * @param string $repository - * - * @return string The formatted repository resource. - */ - public static function repositoryName($project, $location, $repository) - { - return self::getRepositoryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'repository' => $repository, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName($project, $location, $service) - { - return self::getServiceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName($project, $topic) - { - return self::getTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trigger - * resource. - * - * @param string $project - * @param string $location - * @param string $trigger - * - * @return string The formatted trigger resource. - */ - public static function triggerName($project, $location, $trigger) - { - return self::getTriggerNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'trigger' => $trigger, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a worker_pool - * resource. - * - * @param string $project - * @param string $location - * @param string $workerPool - * - * @return string The formatted worker_pool resource. - */ - public static function workerPoolName($project, $location, $workerPool) - { - return self::getWorkerPoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'worker_pool' => $workerPool, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - build: projects/{project}/locations/{location}/builds/{build} - * - channel: projects/{project}/locations/{location}/channels/{channel} - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - function: projects/{project}/locations/{location}/functions/{function} - * - location: projects/{project}/locations/{location} - * - repository: projects/{project}/locations/{location}/repositories/{repository} - * - service: projects/{project}/locations/{location}/services/{service} - * - topic: projects/{project}/topics/{topic} - * - trigger: projects/{project}/locations/{location}/triggers/{trigger} - * - workerPool: projects/{project}/locations/{location}/workerPools/{worker_pool} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'cloudfunctions.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 function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->createFunction($formattedParent, $function); - * $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 = $functionServiceClient->createFunction($formattedParent, $function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'createFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the function should be created, - * specified in the format `projects/*/locations/*` - * @param PBFunction $function Required. Function to be created. - * @param array $optionalArgs { - * Optional. - * - * @type string $functionId - * The ID to use for the function, which will become the final component of - * the function's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFunction($parent, $function, array $optionalArgs = []) - { - $request = new CreateFunctionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFunction($function); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['functionId'])) { - $request->setFunctionId($optionalArgs['functionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $operationResponse = $functionServiceClient->deleteFunction($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 = $functionServiceClient->deleteFunction($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'deleteFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which should be deleted. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFunction($name, array $optionalArgs = []) - { - $request = new DeleteFunctionRequest(); - $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('DeleteFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * 30 minutes of generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $functionServiceClient->generateDownloadUrl($formattedName); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of function for which source code Google Cloud Storage - * signed URL should be generated. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\GenerateDownloadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateDownloadUrl($name, array $optionalArgs = []) - { - $request = new GenerateDownloadUrlRequest(); - $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('GenerateDownloadUrl', GenerateDownloadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, specify this header: - * - * * `content-type: application/zip` - * - * Do not specify this header: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $functionServiceClient->generateUploadUrl($formattedParent); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the Google Cloud Storage signed - * URL should be generated, specified in the format `projects/*/locations/*`. - * @param array $optionalArgs { - * Optional. - * - * @type string $kmsKeyName - * [Preview] Resource name of a KMS crypto key (managed by the user) used to - * encrypt/decrypt function source code objects in intermediate Cloud Storage - * buckets. When you generate an upload url and upload your source code, it - * gets copied to an intermediate Cloud Storage bucket. The source code is - * then copied to a versioned directory in the sources bucket in the consumer - * project during the function deployment. - * - * It must match the pattern - * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - * - * The Google Cloud Functions service account - * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be - * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter - * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the - * Key/KeyRing/Project/Organization (least access preferred). - * @type int $environment - * The function environment the generated upload url will be used for. - * The upload url for 2nd Gen functions can also be used for 1st gen - * functions, but not vice versa. If not specified, 2nd generation-style - * upload URLs are generated. - * For allowed values, use constants defined on {@see \Google\Cloud\Functions\V2\Environment} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\GenerateUploadUrlResponse - * - * @throws ApiException if the remote call fails - */ - public function generateUploadUrl($parent, array $optionalArgs = []) - { - $request = new GenerateUploadUrlRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['kmsKeyName'])) { - $request->setKmsKeyName($optionalArgs['kmsKeyName']); - } - - if (isset($optionalArgs['environment'])) { - $request->setEnvironment($optionalArgs['environment']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GenerateUploadUrl', GenerateUploadUrlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a function with the given name from the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedName = $functionServiceClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - * $response = $functionServiceClient->getFunction($formattedName); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the function which details should be obtained. - * @param array $optionalArgs { - * Optional. - * - * @type string $revision - * Optional. The version of the 1st gen function whose details should - * be obtained. The version of a 1st gen function is an integer that starts - * from 1 and gets incremented on redeployments. GCF may keep historical - * configs for old versions of 1st gen function. This field can be specified - * to fetch the historical configs. This field is valid only for GCF 1st gen - * function. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\PBFunction - * - * @throws ApiException if the remote call fails - */ - public function getFunction($name, array $optionalArgs = []) - { - $request = new GetFunctionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['revision'])) { - $request->setRevision($optionalArgs['revision']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetFunction', PBFunction::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of functions that belong to the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $functionServiceClient->listFunctions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location from which the function should be - * listed, specified in the format `projects/*/locations/*` If you want to - * list functions in all locations, use "-" in place of a location. When - * listing functions in all locations, if one or more location(s) are - * unreachable, the response will contain functions from all reachable - * locations along with the names of any unreachable 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 string $filter - * The filter for Functions that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type string $orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. - * See https://google.aip.dev/132#ordering. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFunctions($parent, array $optionalArgs = []) - { - $request = new ListFunctionsRequest(); - $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('ListFunctions', $optionalArgs, ListFunctionsResponse::class, $request); - } - - /** - * Returns a list of runtimes that are supported for the requested project. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $formattedParent = $functionServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $functionServiceClient->listRuntimes($formattedParent); - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location from which the runtimes should be - * listed, specified in the format `projects/*/locations/*` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The filter for Runtimes that match the filter expression, - * following the syntax outlined in https://google.aip.dev/160. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Functions\V2\ListRuntimesResponse - * - * @throws ApiException if the remote call fails - */ - public function listRuntimes($parent, array $optionalArgs = []) - { - $request = new ListRuntimesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListRuntimes', ListRuntimesResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates existing function. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $function = new PBFunction(); - * $operationResponse = $functionServiceClient->updateFunction($function); - * $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 = $functionServiceClient->updateFunction($function); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $functionServiceClient->resumeOperation($operationName, 'updateFunction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $functionServiceClient->close(); - * } - * ``` - * - * @param PBFunction $function Required. New version of the function. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * The list of fields to be updated. - * If no field mask is provided, all fields will be updated. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFunction($function, array $optionalArgs = []) - { - $request = new UpdateFunctionRequest(); - $requestParamHeaders = []; - $request->setFunction($function); - $requestParamHeaders['function.name'] = $function->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('UpdateFunction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $functionServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $functionServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $response = $functionServiceClient->getIamPolicy($resource); - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $functionServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $functionServiceClient->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: - * ``` - * $functionServiceClient = new FunctionServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $functionServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $functionServiceClient->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/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json b/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json deleted file mode 100644 index 9e109ca2916e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/gapic_metadata.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.functions.v2", - "libraryPackage": "Google\\Cloud\\Functions\\V2", - "services": { - "FunctionService": { - "clients": { - "grpc": { - "libraryClient": "FunctionServiceGapicClient", - "rpcs": { - "CreateFunction": { - "methods": [ - "createFunction" - ] - }, - "DeleteFunction": { - "methods": [ - "deleteFunction" - ] - }, - "GenerateDownloadUrl": { - "methods": [ - "generateDownloadUrl" - ] - }, - "GenerateUploadUrl": { - "methods": [ - "generateUploadUrl" - ] - }, - "GetFunction": { - "methods": [ - "getFunction" - ] - }, - "ListFunctions": { - "methods": [ - "listFunctions" - ] - }, - "ListRuntimes": { - "methods": [ - "listRuntimes" - ] - }, - "UpdateFunction": { - "methods": [ - "updateFunction" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json deleted file mode 100644 index bfc64e4b21e5..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_client_config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.cloud.functions.v2.FunctionService": { - "retry_codes": { - "no_retry_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 - } - }, - "methods": { - "CreateFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "DeleteFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateDownloadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GenerateUploadUrl": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListFunctions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListRuntimes": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "UpdateFunction": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListLocations": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php deleted file mode 100644 index b0f8d88bbb90..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_descriptor_config.php +++ /dev/null @@ -1,227 +0,0 @@ - [ - 'google.cloud.functions.v2.FunctionService' => [ - 'CreateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Functions\V2\PBFunction', - 'metadataReturnType' => '\Google\Cloud\Functions\V2\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'function.name', - 'fieldAccessors' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\GenerateDownloadUrlResponse', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\GenerateUploadUrlResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\PBFunction', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListFunctions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getFunctions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\ListFunctionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListRuntimes' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Functions\V2\ListRuntimesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListLocations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getLocations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'templateMap' => [ - 'build' => 'projects/{project}/locations/{location}/builds/{build}', - 'channel' => 'projects/{project}/locations/{location}/channels/{channel}', - 'connector' => 'projects/{project}/locations/{location}/connectors/{connector}', - 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', - 'function' => 'projects/{project}/locations/{location}/functions/{function}', - 'location' => 'projects/{project}/locations/{location}', - 'repository' => 'projects/{project}/locations/{location}/repositories/{repository}', - 'service' => 'projects/{project}/locations/{location}/services/{service}', - 'topic' => 'projects/{project}/topics/{topic}', - 'trigger' => 'projects/{project}/locations/{location}/triggers/{trigger}', - 'workerPool' => 'projects/{project}/locations/{location}/workerPools/{worker_pool}', - ], - ], - ], -]; diff --git a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php b/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php deleted file mode 100644 index 44d8f539758e..000000000000 --- a/owl-bot-staging/Functions/v2/src/V2/resources/function_service_rest_client_config.php +++ /dev/null @@ -1,196 +0,0 @@ - [ - 'google.cloud.functions.v2.FunctionService' => [ - 'CreateFunction' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', - 'body' => 'function', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteFunction' => [ - 'method' => 'delete', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateDownloadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GenerateUploadUrl' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetFunction' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/functions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListFunctions' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/functions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListRuntimes' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/runtimes', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateFunction' => [ - 'method' => 'patch', - 'uriTemplate' => '/v2/{function.name=projects/*/locations/*/functions/*}', - 'body' => 'function', - 'placeholders' => [ - 'function.name' => [ - 'getters' => [ - 'getFunction', - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.location.Locations' => [ - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v2/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php deleted file mode 100644 index 6ffff536de95..000000000000 --- a/owl-bot-staging/Functions/v2/tests/Unit/V2/Client/FunctionServiceClientTest.php +++ /dev/null @@ -1,1157 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FunctionServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FunctionServiceClient($options); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunction($request); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new DeleteFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->deleteFunction($request); - $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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new DeleteFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->deleteFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GenerateDownloadUrlRequest()) - ->setName($formattedName); - $response = $gapicClient->generateDownloadUrl($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GenerateDownloadUrlRequest()) - ->setName($formattedName); - try { - $gapicClient->generateDownloadUrl($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new GenerateUploadUrlRequest()) - ->setParent($formattedParent); - $response = $gapicClient->generateUploadUrl($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new GenerateUploadUrlRequest()) - ->setParent($formattedParent); - try { - $gapicClient->generateUploadUrl($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GetFunctionRequest()) - ->setName($formattedName); - $response = $gapicClient->getFunction($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $request = (new GetFunctionRequest()) - ->setName($formattedName); - try { - $gapicClient->getFunction($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new PBFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFunctionsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listFunctions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new ListFunctionsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listFunctions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListRuntimesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListRuntimesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listRuntimes($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $request = (new ListRuntimesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listRuntimes($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new PBFunction(); - $request = (new UpdateFunctionRequest()) - ->setFunction($function); - $response = $gapicClient->updateFunction($request); - $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new PBFunction(); - $request = (new UpdateFunctionRequest()) - ->setFunction($function); - $response = $gapicClient->updateFunction($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->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); - $request = new ListLocationsRequest(); - $response = $gapicClient->listLocations($request); - $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); - $request = new ListLocationsRequest(); - try { - $gapicClient->listLocations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $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'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $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(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $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 = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createFunctionAsyncTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $request = (new CreateFunctionRequest()) - ->setParent($formattedParent) - ->setFunction($function); - $response = $gapicClient->createFunctionAsync($request)->wait(); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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()); - } -} diff --git a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php b/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php deleted file mode 100644 index 3abfab83887a..000000000000 --- a/owl-bot-staging/Functions/v2/tests/Unit/V2/FunctionServiceClientTest.php +++ /dev/null @@ -1,1015 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FunctionServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FunctionServiceClient($options); - } - - /** @test */ - public function createFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $function = new PBFunction(); - $response = $gapicClient->createFunction($formattedParent, $function); - $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.functions.v2.FunctionService/CreateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - $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 createFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFunctionTest'); - $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]'); - $function = new PBFunction(); - $response = $gapicClient->createFunction($formattedParent, $function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($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.functions.v2.FunctionService/DeleteFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - $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 deleteFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFunctionTest'); - $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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->deleteFunction($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $downloadUrl = 'downloadUrl1109408056'; - $expectedResponse = new GenerateDownloadUrlResponse(); - $expectedResponse->setDownloadUrl($downloadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->generateDownloadUrl($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.functions.v2.FunctionService/GenerateDownloadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateDownloadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->generateDownloadUrl($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 generateUploadUrlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $uploadUrl = 'uploadUrl-242738639'; - $expectedResponse = new GenerateUploadUrlResponse(); - $expectedResponse->setUploadUrl($uploadUrl); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->generateUploadUrl($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/GenerateUploadUrl', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateUploadUrlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->generateUploadUrl($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 getFunctionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - $response = $gapicClient->getFunction($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.functions.v2.FunctionService/GetFunction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFunctionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->functionName('[PROJECT]', '[LOCATION]', '[FUNCTION]'); - try { - $gapicClient->getFunction($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 listFunctionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $functionsElement = new PBFunction(); - $functions = [ - $functionsElement, - ]; - $expectedResponse = new ListFunctionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFunctions($functions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listFunctions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFunctions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListFunctions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFunctionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listFunctions($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 listRuntimesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListRuntimesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listRuntimes($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.functions.v2.FunctionService/ListRuntimes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRuntimesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listRuntimes($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 updateFunctionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $url = 'url116079'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new PBFunction(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUrl($url); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFunctionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $function = new PBFunction(); - $response = $gapicClient->updateFunction($function); - $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.functions.v2.FunctionService/UpdateFunction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFunction(); - $this->assertProtobufEquals($function, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - $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 updateFunctionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFunctionTest'); - $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 - $function = new PBFunction(); - $response = $gapicClient->updateFunction($function); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFunctionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->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()); - } -}