diff --git a/google-cloud-debugger-client/pom.xml b/google-cloud-debugger-client/pom.xml index 676bcbc4..b95cc453 100644 --- a/google-cloud-debugger-client/pom.xml +++ b/google-cloud-debugger-client/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -77,12 +81,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Client.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Client.java index c005ce15..23faeeba 100644 --- a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Client.java +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Client.java @@ -16,7 +16,6 @@ package com.google.cloud.debugger.v2; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.debugger.v2.stub.Controller2Stub; @@ -113,6 +112,20 @@ * Controller2Client controller2Client = Controller2Client.create(controller2Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * Controller2Settings controller2Settings =
+ *     Controller2Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             Controller2Settings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * Controller2Client controller2Client = Controller2Client.create(controller2Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") @@ -137,7 +150,6 @@ public static final Controller2Client create(Controller2Settings settings) throw * Constructs an instance of Controller2Client, using the given stub for making calls. This is for * advanced usage - prefer using create(Controller2Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final Controller2Client create(Controller2Stub stub) { return new Controller2Client(stub); } @@ -152,7 +164,6 @@ protected Controller2Client(Controller2Settings settings) throws IOException { this.stub = ((Controller2StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected Controller2Client(Controller2Stub stub) { this.settings = null; this.stub = stub; @@ -162,7 +173,6 @@ public final Controller2Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public Controller2Stub getStub() { return stub; } diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Settings.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Settings.java index de7c8220..611d0e59 100644 --- a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Settings.java +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Controller2Settings.java @@ -21,6 +21,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -115,11 +116,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return Controller2StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return Controller2StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return Controller2StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return Controller2StubSettings.defaultTransportChannelProvider(); } @@ -129,11 +137,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return Controller2StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -171,6 +185,11 @@ private static Builder createDefault() { return new Builder(Controller2StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(Controller2StubSettings.newHttpJsonBuilder()); + } + public Controller2StubSettings.Builder getStubSettingsBuilder() { return ((Controller2StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Client.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Client.java index 0494527b..332e0058 100644 --- a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Client.java +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Client.java @@ -16,7 +16,6 @@ package com.google.cloud.debugger.v2; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.debugger.v2.stub.Debugger2Stub; @@ -113,6 +112,20 @@ * Debugger2Client debugger2Client = Debugger2Client.create(debugger2Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * Debugger2Settings debugger2Settings =
+ *     Debugger2Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             Debugger2Settings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * Debugger2Client debugger2Client = Debugger2Client.create(debugger2Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") @@ -137,7 +150,6 @@ public static final Debugger2Client create(Debugger2Settings settings) throws IO * Constructs an instance of Debugger2Client, using the given stub for making calls. This is for * advanced usage - prefer using create(Debugger2Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final Debugger2Client create(Debugger2Stub stub) { return new Debugger2Client(stub); } @@ -151,7 +163,6 @@ protected Debugger2Client(Debugger2Settings settings) throws IOException { this.stub = ((Debugger2StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected Debugger2Client(Debugger2Stub stub) { this.settings = null; this.stub = stub; @@ -161,7 +172,6 @@ public final Debugger2Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public Debugger2Stub getStub() { return stub; } diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Settings.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Settings.java index 8a60096b..f3cf7f2c 100644 --- a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Settings.java +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/Debugger2Settings.java @@ -21,6 +21,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -127,11 +128,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return Debugger2StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return Debugger2StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return Debugger2StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return Debugger2StubSettings.defaultTransportChannelProvider(); } @@ -141,11 +149,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return Debugger2StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -183,6 +197,11 @@ private static Builder createDefault() { return new Builder(Debugger2StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(Debugger2StubSettings.newHttpJsonBuilder()); + } + public Debugger2StubSettings.Builder getStubSettingsBuilder() { return ((Debugger2StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/Controller2StubSettings.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/Controller2StubSettings.java index 794e4275..74152822 100644 --- a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/Controller2StubSettings.java +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/Controller2StubSettings.java @@ -24,6 +24,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; @@ -114,13 +117,17 @@ public class Controller2StubSettings extends StubSettings listDebugg return listDebuggeesSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public Debugger2Stub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDebugger2Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDebugger2Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -167,29 +174,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(Debugger2StubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(Debugger2StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return Debugger2StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -320,6 +352,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .setBreakpointSettings() diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2CallableFactory.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2CallableFactory.java new file mode 100644 index 00000000..f8cfbcba --- /dev/null +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2CallableFactory.java @@ -0,0 +1,105 @@ +/* + * 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.debugger.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Controller2 service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonController2CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2Stub.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2Stub.java new file mode 100644 index 00000000..92751077 --- /dev/null +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonController2Stub.java @@ -0,0 +1,321 @@ +/* + * 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.debugger.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.devtools.clouddebugger.v2.ListActiveBreakpointsRequest; +import com.google.devtools.clouddebugger.v2.ListActiveBreakpointsResponse; +import com.google.devtools.clouddebugger.v2.RegisterDebuggeeRequest; +import com.google.devtools.clouddebugger.v2.RegisterDebuggeeResponse; +import com.google.devtools.clouddebugger.v2.UpdateActiveBreakpointRequest; +import com.google.devtools.clouddebugger.v2.UpdateActiveBreakpointResponse; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Controller2 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonController2Stub extends Controller2Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + registerDebuggeeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Controller2/RegisterDebuggee") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/controller/debuggees/register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("*", request.toBuilder().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RegisterDebuggeeResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListActiveBreakpointsRequest, ListActiveBreakpointsResponse> + listActiveBreakpointsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.devtools.clouddebugger.v2.Controller2/ListActiveBreakpoints") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/controller/debuggees/{debuggeeId}/breakpoints", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "successOnTimeout", request.getSuccessOnTimeout()); + serializer.putQueryParam(fields, "waitToken", request.getWaitToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListActiveBreakpointsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateActiveBreakpointRequest, UpdateActiveBreakpointResponse> + updateActiveBreakpointMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.devtools.clouddebugger.v2.Controller2/UpdateActiveBreakpoint") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/controller/debuggees/{debuggeeId}/breakpoints/{breakpoint.id}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "breakpoint.id", request.getBreakpoint().getId()); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearDebuggeeId().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(UpdateActiveBreakpointResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + registerDebuggeeCallable; + private final UnaryCallable + listActiveBreakpointsCallable; + private final UnaryCallable + updateActiveBreakpointCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonController2Stub create(Controller2StubSettings settings) + throws IOException { + return new HttpJsonController2Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonController2Stub create(ClientContext clientContext) + throws IOException { + return new HttpJsonController2Stub( + Controller2StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonController2Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonController2Stub( + Controller2StubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonController2Stub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonController2Stub(Controller2StubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonController2CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonController2Stub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonController2Stub( + Controller2StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + registerDebuggeeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDebuggeeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listActiveBreakpointsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listActiveBreakpointsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateActiveBreakpointTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateActiveBreakpointMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.registerDebuggeeCallable = + callableFactory.createUnaryCallable( + registerDebuggeeTransportSettings, settings.registerDebuggeeSettings(), clientContext); + this.listActiveBreakpointsCallable = + callableFactory.createUnaryCallable( + listActiveBreakpointsTransportSettings, + settings.listActiveBreakpointsSettings(), + clientContext); + this.updateActiveBreakpointCallable = + callableFactory.createUnaryCallable( + updateActiveBreakpointTransportSettings, + settings.updateActiveBreakpointSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(registerDebuggeeMethodDescriptor); + methodDescriptors.add(listActiveBreakpointsMethodDescriptor); + methodDescriptors.add(updateActiveBreakpointMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable + registerDebuggeeCallable() { + return registerDebuggeeCallable; + } + + @Override + public UnaryCallable + listActiveBreakpointsCallable() { + return listActiveBreakpointsCallable; + } + + @Override + public UnaryCallable + updateActiveBreakpointCallable() { + return updateActiveBreakpointCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2CallableFactory.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2CallableFactory.java new file mode 100644 index 00000000..b4672f89 --- /dev/null +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2CallableFactory.java @@ -0,0 +1,105 @@ +/* + * 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.debugger.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Debugger2 service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDebugger2CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2Stub.java b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2Stub.java new file mode 100644 index 00000000..0a932336 --- /dev/null +++ b/google-cloud-debugger-client/src/main/java/com/google/cloud/debugger/v2/stub/HttpJsonDebugger2Stub.java @@ -0,0 +1,422 @@ +/* + * 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.debugger.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.devtools.clouddebugger.v2.DeleteBreakpointRequest; +import com.google.devtools.clouddebugger.v2.GetBreakpointRequest; +import com.google.devtools.clouddebugger.v2.GetBreakpointResponse; +import com.google.devtools.clouddebugger.v2.ListBreakpointsRequest; +import com.google.devtools.clouddebugger.v2.ListBreakpointsResponse; +import com.google.devtools.clouddebugger.v2.ListDebuggeesRequest; +import com.google.devtools.clouddebugger.v2.ListDebuggeesResponse; +import com.google.devtools.clouddebugger.v2.SetBreakpointRequest; +import com.google.devtools.clouddebugger.v2.SetBreakpointResponse; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Debugger2 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDebugger2Stub extends Debugger2Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + setBreakpointMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Debugger2/SetBreakpoint") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/debugger/debuggees/{debuggeeId}/breakpoints/set", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "clientVersion", request.getClientVersion()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("breakpoint", request.getBreakpoint())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SetBreakpointResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getBreakpointMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Debugger2/GetBreakpoint") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/debugger/debuggees/{debuggeeId}/breakpoints/{breakpointId}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "breakpointId", request.getBreakpointId()); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "clientVersion", request.getClientVersion()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GetBreakpointResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteBreakpointMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Debugger2/DeleteBreakpoint") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/debugger/debuggees/{debuggeeId}/breakpoints/{breakpointId}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "breakpointId", request.getBreakpointId()); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "clientVersion", request.getClientVersion()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listBreakpointsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Debugger2/ListBreakpoints") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/debugger/debuggees/{debuggeeId}/breakpoints", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "debuggeeId", request.getDebuggeeId()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "action", request.getAction()); + serializer.putQueryParam( + fields, "clientVersion", request.getClientVersion()); + serializer.putQueryParam( + fields, "includeAllUsers", request.getIncludeAllUsers()); + serializer.putQueryParam( + fields, "includeInactive", request.getIncludeInactive()); + serializer.putQueryParam( + fields, "stripResults", request.getStripResults()); + serializer.putQueryParam(fields, "waitToken", request.getWaitToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListBreakpointsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listDebuggeesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.devtools.clouddebugger.v2.Debugger2/ListDebuggees") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/debugger/debuggees", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "clientVersion", request.getClientVersion()); + serializer.putQueryParam( + fields, "includeInactive", request.getIncludeInactive()); + serializer.putQueryParam(fields, "project", request.getProject()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListDebuggeesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable setBreakpointCallable; + private final UnaryCallable getBreakpointCallable; + private final UnaryCallable deleteBreakpointCallable; + private final UnaryCallable + listBreakpointsCallable; + private final UnaryCallable listDebuggeesCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDebugger2Stub create(Debugger2StubSettings settings) + throws IOException { + return new HttpJsonDebugger2Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDebugger2Stub create(ClientContext clientContext) throws IOException { + return new HttpJsonDebugger2Stub( + Debugger2StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDebugger2Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDebugger2Stub( + Debugger2StubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDebugger2Stub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDebugger2Stub(Debugger2StubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDebugger2CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDebugger2Stub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDebugger2Stub( + Debugger2StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + setBreakpointTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setBreakpointMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getBreakpointTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getBreakpointMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteBreakpointTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteBreakpointMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listBreakpointsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listBreakpointsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listDebuggeesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listDebuggeesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.setBreakpointCallable = + callableFactory.createUnaryCallable( + setBreakpointTransportSettings, settings.setBreakpointSettings(), clientContext); + this.getBreakpointCallable = + callableFactory.createUnaryCallable( + getBreakpointTransportSettings, settings.getBreakpointSettings(), clientContext); + this.deleteBreakpointCallable = + callableFactory.createUnaryCallable( + deleteBreakpointTransportSettings, settings.deleteBreakpointSettings(), clientContext); + this.listBreakpointsCallable = + callableFactory.createUnaryCallable( + listBreakpointsTransportSettings, settings.listBreakpointsSettings(), clientContext); + this.listDebuggeesCallable = + callableFactory.createUnaryCallable( + listDebuggeesTransportSettings, settings.listDebuggeesSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(setBreakpointMethodDescriptor); + methodDescriptors.add(getBreakpointMethodDescriptor); + methodDescriptors.add(deleteBreakpointMethodDescriptor); + methodDescriptors.add(listBreakpointsMethodDescriptor); + methodDescriptors.add(listDebuggeesMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable setBreakpointCallable() { + return setBreakpointCallable; + } + + @Override + public UnaryCallable getBreakpointCallable() { + return getBreakpointCallable; + } + + @Override + public UnaryCallable deleteBreakpointCallable() { + return deleteBreakpointCallable; + } + + @Override + public UnaryCallable listBreakpointsCallable() { + return listBreakpointsCallable; + } + + @Override + public UnaryCallable listDebuggeesCallable() { + return listDebuggeesCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Controller2ClientHttpJsonTest.java b/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Controller2ClientHttpJsonTest.java new file mode 100644 index 00000000..74ee5dfe --- /dev/null +++ b/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Controller2ClientHttpJsonTest.java @@ -0,0 +1,250 @@ +/* + * 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.debugger.v2; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.debugger.v2.stub.HttpJsonController2Stub; +import com.google.devtools.clouddebugger.v2.Breakpoint; +import com.google.devtools.clouddebugger.v2.Debuggee; +import com.google.devtools.clouddebugger.v2.ListActiveBreakpointsResponse; +import com.google.devtools.clouddebugger.v2.RegisterDebuggeeResponse; +import com.google.devtools.clouddebugger.v2.SourceLocation; +import com.google.devtools.clouddebugger.v2.StackFrame; +import com.google.devtools.clouddebugger.v2.StatusMessage; +import com.google.devtools.clouddebugger.v2.UpdateActiveBreakpointResponse; +import com.google.devtools.clouddebugger.v2.Variable; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class Controller2ClientHttpJsonTest { + private static MockHttpService mockService; + private static Controller2Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonController2Stub.getMethodDescriptors(), + Controller2Settings.getDefaultEndpoint()); + Controller2Settings settings = + Controller2Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + Controller2Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = Controller2Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void registerDebuggeeTest() throws Exception { + RegisterDebuggeeResponse expectedResponse = + RegisterDebuggeeResponse.newBuilder().setDebuggee(Debuggee.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + Debuggee debuggee = Debuggee.newBuilder().build(); + + RegisterDebuggeeResponse actualResponse = client.registerDebuggee(debuggee); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDebuggeeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Debuggee debuggee = Debuggee.newBuilder().build(); + client.registerDebuggee(debuggee); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listActiveBreakpointsTest() throws Exception { + ListActiveBreakpointsResponse expectedResponse = + ListActiveBreakpointsResponse.newBuilder() + .addAllBreakpoints(new ArrayList()) + .setNextWaitToken("nextWaitToken1051070417") + .setWaitExpired(true) + .build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + + ListActiveBreakpointsResponse actualResponse = client.listActiveBreakpoints(debuggeeId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listActiveBreakpointsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + client.listActiveBreakpoints(debuggeeId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateActiveBreakpointTest() throws Exception { + UpdateActiveBreakpointResponse expectedResponse = + UpdateActiveBreakpointResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + Breakpoint breakpoint = + Breakpoint.newBuilder() + .setId("id-4047") + .setLocation(SourceLocation.newBuilder().build()) + .setCondition("condition-861311717") + .addAllExpressions(new ArrayList()) + .setLogMessageFormat("logMessageFormat-1136427526") + .setIsFinalState(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setFinalTime(Timestamp.newBuilder().build()) + .setUserEmail("userEmail315299473") + .setStatus(StatusMessage.newBuilder().build()) + .addAllStackFrames(new ArrayList()) + .addAllEvaluatedExpressions(new ArrayList()) + .addAllVariableTable(new ArrayList()) + .putAllLabels(new HashMap()) + .build(); + + UpdateActiveBreakpointResponse actualResponse = + client.updateActiveBreakpoint(debuggeeId, breakpoint); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateActiveBreakpointExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + Breakpoint breakpoint = + Breakpoint.newBuilder() + .setId("id-4047") + .setLocation(SourceLocation.newBuilder().build()) + .setCondition("condition-861311717") + .addAllExpressions(new ArrayList()) + .setLogMessageFormat("logMessageFormat-1136427526") + .setIsFinalState(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setFinalTime(Timestamp.newBuilder().build()) + .setUserEmail("userEmail315299473") + .setStatus(StatusMessage.newBuilder().build()) + .addAllStackFrames(new ArrayList()) + .addAllEvaluatedExpressions(new ArrayList()) + .addAllVariableTable(new ArrayList()) + .putAllLabels(new HashMap()) + .build(); + client.updateActiveBreakpoint(debuggeeId, breakpoint); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Debugger2ClientHttpJsonTest.java b/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Debugger2ClientHttpJsonTest.java new file mode 100644 index 00000000..333a9875 --- /dev/null +++ b/google-cloud-debugger-client/src/test/java/com/google/cloud/debugger/v2/Debugger2ClientHttpJsonTest.java @@ -0,0 +1,309 @@ +/* + * 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.debugger.v2; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.debugger.v2.stub.HttpJsonDebugger2Stub; +import com.google.devtools.clouddebugger.v2.Breakpoint; +import com.google.devtools.clouddebugger.v2.Debuggee; +import com.google.devtools.clouddebugger.v2.GetBreakpointResponse; +import com.google.devtools.clouddebugger.v2.ListBreakpointsResponse; +import com.google.devtools.clouddebugger.v2.ListDebuggeesResponse; +import com.google.devtools.clouddebugger.v2.SetBreakpointResponse; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class Debugger2ClientHttpJsonTest { + private static MockHttpService mockService; + private static Debugger2Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDebugger2Stub.getMethodDescriptors(), Debugger2Settings.getDefaultEndpoint()); + Debugger2Settings settings = + Debugger2Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + Debugger2Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = Debugger2Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void setBreakpointTest() throws Exception { + SetBreakpointResponse expectedResponse = + SetBreakpointResponse.newBuilder().setBreakpoint(Breakpoint.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + Breakpoint breakpoint = Breakpoint.newBuilder().build(); + String clientVersion = "clientVersion771880589"; + + SetBreakpointResponse actualResponse = + client.setBreakpoint(debuggeeId, breakpoint, clientVersion); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void setBreakpointExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + Breakpoint breakpoint = Breakpoint.newBuilder().build(); + String clientVersion = "clientVersion771880589"; + client.setBreakpoint(debuggeeId, breakpoint, clientVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getBreakpointTest() throws Exception { + GetBreakpointResponse expectedResponse = + GetBreakpointResponse.newBuilder().setBreakpoint(Breakpoint.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + String breakpointId = "breakpointId-3518"; + String clientVersion = "clientVersion771880589"; + + GetBreakpointResponse actualResponse = + client.getBreakpoint(debuggeeId, breakpointId, clientVersion); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getBreakpointExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + String breakpointId = "breakpointId-3518"; + String clientVersion = "clientVersion771880589"; + client.getBreakpoint(debuggeeId, breakpointId, clientVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteBreakpointTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + String breakpointId = "breakpointId-3518"; + String clientVersion = "clientVersion771880589"; + + client.deleteBreakpoint(debuggeeId, breakpointId, clientVersion); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteBreakpointExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + String breakpointId = "breakpointId-3518"; + String clientVersion = "clientVersion771880589"; + client.deleteBreakpoint(debuggeeId, breakpointId, clientVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listBreakpointsTest() throws Exception { + ListBreakpointsResponse expectedResponse = + ListBreakpointsResponse.newBuilder() + .addAllBreakpoints(new ArrayList()) + .setNextWaitToken("nextWaitToken1051070417") + .build(); + mockService.addResponse(expectedResponse); + + String debuggeeId = "debuggeeId-7253"; + String clientVersion = "clientVersion771880589"; + + ListBreakpointsResponse actualResponse = client.listBreakpoints(debuggeeId, clientVersion); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listBreakpointsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String debuggeeId = "debuggeeId-7253"; + String clientVersion = "clientVersion771880589"; + client.listBreakpoints(debuggeeId, clientVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDebuggeesTest() throws Exception { + ListDebuggeesResponse expectedResponse = + ListDebuggeesResponse.newBuilder().addAllDebuggees(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String project = "project-309310695"; + String clientVersion = "clientVersion771880589"; + + ListDebuggeesResponse actualResponse = client.listDebuggees(project, clientVersion); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDebuggeesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String project = "project-309310695"; + String clientVersion = "clientVersion771880589"; + client.listDebuggees(project, clientVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/proto-google-devtools-source-protos/pom.xml b/proto-google-devtools-source-protos/pom.xml index 21b10df5..cdd79e8c 100644 --- a/proto-google-devtools-source-protos/pom.xml +++ b/proto-google-devtools-source-protos/pom.xml @@ -18,10 +18,6 @@ com.google.protobuf protobuf-java - - com.google.api.grpc - proto-google-common-protos - diff --git a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContext.java b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContext.java index b799c162..d2aab0ad 100644 --- a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContext.java +++ b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContext.java @@ -329,7 +329,7 @@ public com.google.protobuf.ByteString getRevisionIdBytes() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return Whether the aliasName field is set. */ @java.lang.Deprecated @@ -346,7 +346,7 @@ public boolean hasAliasName() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The aliasName. */ @java.lang.Deprecated @@ -376,7 +376,7 @@ public java.lang.String getAliasName() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The bytes for aliasName. */ @java.lang.Deprecated @@ -1213,7 +1213,7 @@ public Builder setRevisionIdBytes(com.google.protobuf.ByteString value) { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return Whether the aliasName field is set. */ @java.lang.Override @@ -1231,7 +1231,7 @@ public boolean hasAliasName() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The aliasName. */ @java.lang.Override @@ -1262,7 +1262,7 @@ public java.lang.String getAliasName() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The bytes for aliasName. */ @java.lang.Override @@ -1293,7 +1293,7 @@ public com.google.protobuf.ByteString getAliasNameBytes() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @param value The aliasName to set. * @return This builder for chaining. */ @@ -1317,7 +1317,7 @@ public Builder setAliasName(java.lang.String value) { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return This builder for chaining. */ @java.lang.Deprecated @@ -1339,7 +1339,7 @@ public Builder clearAliasName() { * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @param value The bytes for aliasName to set. * @return This builder for chaining. */ diff --git a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContextOrBuilder.java b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContextOrBuilder.java index 908527e7..fcc774b2 100644 --- a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContextOrBuilder.java +++ b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/CloudRepoSourceContextOrBuilder.java @@ -105,7 +105,7 @@ public interface CloudRepoSourceContextOrBuilder * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return Whether the aliasName field is set. */ @java.lang.Deprecated @@ -120,7 +120,7 @@ public interface CloudRepoSourceContextOrBuilder * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The aliasName. */ @java.lang.Deprecated @@ -135,7 +135,7 @@ public interface CloudRepoSourceContextOrBuilder * string alias_name = 3 [deprecated = true]; * * @deprecated google.devtools.source.v1.CloudRepoSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=97 + * google/devtools/source/v1/source_context.proto;l=95 * @return The bytes for aliasName. */ @java.lang.Deprecated diff --git a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContext.java b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContext.java index bc854e6e..3ff0f916 100644 --- a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContext.java +++ b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContext.java @@ -385,7 +385,7 @@ public com.google.protobuf.ByteString getRevisionIdBytes() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return Whether the aliasName field is set. */ @java.lang.Deprecated @@ -402,7 +402,7 @@ public boolean hasAliasName() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The aliasName. */ @java.lang.Deprecated @@ -432,7 +432,7 @@ public java.lang.String getAliasName() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The bytes for aliasName. */ @java.lang.Deprecated @@ -1309,7 +1309,7 @@ public Builder setRevisionIdBytes(com.google.protobuf.ByteString value) { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return Whether the aliasName field is set. */ @java.lang.Override @@ -1327,7 +1327,7 @@ public boolean hasAliasName() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The aliasName. */ @java.lang.Override @@ -1358,7 +1358,7 @@ public java.lang.String getAliasName() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The bytes for aliasName. */ @java.lang.Override @@ -1389,7 +1389,7 @@ public com.google.protobuf.ByteString getAliasNameBytes() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @param value The aliasName to set. * @return This builder for chaining. */ @@ -1413,7 +1413,7 @@ public Builder setAliasName(java.lang.String value) { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return This builder for chaining. */ @java.lang.Deprecated @@ -1435,7 +1435,7 @@ public Builder clearAliasName() { * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @param value The bytes for aliasName to set. * @return This builder for chaining. */ diff --git a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContextOrBuilder.java b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContextOrBuilder.java index 20ea508d..d0913e23 100644 --- a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContextOrBuilder.java +++ b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/GerritSourceContextOrBuilder.java @@ -124,7 +124,7 @@ public interface GerritSourceContextOrBuilder * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return Whether the aliasName field is set. */ @java.lang.Deprecated @@ -139,7 +139,7 @@ public interface GerritSourceContextOrBuilder * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The aliasName. */ @java.lang.Deprecated @@ -154,7 +154,7 @@ public interface GerritSourceContextOrBuilder * string alias_name = 4 [deprecated = true]; * * @deprecated google.devtools.source.v1.GerritSourceContext.alias_name is deprecated. See - * google/devtools/source/v1/source_context.proto;l=131 + * google/devtools/source/v1/source_context.proto;l=129 * @return The bytes for aliasName. */ @java.lang.Deprecated diff --git a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/SourceContextProto.java b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/SourceContextProto.java index 2dca25c8..625948e7 100644 --- a/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/SourceContextProto.java +++ b/proto-google-devtools-source-protos/src/main/java/com/google/devtools/source/v1/SourceContextProto.java @@ -81,57 +81,53 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n.google/devtools/source/v1/source_conte" - + "xt.proto\022\031google.devtools.source.v1\032\034goo" - + "gle/api/annotations.proto\"\264\002\n\rSourceCont" - + "ext\022G\n\ncloud_repo\030\001 \001(\01321.google.devtool" - + "s.source.v1.CloudRepoSourceContextH\000\022Q\n\017" - + "cloud_workspace\030\002 \001(\01326.google.devtools." - + "source.v1.CloudWorkspaceSourceContextH\000\022" - + "@\n\006gerrit\030\003 \001(\0132..google.devtools.source" - + ".v1.GerritSourceContextH\000\022:\n\003git\030\006 \001(\0132+" - + ".google.devtools.source.v1.GitSourceCont" - + "extH\000B\t\n\007context\"\317\001\n\025ExtendedSourceConte" - + "xt\0229\n\007context\030\001 \001(\0132(.google.devtools.so" - + "urce.v1.SourceContext\022L\n\006labels\030\002 \003(\0132<." - + "google.devtools.source.v1.ExtendedSource" - + "Context.LabelsEntry\032-\n\013LabelsEntry\022\013\n\003ke" - + "y\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\214\001\n\014AliasCont" - + "ext\022:\n\004kind\030\001 \001(\0162,.google.devtools.sour" - + "ce.v1.AliasContext.Kind\022\014\n\004name\030\002 \001(\t\"2\n" - + "\004Kind\022\007\n\003ANY\020\000\022\t\n\005FIXED\020\001\022\013\n\007MOVABLE\020\002\022\t" - + "\n\005OTHER\020\004\"\313\001\n\026CloudRepoSourceContext\0222\n\007" - + "repo_id\030\001 \001(\0132!.google.devtools.source.v" - + "1.RepoId\022\025\n\013revision_id\030\002 \001(\tH\000\022\030\n\nalias" - + "_name\030\003 \001(\tB\002\030\001H\000\022@\n\ralias_context\030\004 \001(\013" - + "2\'.google.devtools.source.v1.AliasContex" - + "tH\000B\n\n\010revision\"u\n\033CloudWorkspaceSourceC" - + "ontext\022A\n\014workspace_id\030\001 \001(\0132+.google.de" - + "vtools.source.v1.CloudWorkspaceId\022\023\n\013sna" - + "pshot_id\030\002 \001(\t\"\276\001\n\023GerritSourceContext\022\020" - + "\n\010host_uri\030\001 \001(\t\022\026\n\016gerrit_project\030\002 \001(\t" - + "\022\025\n\013revision_id\030\003 \001(\tH\000\022\030\n\nalias_name\030\004 " - + "\001(\tB\002\030\001H\000\022@\n\ralias_context\030\005 \001(\0132\'.googl" - + "e.devtools.source.v1.AliasContextH\000B\n\n\010r" - + "evision\"4\n\020GitSourceContext\022\013\n\003url\030\001 \001(\t" - + "\022\023\n\013revision_id\030\002 \001(\t\"b\n\006RepoId\022C\n\017proje" - + "ct_repo_id\030\001 \001(\0132(.google.devtools.sourc" - + "e.v1.ProjectRepoIdH\000\022\r\n\003uid\030\002 \001(\tH\000B\004\n\002i" - + "d\"6\n\rProjectRepoId\022\022\n\nproject_id\030\001 \001(\t\022\021" - + "\n\trepo_name\030\002 \001(\t\"T\n\020CloudWorkspaceId\0222\n" - + "\007repo_id\030\001 \001(\0132!.google.devtools.source." - + "v1.RepoId\022\014\n\004name\030\002 \001(\tB\275\001\n\035com.google.d" - + "evtools.source.v1B\022SourceContextProtoP\001Z" - + "?google.golang.org/genproto/googleapis/d" - + "evtools/source/v1;source\370\001\001\252\002\037Google.Clo" - + "ud.DevTools.Source.V1\312\002\037Google\\Cloud\\Dev" - + "Tools\\Source\\V1b\006proto3" + + "xt.proto\022\031google.devtools.source.v1\"\264\002\n\r" + + "SourceContext\022G\n\ncloud_repo\030\001 \001(\01321.goog" + + "le.devtools.source.v1.CloudRepoSourceCon" + + "textH\000\022Q\n\017cloud_workspace\030\002 \001(\01326.google" + + ".devtools.source.v1.CloudWorkspaceSource" + + "ContextH\000\022@\n\006gerrit\030\003 \001(\0132..google.devto" + + "ols.source.v1.GerritSourceContextH\000\022:\n\003g" + + "it\030\006 \001(\0132+.google.devtools.source.v1.Git" + + "SourceContextH\000B\t\n\007context\"\317\001\n\025ExtendedS" + + "ourceContext\0229\n\007context\030\001 \001(\0132(.google.d" + + "evtools.source.v1.SourceContext\022L\n\006label" + + "s\030\002 \003(\0132<.google.devtools.source.v1.Exte" + + "ndedSourceContext.LabelsEntry\032-\n\013LabelsE" + + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\214\001\n" + + "\014AliasContext\022:\n\004kind\030\001 \001(\0162,.google.dev" + + "tools.source.v1.AliasContext.Kind\022\014\n\004nam" + + "e\030\002 \001(\t\"2\n\004Kind\022\007\n\003ANY\020\000\022\t\n\005FIXED\020\001\022\013\n\007M" + + "OVABLE\020\002\022\t\n\005OTHER\020\004\"\313\001\n\026CloudRepoSourceC" + + "ontext\0222\n\007repo_id\030\001 \001(\0132!.google.devtool" + + "s.source.v1.RepoId\022\025\n\013revision_id\030\002 \001(\tH" + + "\000\022\030\n\nalias_name\030\003 \001(\tB\002\030\001H\000\022@\n\ralias_con" + + "text\030\004 \001(\0132\'.google.devtools.source.v1.A" + + "liasContextH\000B\n\n\010revision\"u\n\033CloudWorksp" + + "aceSourceContext\022A\n\014workspace_id\030\001 \001(\0132+" + + ".google.devtools.source.v1.CloudWorkspac" + + "eId\022\023\n\013snapshot_id\030\002 \001(\t\"\276\001\n\023GerritSourc" + + "eContext\022\020\n\010host_uri\030\001 \001(\t\022\026\n\016gerrit_pro" + + "ject\030\002 \001(\t\022\025\n\013revision_id\030\003 \001(\tH\000\022\030\n\nali" + + "as_name\030\004 \001(\tB\002\030\001H\000\022@\n\ralias_context\030\005 \001" + + "(\0132\'.google.devtools.source.v1.AliasCont" + + "extH\000B\n\n\010revision\"4\n\020GitSourceContext\022\013\n" + + "\003url\030\001 \001(\t\022\023\n\013revision_id\030\002 \001(\t\"b\n\006RepoI" + + "d\022C\n\017project_repo_id\030\001 \001(\0132(.google.devt" + + "ools.source.v1.ProjectRepoIdH\000\022\r\n\003uid\030\002 " + + "\001(\tH\000B\004\n\002id\"6\n\rProjectRepoId\022\022\n\nproject_" + + "id\030\001 \001(\t\022\021\n\trepo_name\030\002 \001(\t\"T\n\020CloudWork" + + "spaceId\0222\n\007repo_id\030\001 \001(\0132!.google.devtoo" + + "ls.source.v1.RepoId\022\014\n\004name\030\002 \001(\tB\275\001\n\035co" + + "m.google.devtools.source.v1B\022SourceConte" + + "xtProtoP\001Z?google.golang.org/genproto/go" + + "ogleapis/devtools/source/v1;source\370\001\001\252\002\037" + + "Google.Cloud.DevTools.Source.V1\312\002\037Google" + + "\\Cloud\\DevTools\\Source\\V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.AnnotationsProto.getDescriptor(), - }); + descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); internal_static_google_devtools_source_v1_SourceContext_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_devtools_source_v1_SourceContext_fieldAccessorTable = @@ -222,7 +218,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "RepoId", "Name", }); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-devtools-source-protos/src/main/proto/google/devtools/source/v1/source_context.proto b/proto-google-devtools-source-protos/src/main/proto/google/devtools/source/v1/source_context.proto index 90b02c92..48e01de1 100644 --- a/proto-google-devtools-source-protos/src/main/proto/google/devtools/source/v1/source_context.proto +++ b/proto-google-devtools-source-protos/src/main/proto/google/devtools/source/v1/source_context.proto @@ -17,8 +17,6 @@ syntax = "proto3"; package google.devtools.source.v1; -import "google/api/annotations.proto"; - option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.DevTools.Source.V1"; option go_package = "google.golang.org/genproto/googleapis/devtools/source/v1;source";