Skip to content

Commit

Permalink
feat: [run] Adds Startup and Liveness probes to Cloud Run v2 API clie…
Browse files Browse the repository at this point in the history
…nt 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 <blakeli@google.com>
  • Loading branch information
3 people authored Oct 22, 2022
1 parent d0adf67 commit 5abd13a
Show file tree
Hide file tree
Showing 34 changed files with 5,760 additions and 142 deletions.
6 changes: 3 additions & 3 deletions java-run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-run</artifactId>
<version>0.3.5</version>
<version>0.4.0</version>
</dependency>
```

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

```Groovy
implementation 'com.google.cloud:google-cloud-run:0.3.5'
implementation 'com.google.cloud:google-cloud-run:0.4.0'
```

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

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-run" % "0.3.5"
libraryDependencies += "com.google.cloud" % "google-cloud-run" % "0.4.0"
```

## Authentication
Expand Down
5 changes: 4 additions & 1 deletion java-run/google-cloud-run/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v1</artifactId>
</dependency>

<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-run-v2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ public final OperationsClient getHttpJsonOperationsClient() {
* }
* }</pre>
*
* @param parent Required. The location and project in which this service should be created.
* Format: projects/{projectnumber}/locations/{location}
* @param parent The location and project in which this service should be created. Format:
* projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens.
* @param service Required. The Service instance to create.
* @param serviceId Required. The unique identifier for the Service. The name of the service
* @param serviceId Required. The unique identifier for the Service. It must begin with letter,
* and may not end with hyphen; must contain fewer than 50 characters. The name of the service
* becomes {parent}/services/{service_id}.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down Expand Up @@ -265,10 +266,11 @@ public final OperationFuture<Service, Service> createServiceAsync(
* }
* }</pre>
*
* @param parent Required. The location and project in which this service should be created.
* Format: projects/{projectnumber}/locations/{location}
* @param parent The location and project in which this service should be created. Format:
* projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens.
* @param service Required. The Service instance to create.
* @param serviceId Required. The unique identifier for the Service. The name of the service
* @param serviceId Required. The unique identifier for the Service. It must begin with letter,
* and may not end with hyphen; must contain fewer than 50 characters. The name of the service
* becomes {parent}/services/{service_id}.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down Expand Up @@ -395,7 +397,7 @@ public final UnaryCallable<CreateServiceRequest, Operation> createServiceCallabl
* }</pre>
*
* @param name Required. The full name of the Service. Format:
* projects/{projectnumber}/locations/{location}/services/{service}
* projects/{project}/locations/{location}/services/{service}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Service getService(ServiceName name) {
Expand Down Expand Up @@ -423,7 +425,7 @@ public final Service getService(ServiceName name) {
* }</pre>
*
* @param name Required. The full name of the Service. Format:
* projects/{projectnumber}/locations/{location}/services/{service}
* projects/{project}/locations/{location}/services/{service}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Service getService(String name) {
Expand Down Expand Up @@ -508,7 +510,7 @@ public final UnaryCallable<GetServiceRequest, Service> getServiceCallable() {
*
* @param parent Required. The location and project to list resources on. Location must be a valid
* GCP region, and may not be the "-" wildcard. Format:
* projects/{projectnumber}/locations/{location}
* projects/{project}/locations/{location}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListServicesPagedResponse listServices(LocationName parent) {
Expand Down Expand Up @@ -541,7 +543,7 @@ public final ListServicesPagedResponse listServices(LocationName parent) {
*
* @param parent Required. The location and project to list resources on. Location must be a valid
* GCP region, and may not be the "-" wildcard. Format:
* projects/{projectnumber}/locations/{location}
* projects/{project}/locations/{location}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListServicesPagedResponse listServices(String parent) {
Expand Down Expand Up @@ -790,7 +792,7 @@ public final UnaryCallable<UpdateServiceRequest, Operation> updateServiceCallabl
* }</pre>
*
* @param name Required. The full name of the Service. Format:
* projects/{projectnumber}/locations/{location}/services/{service}
* projects/{project}/locations/{location}/services/{service}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Service, Service> deleteServiceAsync(ServiceName name) {
Expand Down Expand Up @@ -819,7 +821,7 @@ public final OperationFuture<Service, Service> deleteServiceAsync(ServiceName na
* }</pre>
*
* @param name Required. The full name of the Service. Format:
* projects/{projectnumber}/locations/{location}/services/{service}
* projects/{project}/locations/{location}/services/{service}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Service, Service> deleteServiceAsync(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.run.v2;

import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.protobuf.AbstractMessage;
import io.grpc.ServerServiceDefinition;
import java.util.List;
import javax.annotation.Generated;

@BetaApi
@Generated("by gapic-generator-java")
public class MockLocations implements MockGrpcService {
private final MockLocationsImpl serviceImpl;

public MockLocations() {
serviceImpl = new MockLocationsImpl();
}

@Override
public List<AbstractMessage> getRequests() {
return serviceImpl.getRequests();
}

@Override
public void addResponse(AbstractMessage response) {
serviceImpl.addResponse(response);
}

@Override
public void addException(Exception exception) {
serviceImpl.addException(exception);
}

@Override
public ServerServiceDefinition getServiceDefinition() {
return serviceImpl.bindService();
}

@Override
public void reset() {
serviceImpl.reset();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.run.v2;

import com.google.api.core.BetaApi;
import com.google.cloud.location.LocationsGrpc.LocationsImplBase;
import com.google.protobuf.AbstractMessage;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated;

@BetaApi
@Generated("by gapic-generator-java")
public class MockLocationsImpl extends LocationsImplBase {
private List<AbstractMessage> requests;
private Queue<Object> responses;

public MockLocationsImpl() {
requests = new ArrayList<>();
responses = new LinkedList<>();
}

public List<AbstractMessage> getRequests() {
return requests;
}

public void addResponse(AbstractMessage response) {
responses.add(response);
}

public void setResponses(List<AbstractMessage> responses) {
this.responses = new LinkedList<Object>(responses);
}

public void addException(Exception exception) {
responses.add(exception);
}

public void reset() {
requests = new ArrayList<>();
responses = new LinkedList<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

@Generated("by gapic-generator-java")
public class RevisionsClientTest {
private static MockLocations mockLocations;
private static MockRevisions mockRevisions;
private static MockServiceHelper mockServiceHelper;
private LocalChannelProvider channelProvider;
Expand All @@ -59,9 +60,11 @@ public class RevisionsClientTest {
@BeforeClass
public static void startStaticServer() {
mockRevisions = new MockRevisions();
mockLocations = new MockLocations();
mockServiceHelper =
new MockServiceHelper(
UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockRevisions));
UUID.randomUUID().toString(),
Arrays.<MockGrpcService>asList(mockRevisions, mockLocations));
mockServiceHelper.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

@Generated("by gapic-generator-java")
public class ServicesClientTest {
private static MockLocations mockLocations;
private static MockServiceHelper mockServiceHelper;
private static MockServices mockServices;
private LocalChannelProvider channelProvider;
Expand All @@ -68,9 +69,11 @@ public class ServicesClientTest {
@BeforeClass
public static void startStaticServer() {
mockServices = new MockServices();
mockLocations = new MockLocations();
mockServiceHelper =
new MockServiceHelper(
UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockServices));
UUID.randomUUID().toString(),
Arrays.<MockGrpcService>asList(mockServices, mockLocations));
mockServiceHelper.start();
}

Expand Down
3 changes: 2 additions & 1 deletion java-run/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@
<module>proto-google-cloud-run-v2</module>
<module>google-cloud-run-bom</module>
</modules>
</project>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,16 @@ public enum ExecutionReason implements com.google.protobuf.ProtocolMessageEnum {
* <code>NON_ZERO_EXIT_CODE = 2;</code>
*/
NON_ZERO_EXIT_CODE(2),
/**
*
*
* <pre>
* The execution was cancelled by users.
* </pre>
*
* <code>CANCELLED = 3;</code>
*/
CANCELLED(3),
UNRECOGNIZED(-1),
;

Expand Down Expand Up @@ -1313,6 +1323,16 @@ public enum ExecutionReason implements com.google.protobuf.ProtocolMessageEnum {
* <code>NON_ZERO_EXIT_CODE = 2;</code>
*/
public static final int NON_ZERO_EXIT_CODE_VALUE = 2;
/**
*
*
* <pre>
* The execution was cancelled by users.
* </pre>
*
* <code>CANCELLED = 3;</code>
*/
public static final int CANCELLED_VALUE = 3;

public final int getNumber() {
if (this == UNRECOGNIZED) {
Expand Down Expand Up @@ -1344,6 +1364,8 @@ public static ExecutionReason forNumber(int value) {
return JOB_STATUS_SERVICE_POLLING_ERROR;
case 2:
return NON_ZERO_EXIT_CODE;
case 3:
return CANCELLED;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
java.lang.String[] descriptorData = {
"\n#google/cloud/run/v2/condition.proto\022\023g"
+ "oogle.cloud.run.v2\032\037google/protobuf/time"
+ "stamp.proto\"\325\013\n\tCondition\022\014\n\004type\030\001 \001(\t\022"
+ "stamp.proto\"\344\013\n\tCondition\022\014\n\004type\030\001 \001(\t\022"
+ "3\n\005state\030\002 \001(\0162$.google.cloud.run.v2.Con"
+ "dition.State\022\017\n\007message\030\003 \001(\t\0228\n\024last_tr"
+ "ansition_time\030\004 \001(\0132\032.google.protobuf.Ti"
Expand Down Expand Up @@ -76,13 +76,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "IZED_PATH_RESPONSE_PENDING\020\007\022!\n\035MIN_INST"
+ "ANCES_NOT_PROVISIONED\020\010\022!\n\035ACTIVE_REVISI"
+ "ON_LIMIT_REACHED\020\t\022\021\n\rNO_DEPLOYMENT\020\n\022\030\n"
+ "\024HEALTH_CHECK_SKIPPED\020\013\"o\n\017ExecutionReas"
+ "\024HEALTH_CHECK_SKIPPED\020\013\"~\n\017ExecutionReas"
+ "on\022\036\n\032EXECUTION_REASON_UNDEFINED\020\000\022$\n JO"
+ "B_STATUS_SERVICE_POLLING_ERROR\020\001\022\026\n\022NON_"
+ "ZERO_EXIT_CODE\020\002B\t\n\007reasonsBc\n\027com.googl"
+ "e.cloud.run.v2B\016ConditionProtoP\001Z6google"
+ ".golang.org/genproto/googleapis/cloud/ru"
+ "n/v2;runb\006proto3"
+ "ZERO_EXIT_CODE\020\002\022\r\n\tCANCELLED\020\003B\t\n\007reaso"
+ "nsBc\n\027com.google.cloud.run.v2B\016Condition"
+ "ProtoP\001Z6google.golang.org/genproto/goog"
+ "leapis/cloud/run/v2;runb\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down
Loading

0 comments on commit 5abd13a

Please sign in to comment.