Skip to content

Commit 5abd13a

Browse files
feat: [run] Adds Startup and Liveness probes to Cloud Run v2 API client libraries (#8612)
* feat: Adds Startup and Liveness probes to Cloud Run v2 API client libraries For more information about this feature, visit https://cloud.google.com/run/docs/configuring/healthchecks PiperOrigin-RevId: 481203788 Source-Link: googleapis/googleapis@778762c Source-Link: https://github.com/googleapis/googleapis-gen/commit/1479c7a63fc7d5b5d98c48e9ba1d0b6a94e95513 Copy-Tag: eyJwIjoiamF2YS1ydW4vLk93bEJvdC55YW1sIiwiaCI6IjE0NzljN2E2M2ZjN2Q1YjVkOThjNDhlOWJhMWQwYjZhOTRlOTU1MTMifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update pom.xml Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Blake Li <[email protected]>
1 parent d0adf67 commit 5abd13a

34 files changed

+5760
-142
lines changed

java-run/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file:
2222
<dependency>
2323
<groupId>com.google.cloud</groupId>
2424
<artifactId>google-cloud-run</artifactId>
25-
<version>0.3.5</version>
25+
<version>0.4.0</version>
2626
</dependency>
2727
```
2828

2929
If you are using Gradle without BOM, add this to your dependencies:
3030

3131
```Groovy
32-
implementation 'com.google.cloud:google-cloud-run:0.3.5'
32+
implementation 'com.google.cloud:google-cloud-run:0.4.0'
3333
```
3434

3535
If you are using SBT, add this to your dependencies:
3636

3737
```Scala
38-
libraryDependencies += "com.google.cloud" % "google-cloud-run" % "0.3.5"
38+
libraryDependencies += "com.google.cloud" % "google-cloud-run" % "0.4.0"
3939
```
4040

4141
## Authentication

java-run/google-cloud-run/pom.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@
4040
<groupId>com.google.api.grpc</groupId>
4141
<artifactId>proto-google-common-protos</artifactId>
4242
</dependency>
43+
<dependency>
44+
<groupId>com.google.api.grpc</groupId>
45+
<artifactId>grpc-google-common-protos</artifactId>
46+
</dependency>
4347
<dependency>
4448
<groupId>com.google.api.grpc</groupId>
4549
<artifactId>proto-google-iam-v1</artifactId>
4650
</dependency>
47-
4851
<dependency>
4952
<groupId>com.google.api.grpc</groupId>
5053
<artifactId>proto-google-cloud-run-v2</artifactId>

java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ServicesClient.java

+14-12
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,11 @@ public final OperationsClient getHttpJsonOperationsClient() {
227227
* }
228228
* }</pre>
229229
*
230-
* @param parent Required. The location and project in which this service should be created.
231-
* Format: projects/{projectnumber}/locations/{location}
230+
* @param parent The location and project in which this service should be created. Format:
231+
* projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens.
232232
* @param service Required. The Service instance to create.
233-
* @param serviceId Required. The unique identifier for the Service. The name of the service
233+
* @param serviceId Required. The unique identifier for the Service. It must begin with letter,
234+
* and may not end with hyphen; must contain fewer than 50 characters. The name of the service
234235
* becomes {parent}/services/{service_id}.
235236
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
236237
*/
@@ -265,10 +266,11 @@ public final OperationFuture<Service, Service> createServiceAsync(
265266
* }
266267
* }</pre>
267268
*
268-
* @param parent Required. The location and project in which this service should be created.
269-
* Format: projects/{projectnumber}/locations/{location}
269+
* @param parent The location and project in which this service should be created. Format:
270+
* projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens.
270271
* @param service Required. The Service instance to create.
271-
* @param serviceId Required. The unique identifier for the Service. The name of the service
272+
* @param serviceId Required. The unique identifier for the Service. It must begin with letter,
273+
* and may not end with hyphen; must contain fewer than 50 characters. The name of the service
272274
* becomes {parent}/services/{service_id}.
273275
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
274276
*/
@@ -395,7 +397,7 @@ public final UnaryCallable<CreateServiceRequest, Operation> createServiceCallabl
395397
* }</pre>
396398
*
397399
* @param name Required. The full name of the Service. Format:
398-
* projects/{projectnumber}/locations/{location}/services/{service}
400+
* projects/{project}/locations/{location}/services/{service}
399401
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
400402
*/
401403
public final Service getService(ServiceName name) {
@@ -423,7 +425,7 @@ public final Service getService(ServiceName name) {
423425
* }</pre>
424426
*
425427
* @param name Required. The full name of the Service. Format:
426-
* projects/{projectnumber}/locations/{location}/services/{service}
428+
* projects/{project}/locations/{location}/services/{service}
427429
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
428430
*/
429431
public final Service getService(String name) {
@@ -508,7 +510,7 @@ public final UnaryCallable<GetServiceRequest, Service> getServiceCallable() {
508510
*
509511
* @param parent Required. The location and project to list resources on. Location must be a valid
510512
* GCP region, and may not be the "-" wildcard. Format:
511-
* projects/{projectnumber}/locations/{location}
513+
* projects/{project}/locations/{location}
512514
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
513515
*/
514516
public final ListServicesPagedResponse listServices(LocationName parent) {
@@ -541,7 +543,7 @@ public final ListServicesPagedResponse listServices(LocationName parent) {
541543
*
542544
* @param parent Required. The location and project to list resources on. Location must be a valid
543545
* GCP region, and may not be the "-" wildcard. Format:
544-
* projects/{projectnumber}/locations/{location}
546+
* projects/{project}/locations/{location}
545547
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
546548
*/
547549
public final ListServicesPagedResponse listServices(String parent) {
@@ -790,7 +792,7 @@ public final UnaryCallable<UpdateServiceRequest, Operation> updateServiceCallabl
790792
* }</pre>
791793
*
792794
* @param name Required. The full name of the Service. Format:
793-
* projects/{projectnumber}/locations/{location}/services/{service}
795+
* projects/{project}/locations/{location}/services/{service}
794796
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
795797
*/
796798
public final OperationFuture<Service, Service> deleteServiceAsync(ServiceName name) {
@@ -819,7 +821,7 @@ public final OperationFuture<Service, Service> deleteServiceAsync(ServiceName na
819821
* }</pre>
820822
*
821823
* @param name Required. The full name of the Service. Format:
822-
* projects/{projectnumber}/locations/{location}/services/{service}
824+
* projects/{project}/locations/{location}/services/{service}
823825
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
824826
*/
825827
public final OperationFuture<Service, Service> deleteServiceAsync(String name) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.run.v2;
18+
19+
import com.google.api.core.BetaApi;
20+
import com.google.api.gax.grpc.testing.MockGrpcService;
21+
import com.google.protobuf.AbstractMessage;
22+
import io.grpc.ServerServiceDefinition;
23+
import java.util.List;
24+
import javax.annotation.Generated;
25+
26+
@BetaApi
27+
@Generated("by gapic-generator-java")
28+
public class MockLocations implements MockGrpcService {
29+
private final MockLocationsImpl serviceImpl;
30+
31+
public MockLocations() {
32+
serviceImpl = new MockLocationsImpl();
33+
}
34+
35+
@Override
36+
public List<AbstractMessage> getRequests() {
37+
return serviceImpl.getRequests();
38+
}
39+
40+
@Override
41+
public void addResponse(AbstractMessage response) {
42+
serviceImpl.addResponse(response);
43+
}
44+
45+
@Override
46+
public void addException(Exception exception) {
47+
serviceImpl.addException(exception);
48+
}
49+
50+
@Override
51+
public ServerServiceDefinition getServiceDefinition() {
52+
return serviceImpl.bindService();
53+
}
54+
55+
@Override
56+
public void reset() {
57+
serviceImpl.reset();
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.run.v2;
18+
19+
import com.google.api.core.BetaApi;
20+
import com.google.cloud.location.LocationsGrpc.LocationsImplBase;
21+
import com.google.protobuf.AbstractMessage;
22+
import java.util.ArrayList;
23+
import java.util.LinkedList;
24+
import java.util.List;
25+
import java.util.Queue;
26+
import javax.annotation.Generated;
27+
28+
@BetaApi
29+
@Generated("by gapic-generator-java")
30+
public class MockLocationsImpl extends LocationsImplBase {
31+
private List<AbstractMessage> requests;
32+
private Queue<Object> responses;
33+
34+
public MockLocationsImpl() {
35+
requests = new ArrayList<>();
36+
responses = new LinkedList<>();
37+
}
38+
39+
public List<AbstractMessage> getRequests() {
40+
return requests;
41+
}
42+
43+
public void addResponse(AbstractMessage response) {
44+
responses.add(response);
45+
}
46+
47+
public void setResponses(List<AbstractMessage> responses) {
48+
this.responses = new LinkedList<Object>(responses);
49+
}
50+
51+
public void addException(Exception exception) {
52+
responses.add(exception);
53+
}
54+
55+
public void reset() {
56+
requests = new ArrayList<>();
57+
responses = new LinkedList<>();
58+
}
59+
}

java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/RevisionsClientTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
@Generated("by gapic-generator-java")
5353
public class RevisionsClientTest {
54+
private static MockLocations mockLocations;
5455
private static MockRevisions mockRevisions;
5556
private static MockServiceHelper mockServiceHelper;
5657
private LocalChannelProvider channelProvider;
@@ -59,9 +60,11 @@ public class RevisionsClientTest {
5960
@BeforeClass
6061
public static void startStaticServer() {
6162
mockRevisions = new MockRevisions();
63+
mockLocations = new MockLocations();
6264
mockServiceHelper =
6365
new MockServiceHelper(
64-
UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockRevisions));
66+
UUID.randomUUID().toString(),
67+
Arrays.<MockGrpcService>asList(mockRevisions, mockLocations));
6568
mockServiceHelper.start();
6669
}
6770

java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ServicesClientTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
@Generated("by gapic-generator-java")
6262
public class ServicesClientTest {
63+
private static MockLocations mockLocations;
6364
private static MockServiceHelper mockServiceHelper;
6465
private static MockServices mockServices;
6566
private LocalChannelProvider channelProvider;
@@ -68,9 +69,11 @@ public class ServicesClientTest {
6869
@BeforeClass
6970
public static void startStaticServer() {
7071
mockServices = new MockServices();
72+
mockLocations = new MockLocations();
7173
mockServiceHelper =
7274
new MockServiceHelper(
73-
UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockServices));
75+
UUID.randomUUID().toString(),
76+
Arrays.<MockGrpcService>asList(mockServices, mockLocations));
7477
mockServiceHelper.start();
7578
}
7679

java-run/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@
5050
<module>proto-google-cloud-run-v2</module>
5151
<module>google-cloud-run-bom</module>
5252
</modules>
53-
</project>
53+
54+
</project>

java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Condition.java

+22
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,16 @@ public enum ExecutionReason implements com.google.protobuf.ProtocolMessageEnum {
12791279
* <code>NON_ZERO_EXIT_CODE = 2;</code>
12801280
*/
12811281
NON_ZERO_EXIT_CODE(2),
1282+
/**
1283+
*
1284+
*
1285+
* <pre>
1286+
* The execution was cancelled by users.
1287+
* </pre>
1288+
*
1289+
* <code>CANCELLED = 3;</code>
1290+
*/
1291+
CANCELLED(3),
12821292
UNRECOGNIZED(-1),
12831293
;
12841294

@@ -1313,6 +1323,16 @@ public enum ExecutionReason implements com.google.protobuf.ProtocolMessageEnum {
13131323
* <code>NON_ZERO_EXIT_CODE = 2;</code>
13141324
*/
13151325
public static final int NON_ZERO_EXIT_CODE_VALUE = 2;
1326+
/**
1327+
*
1328+
*
1329+
* <pre>
1330+
* The execution was cancelled by users.
1331+
* </pre>
1332+
*
1333+
* <code>CANCELLED = 3;</code>
1334+
*/
1335+
public static final int CANCELLED_VALUE = 3;
13161336

13171337
public final int getNumber() {
13181338
if (this == UNRECOGNIZED) {
@@ -1344,6 +1364,8 @@ public static ExecutionReason forNumber(int value) {
13441364
return JOB_STATUS_SERVICE_POLLING_ERROR;
13451365
case 2:
13461366
return NON_ZERO_EXIT_CODE;
1367+
case 3:
1368+
return CANCELLED;
13471369
default:
13481370
return null;
13491371
}

java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ConditionProto.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
4242
java.lang.String[] descriptorData = {
4343
"\n#google/cloud/run/v2/condition.proto\022\023g"
4444
+ "oogle.cloud.run.v2\032\037google/protobuf/time"
45-
+ "stamp.proto\"\325\013\n\tCondition\022\014\n\004type\030\001 \001(\t\022"
45+
+ "stamp.proto\"\344\013\n\tCondition\022\014\n\004type\030\001 \001(\t\022"
4646
+ "3\n\005state\030\002 \001(\0162$.google.cloud.run.v2.Con"
4747
+ "dition.State\022\017\n\007message\030\003 \001(\t\0228\n\024last_tr"
4848
+ "ansition_time\030\004 \001(\0132\032.google.protobuf.Ti"
@@ -76,13 +76,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
7676
+ "IZED_PATH_RESPONSE_PENDING\020\007\022!\n\035MIN_INST"
7777
+ "ANCES_NOT_PROVISIONED\020\010\022!\n\035ACTIVE_REVISI"
7878
+ "ON_LIMIT_REACHED\020\t\022\021\n\rNO_DEPLOYMENT\020\n\022\030\n"
79-
+ "\024HEALTH_CHECK_SKIPPED\020\013\"o\n\017ExecutionReas"
79+
+ "\024HEALTH_CHECK_SKIPPED\020\013\"~\n\017ExecutionReas"
8080
+ "on\022\036\n\032EXECUTION_REASON_UNDEFINED\020\000\022$\n JO"
8181
+ "B_STATUS_SERVICE_POLLING_ERROR\020\001\022\026\n\022NON_"
82-
+ "ZERO_EXIT_CODE\020\002B\t\n\007reasonsBc\n\027com.googl"
83-
+ "e.cloud.run.v2B\016ConditionProtoP\001Z6google"
84-
+ ".golang.org/genproto/googleapis/cloud/ru"
85-
+ "n/v2;runb\006proto3"
82+
+ "ZERO_EXIT_CODE\020\002\022\r\n\tCANCELLED\020\003B\t\n\007reaso"
83+
+ "nsBc\n\027com.google.cloud.run.v2B\016Condition"
84+
+ "ProtoP\001Z6google.golang.org/genproto/goog"
85+
+ "leapis/cloud/run/v2;runb\006proto3"
8686
};
8787
descriptor =
8888
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(

0 commit comments

Comments
 (0)