Skip to content

Commit d945618

Browse files
feat: [cloudfunctions] ListFunctions now include metadata which indicates whether a function is a GEN_1 or GEN_2 function (#9462)
* feat: ListFunctions now include metadata which indicates whether a function is a `GEN_1` or `GEN_2` function feat: KMS crypto keys can now be specified when uploading function source code, enabling source code to be encrypted at rest with a user-managed encryption key feat: You can now specify concurrency and cpu of a gen 2 function through the Function API, without needing to modify the underlying Cloud Run service PiperOrigin-RevId: 534929457 Source-Link: googleapis/googleapis@1c8b678 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c1050ce97535113557a0c132a62910794bc66227 Copy-Tag: eyJwIjoiamF2YS1mdW5jdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6ImMxMDUwY2U5NzUzNTExMzU1N2EwYzEzMmE2MjkxMDc5NGJjNjYyMjcifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: ListFunctions now include metadata which indicates whether a function is a `GEN_1` or `GEN_2` function PiperOrigin-RevId: 535193873 Source-Link: googleapis/googleapis@d6b7eb5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/822ccd09cc1e9f8a4ab0125cc93effe26ab882c1 Copy-Tag: eyJwIjoiamF2YS1mdW5jdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjgyMmNjZDA5Y2MxZTlmOGE0YWIwMTI1Y2M5M2VmZmUyNmFiODgyYzEifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 14fea71 commit d945618

File tree

155 files changed

+7137
-6230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+7137
-6230
lines changed

java-functions/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
2020
<dependency>
2121
<groupId>com.google.cloud</groupId>
2222
<artifactId>libraries-bom</artifactId>
23-
<version>26.14.0</version>
23+
<version>26.15.0</version>
2424
<type>pom</type>
2525
<scope>import</scope>
2626
</dependency>
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-functions.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-functions/2.18.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-functions/2.19.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-functions/google-cloud-functions/src/main/java/com/google/cloud/functions/v2beta/FunctionServiceClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,9 @@ public final UnaryCallable<DeleteFunctionRequest, Operation> deleteFunctionCalla
988988
* GenerateUploadUrlRequest request =
989989
* GenerateUploadUrlRequest.newBuilder()
990990
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
991+
* .setKmsKeyName(
992+
* CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
993+
* .toString())
991994
* .build();
992995
* GenerateUploadUrlResponse response = functionServiceClient.generateUploadUrl(request);
993996
* }
@@ -1041,6 +1044,9 @@ public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlReques
10411044
* GenerateUploadUrlRequest request =
10421045
* GenerateUploadUrlRequest.newBuilder()
10431046
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1047+
* .setKmsKeyName(
1048+
* CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
1049+
* .toString())
10441050
* .build();
10451051
* ApiFuture<GenerateUploadUrlResponse> future =
10461052
* functionServiceClient.generateUploadUrlCallable().futureCall(request);

java-functions/google-cloud-functions/src/test/java/com/google/cloud/functions/v2/FunctionServiceClientHttpJsonTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,18 @@ public void getFunctionTest() throws Exception {
101101
Function expectedResponse =
102102
Function.newBuilder()
103103
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
104-
.setEnvironment(Environment.forNumber(0))
105104
.setDescription("description-1724546052")
106105
.setBuildConfig(BuildConfig.newBuilder().build())
107106
.setServiceConfig(ServiceConfig.newBuilder().build())
108107
.setEventTrigger(EventTrigger.newBuilder().build())
109108
.setUpdateTime(Timestamp.newBuilder().build())
110109
.putAllLabels(new HashMap<String, String>())
111110
.addAllStateMessages(new ArrayList<StateMessage>())
111+
.setEnvironment(Environment.forNumber(0))
112+
.setUrl("url116079")
112113
.setKmsKeyName(
113114
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
114115
.toString())
115-
.setUrl("url116079")
116116
.build();
117117
mockService.addResponse(expectedResponse);
118118

@@ -157,18 +157,18 @@ public void getFunctionTest2() throws Exception {
157157
Function expectedResponse =
158158
Function.newBuilder()
159159
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
160-
.setEnvironment(Environment.forNumber(0))
161160
.setDescription("description-1724546052")
162161
.setBuildConfig(BuildConfig.newBuilder().build())
163162
.setServiceConfig(ServiceConfig.newBuilder().build())
164163
.setEventTrigger(EventTrigger.newBuilder().build())
165164
.setUpdateTime(Timestamp.newBuilder().build())
166165
.putAllLabels(new HashMap<String, String>())
167166
.addAllStateMessages(new ArrayList<StateMessage>())
167+
.setEnvironment(Environment.forNumber(0))
168+
.setUrl("url116079")
168169
.setKmsKeyName(
169170
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
170171
.toString())
171-
.setUrl("url116079")
172172
.build();
173173
mockService.addResponse(expectedResponse);
174174

@@ -313,18 +313,18 @@ public void createFunctionTest() throws Exception {
313313
Function expectedResponse =
314314
Function.newBuilder()
315315
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
316-
.setEnvironment(Environment.forNumber(0))
317316
.setDescription("description-1724546052")
318317
.setBuildConfig(BuildConfig.newBuilder().build())
319318
.setServiceConfig(ServiceConfig.newBuilder().build())
320319
.setEventTrigger(EventTrigger.newBuilder().build())
321320
.setUpdateTime(Timestamp.newBuilder().build())
322321
.putAllLabels(new HashMap<String, String>())
323322
.addAllStateMessages(new ArrayList<StateMessage>())
323+
.setEnvironment(Environment.forNumber(0))
324+
.setUrl("url116079")
324325
.setKmsKeyName(
325326
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
326327
.toString())
327-
.setUrl("url116079")
328328
.build();
329329
Operation resultOperation =
330330
Operation.newBuilder()
@@ -378,18 +378,18 @@ public void createFunctionTest2() throws Exception {
378378
Function expectedResponse =
379379
Function.newBuilder()
380380
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
381-
.setEnvironment(Environment.forNumber(0))
382381
.setDescription("description-1724546052")
383382
.setBuildConfig(BuildConfig.newBuilder().build())
384383
.setServiceConfig(ServiceConfig.newBuilder().build())
385384
.setEventTrigger(EventTrigger.newBuilder().build())
386385
.setUpdateTime(Timestamp.newBuilder().build())
387386
.putAllLabels(new HashMap<String, String>())
388387
.addAllStateMessages(new ArrayList<StateMessage>())
388+
.setEnvironment(Environment.forNumber(0))
389+
.setUrl("url116079")
389390
.setKmsKeyName(
390391
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
391392
.toString())
392-
.setUrl("url116079")
393393
.build();
394394
Operation resultOperation =
395395
Operation.newBuilder()
@@ -443,18 +443,18 @@ public void updateFunctionTest() throws Exception {
443443
Function expectedResponse =
444444
Function.newBuilder()
445445
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
446-
.setEnvironment(Environment.forNumber(0))
447446
.setDescription("description-1724546052")
448447
.setBuildConfig(BuildConfig.newBuilder().build())
449448
.setServiceConfig(ServiceConfig.newBuilder().build())
450449
.setEventTrigger(EventTrigger.newBuilder().build())
451450
.setUpdateTime(Timestamp.newBuilder().build())
452451
.putAllLabels(new HashMap<String, String>())
453452
.addAllStateMessages(new ArrayList<StateMessage>())
453+
.setEnvironment(Environment.forNumber(0))
454+
.setUrl("url116079")
454455
.setKmsKeyName(
455456
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
456457
.toString())
457-
.setUrl("url116079")
458458
.build();
459459
Operation resultOperation =
460460
Operation.newBuilder()
@@ -467,18 +467,18 @@ public void updateFunctionTest() throws Exception {
467467
Function function =
468468
Function.newBuilder()
469469
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
470-
.setEnvironment(Environment.forNumber(0))
471470
.setDescription("description-1724546052")
472471
.setBuildConfig(BuildConfig.newBuilder().build())
473472
.setServiceConfig(ServiceConfig.newBuilder().build())
474473
.setEventTrigger(EventTrigger.newBuilder().build())
475474
.setUpdateTime(Timestamp.newBuilder().build())
476475
.putAllLabels(new HashMap<String, String>())
477476
.addAllStateMessages(new ArrayList<StateMessage>())
477+
.setEnvironment(Environment.forNumber(0))
478+
.setUrl("url116079")
478479
.setKmsKeyName(
479480
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
480481
.toString())
481-
.setUrl("url116079")
482482
.build();
483483
FieldMask updateMask = FieldMask.newBuilder().build();
484484

@@ -511,18 +511,18 @@ public void updateFunctionExceptionTest() throws Exception {
511511
Function function =
512512
Function.newBuilder()
513513
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
514-
.setEnvironment(Environment.forNumber(0))
515514
.setDescription("description-1724546052")
516515
.setBuildConfig(BuildConfig.newBuilder().build())
517516
.setServiceConfig(ServiceConfig.newBuilder().build())
518517
.setEventTrigger(EventTrigger.newBuilder().build())
519518
.setUpdateTime(Timestamp.newBuilder().build())
520519
.putAllLabels(new HashMap<String, String>())
521520
.addAllStateMessages(new ArrayList<StateMessage>())
521+
.setEnvironment(Environment.forNumber(0))
522+
.setUrl("url116079")
522523
.setKmsKeyName(
523524
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
524525
.toString())
525-
.setUrl("url116079")
526526
.build();
527527
FieldMask updateMask = FieldMask.newBuilder().build();
528528
client.updateFunctionAsync(function, updateMask).get();

java-functions/google-cloud-functions/src/test/java/com/google/cloud/functions/v2/FunctionServiceClientTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ public void getFunctionTest() throws Exception {
110110
Function expectedResponse =
111111
Function.newBuilder()
112112
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
113-
.setEnvironment(Environment.forNumber(0))
114113
.setDescription("description-1724546052")
115114
.setBuildConfig(BuildConfig.newBuilder().build())
116115
.setServiceConfig(ServiceConfig.newBuilder().build())
117116
.setEventTrigger(EventTrigger.newBuilder().build())
118117
.setUpdateTime(Timestamp.newBuilder().build())
119118
.putAllLabels(new HashMap<String, String>())
120119
.addAllStateMessages(new ArrayList<StateMessage>())
120+
.setEnvironment(Environment.forNumber(0))
121+
.setUrl("url116079")
121122
.setKmsKeyName(
122123
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
123124
.toString())
124-
.setUrl("url116079")
125125
.build();
126126
mockFunctionService.addResponse(expectedResponse);
127127

@@ -160,18 +160,18 @@ public void getFunctionTest2() throws Exception {
160160
Function expectedResponse =
161161
Function.newBuilder()
162162
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
163-
.setEnvironment(Environment.forNumber(0))
164163
.setDescription("description-1724546052")
165164
.setBuildConfig(BuildConfig.newBuilder().build())
166165
.setServiceConfig(ServiceConfig.newBuilder().build())
167166
.setEventTrigger(EventTrigger.newBuilder().build())
168167
.setUpdateTime(Timestamp.newBuilder().build())
169168
.putAllLabels(new HashMap<String, String>())
170169
.addAllStateMessages(new ArrayList<StateMessage>())
170+
.setEnvironment(Environment.forNumber(0))
171+
.setUrl("url116079")
171172
.setKmsKeyName(
172173
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
173174
.toString())
174-
.setUrl("url116079")
175175
.build();
176176
mockFunctionService.addResponse(expectedResponse);
177177

@@ -298,18 +298,18 @@ public void createFunctionTest() throws Exception {
298298
Function expectedResponse =
299299
Function.newBuilder()
300300
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
301-
.setEnvironment(Environment.forNumber(0))
302301
.setDescription("description-1724546052")
303302
.setBuildConfig(BuildConfig.newBuilder().build())
304303
.setServiceConfig(ServiceConfig.newBuilder().build())
305304
.setEventTrigger(EventTrigger.newBuilder().build())
306305
.setUpdateTime(Timestamp.newBuilder().build())
307306
.putAllLabels(new HashMap<String, String>())
308307
.addAllStateMessages(new ArrayList<StateMessage>())
308+
.setEnvironment(Environment.forNumber(0))
309+
.setUrl("url116079")
309310
.setKmsKeyName(
310311
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
311312
.toString())
312-
.setUrl("url116079")
313313
.build();
314314
Operation resultOperation =
315315
Operation.newBuilder()
@@ -362,18 +362,18 @@ public void createFunctionTest2() throws Exception {
362362
Function expectedResponse =
363363
Function.newBuilder()
364364
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
365-
.setEnvironment(Environment.forNumber(0))
366365
.setDescription("description-1724546052")
367366
.setBuildConfig(BuildConfig.newBuilder().build())
368367
.setServiceConfig(ServiceConfig.newBuilder().build())
369368
.setEventTrigger(EventTrigger.newBuilder().build())
370369
.setUpdateTime(Timestamp.newBuilder().build())
371370
.putAllLabels(new HashMap<String, String>())
372371
.addAllStateMessages(new ArrayList<StateMessage>())
372+
.setEnvironment(Environment.forNumber(0))
373+
.setUrl("url116079")
373374
.setKmsKeyName(
374375
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
375376
.toString())
376-
.setUrl("url116079")
377377
.build();
378378
Operation resultOperation =
379379
Operation.newBuilder()
@@ -426,18 +426,18 @@ public void updateFunctionTest() throws Exception {
426426
Function expectedResponse =
427427
Function.newBuilder()
428428
.setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
429-
.setEnvironment(Environment.forNumber(0))
430429
.setDescription("description-1724546052")
431430
.setBuildConfig(BuildConfig.newBuilder().build())
432431
.setServiceConfig(ServiceConfig.newBuilder().build())
433432
.setEventTrigger(EventTrigger.newBuilder().build())
434433
.setUpdateTime(Timestamp.newBuilder().build())
435434
.putAllLabels(new HashMap<String, String>())
436435
.addAllStateMessages(new ArrayList<StateMessage>())
436+
.setEnvironment(Environment.forNumber(0))
437+
.setUrl("url116079")
437438
.setKmsKeyName(
438439
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
439440
.toString())
440-
.setUrl("url116079")
441441
.build();
442442
Operation resultOperation =
443443
Operation.newBuilder()

0 commit comments

Comments
 (0)