Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [common-protos] Log Analytics features of the Cloud Logging API #1573

Merged
merged 12 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public LocationsFutureStub newStub(
* [Location.metadata][google.cloud.location.Location.metadata] field.
* </pre>
*/
public abstract static class LocationsImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
*
Expand All @@ -180,7 +180,7 @@ public abstract static class LocationsImplBase implements io.grpc.BindableServic
* Lists information about the supported locations for this service.
* </pre>
*/
public void listLocations(
default void listLocations(
com.google.cloud.location.ListLocationsRequest request,
io.grpc.stub.StreamObserver<com.google.cloud.location.ListLocationsResponse>
responseObserver) {
Expand All @@ -195,35 +195,33 @@ public void listLocations(
* Gets information about a location.
* </pre>
*/
public void getLocation(
default void getLocation(
com.google.cloud.location.GetLocationRequest request,
io.grpc.stub.StreamObserver<com.google.cloud.location.Location> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getGetLocationMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service Locations.
*
* <pre>
* An abstract interface that provides location-related information for
* a service. Service-specific metadata is provided through the
* [Location.metadata][google.cloud.location.Location.metadata] field.
* </pre>
*/
public abstract static class LocationsImplBase implements io.grpc.BindableService, AsyncService {

@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListLocationsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.location.ListLocationsRequest,
com.google.cloud.location.ListLocationsResponse>(
this, METHODID_LIST_LOCATIONS)))
.addMethod(
getGetLocationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.location.GetLocationRequest,
com.google.cloud.location.Location>(this, METHODID_GET_LOCATION)))
.build();
return LocationsGrpc.bindService(this);
}
}

/**
*
* A stub to allow clients to do asynchronous rpc calls to service Locations.
*
* <pre>
* An abstract interface that provides location-related information for
Expand Down Expand Up @@ -276,7 +274,7 @@ public void getLocation(
}

/**
*
* A stub to allow clients to do synchronous rpc calls to service Locations.
*
* <pre>
* An abstract interface that provides location-related information for
Expand Down Expand Up @@ -324,7 +322,7 @@ public com.google.cloud.location.Location getLocation(
}

/**
*
* A stub to allow clients to do ListenableFuture-style rpc calls to service Locations.
*
* <pre>
* An abstract interface that provides location-related information for
Expand Down Expand Up @@ -379,10 +377,10 @@ private static final class MethodHandlers<Req, Resp>
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LocationsImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(LocationsImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -418,6 +416,24 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListLocationsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.location.ListLocationsRequest,
com.google.cloud.location.ListLocationsResponse>(
service, METHODID_LIST_LOCATIONS)))
.addMethod(
getGetLocationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.location.GetLocationRequest,
com.google.cloud.location.Location>(service, METHODID_GET_LOCATION)))
.build();
}

private abstract static class LocationsBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
io.grpc.protobuf.ProtoServiceDescriptorSupplier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public OperationsFutureStub newStub(
* so developers can have a consistent client experience.
* </pre>
*/
public abstract static class OperationsImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
*
Expand All @@ -321,7 +321,7 @@ public abstract static class OperationsImplBase implements io.grpc.BindableServi
* is the parent resource, without the operations collection id.
* </pre>
*/
public void listOperations(
default void listOperations(
com.google.longrunning.ListOperationsRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.ListOperationsResponse>
responseObserver) {
Expand All @@ -338,7 +338,7 @@ public void listOperations(
* service.
* </pre>
*/
public void getOperation(
default void getOperation(
com.google.longrunning.GetOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
Expand All @@ -355,7 +355,7 @@ public void getOperation(
* `google.rpc.Code.UNIMPLEMENTED`.
* </pre>
*/
public void deleteOperation(
default void deleteOperation(
com.google.longrunning.DeleteOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
Expand All @@ -378,7 +378,7 @@ public void deleteOperation(
* corresponding to `Code.CANCELLED`.
* </pre>
*/
public void cancelOperation(
default void cancelOperation(
com.google.longrunning.CancelOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
Expand All @@ -400,53 +400,38 @@ public void cancelOperation(
* immediate response is no guarantee that the operation is done.
* </pre>
*/
public void waitOperation(
default void waitOperation(
com.google.longrunning.WaitOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getWaitOperationMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service Operations.
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
public abstract static class OperationsImplBase implements io.grpc.BindableService, AsyncService {

@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListOperationsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>(
this, METHODID_LIST_OPERATIONS)))
.addMethod(
getGetOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>(
this, METHODID_GET_OPERATION)))
.addMethod(
getDeleteOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>(
this, METHODID_DELETE_OPERATION)))
.addMethod(
getCancelOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>(
this, METHODID_CANCEL_OPERATION)))
.addMethod(
getWaitOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.WaitOperationRequest,
com.google.longrunning.Operation>(this, METHODID_WAIT_OPERATION)))
.build();
return OperationsGrpc.bindService(this);
}
}

/**
*
* A stub to allow clients to do asynchronous rpc calls to service Operations.
*
* <pre>
* Manages long-running operations with an API service.
Expand Down Expand Up @@ -582,7 +567,7 @@ public void waitOperation(
}

/**
*
* A stub to allow clients to do synchronous rpc calls to service Operations.
*
* <pre>
* Manages long-running operations with an API service.
Expand Down Expand Up @@ -704,7 +689,7 @@ public com.google.longrunning.Operation waitOperation(
}

/**
*
* A stub to allow clients to do ListenableFuture-style rpc calls to service Operations.
*
* <pre>
* Manages long-running operations with an API service.
Expand Down Expand Up @@ -836,10 +821,10 @@ private static final class MethodHandlers<Req, Resp>
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final OperationsImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(OperationsImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -890,6 +875,42 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListOperationsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>(
service, METHODID_LIST_OPERATIONS)))
.addMethod(
getGetOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>(
service, METHODID_GET_OPERATION)))
.addMethod(
getDeleteOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>(
service, METHODID_DELETE_OPERATION)))
.addMethod(
getCancelOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>(
service, METHODID_CANCEL_OPERATION)))
.addMethod(
getWaitOperationMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.WaitOperationRequest, com.google.longrunning.Operation>(
service, METHODID_WAIT_OPERATION)))
.build();
}

private abstract static class OperationsBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
io.grpc.protobuf.ProtoServiceDescriptorSupplier {
Expand Down