Skip to content

Commit

Permalink
fix tabs on goldens
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielGonzalezDiaz committed Aug 16, 2021
1 parent afa5a8c commit 8866587
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 183 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jvm_maven_import_external(
# gapic-generator-java dependencies to match the order in googleapis repository,
# which in its turn, prioritizes actual generated clients runtime dependencies
# over the generator dependencies.
_gax_java_version = "1.65.1"
_gax_java_version = "2.2.0"

http_archive(
name = "com_google_api_gax_java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
import com.google.api.generator.engine.ast.AnnotationNode;
import com.google.api.generator.engine.ast.AssignmentExpr;
import com.google.api.generator.engine.ast.ConcreteReference;
import com.google.api.generator.engine.ast.Expr;
import com.google.api.generator.engine.ast.ExprStatement;
import com.google.api.generator.engine.ast.MethodDefinition;
import com.google.api.generator.engine.ast.MethodInvocationExpr;
import com.google.api.generator.engine.ast.NewObjectExpr;
import com.google.api.generator.engine.ast.ReferenceConstructorExpr;
import com.google.api.generator.engine.ast.Statement;
import com.google.api.generator.engine.ast.TypeNode;
import com.google.api.generator.engine.ast.ValueExpr;
import com.google.api.generator.engine.ast.VaporReference;
import com.google.api.generator.engine.ast.Variable;
import com.google.api.generator.engine.ast.VariableExpr;
Expand All @@ -41,12 +38,8 @@
import com.google.longrunning.Operation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;
import sun.reflect.generics.factory.GenericsFactory;

public class HttpJsonServiceCallableFactoryClassComposer
extends AbstractServiceCallableFactoryClassComposer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla

@Override
public <RequestT, ResponseT, PagedListResponseT>
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createPagedCallable(
httpJsonCallSettings, callSettings, clientContext);
}
Expand All @@ -76,11 +76,11 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
"The surface for long-running operations is not stable yet and may change in the future.")
@Override
public <RequestT, ResponseT, MetadataT>
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, ApiMessage> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
BackgroundResource operationsStub) {
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, ApiMessage> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
BackgroundResource operationsStub) {
UnaryCallable<RequestT, Operation> innerCallable =
HttpJsonCallableFactory.createBaseUnaryCallable(
httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,90 +64,90 @@
public class HttpJsonAddressesStub extends AddressesStub {
private static final ApiMethodDescriptor<AggregatedListAddressesRequest, AddressAggregatedList>
aggregatedListMethodDescriptor =
ApiMethodDescriptor.<AggregatedListAddressesRequest, AddressAggregatedList>newBuilder()
.setFullMethodName("google.cloud.compute.v1.Addresses/AggregatedList")
.setHttpMethod(HttpMethods.GET)
.setRequestFormatter(
ProtoMessageRequestFormatter.<AggregatedListAddressesRequest>newBuilder()
.setPath(
"/compute/v1/projects/{project}/aggregated/addresses",
new FieldsExtractor<
AggregatedListAddressesRequest, Map<String, String>>() {
@Override
public Map<String, String> extract(
AggregatedListAddressesRequest request) {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<AggregatedListAddressesRequest> serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "project", request.getProject());
return fields;
}
})
.setQueryParamsExtractor(
new FieldsExtractor<
AggregatedListAddressesRequest, Map<String, List<String>>>() {
@Override
public Map<String, List<String>> extract(
AggregatedListAddressesRequest request) {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<AggregatedListAddressesRequest> serializer =
ProtoRestSerializer.create();
if (request.hasFilter()) {
serializer.putQueryParam(fields, "filter", request.getFilter());
}
if (request.hasIncludeAllScopes()) {
serializer.putQueryParam(
fields, "includeAllScopes", request.getIncludeAllScopes());
}
if (request.hasMaxResults()) {
serializer.putQueryParam(
fields, "maxResults", request.getMaxResults());
}
if (request.hasOrderBy()) {
serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
}
if (request.hasPageToken()) {
serializer.putQueryParam(
fields, "pageToken", request.getPageToken());
}
return fields;
}
})
.setRequestBodyExtractor(
new FieldsExtractor<AggregatedListAddressesRequest, String>() {
@Override
public String extract(AggregatedListAddressesRequest request) {
return null;
}
})
.build())
.setResponseParser(
ProtoMessageResponseParser.<AddressAggregatedList>newBuilder()
.setDefaultInstance(AddressAggregatedList.getDefaultInstance())
.build())
.setOperationSnapshotFactory(
(AggregatedListAddressesRequest request, AddressAggregatedList response) -> {
StringBuilder opName = new StringBuilder(response.getId());
opName.append(":").append(request.getProject());
opName.append(":").append(request.getRegion());
return HttpJsonOperationSnapshot.newBuilder()
.setName(opName.toString())
.setMetadata(response)
.setDone(response.getStatus().equals(Status.DONE))
.setResponse(response)
.setError(response.getHttpErrorStatusCode(), response.getHttpErrorMessage())
.build();
})
.setPollingRequestFactory(
compoundOperationId -> {
List<String> idComponents = Arrays.asList(compoundOperationId.split(":"));
return GetRegionOperationRequest.newBuilder()
.setOperation(idComponents.get(0))
.setProject(idComponents.get(1))
.setRegion(idComponents.get(2))
.build();
})
.build();
ApiMethodDescriptor.<AggregatedListAddressesRequest, AddressAggregatedList>newBuilder()
.setFullMethodName("google.cloud.compute.v1.Addresses/AggregatedList")
.setHttpMethod(HttpMethods.GET)
.setRequestFormatter(
ProtoMessageRequestFormatter.<AggregatedListAddressesRequest>newBuilder()
.setPath(
"/compute/v1/projects/{project}/aggregated/addresses",
new FieldsExtractor<
AggregatedListAddressesRequest, Map<String, String>>() {
@Override
public Map<String, String> extract(
AggregatedListAddressesRequest request) {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<AggregatedListAddressesRequest> serializer =
ProtoRestSerializer.create();
serializer.putPathParam(fields, "project", request.getProject());
return fields;
}
})
.setQueryParamsExtractor(
new FieldsExtractor<
AggregatedListAddressesRequest, Map<String, List<String>>>() {
@Override
public Map<String, List<String>> extract(
AggregatedListAddressesRequest request) {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<AggregatedListAddressesRequest> serializer =
ProtoRestSerializer.create();
if (request.hasFilter()) {
serializer.putQueryParam(fields, "filter", request.getFilter());
}
if (request.hasIncludeAllScopes()) {
serializer.putQueryParam(
fields, "includeAllScopes", request.getIncludeAllScopes());
}
if (request.hasMaxResults()) {
serializer.putQueryParam(
fields, "maxResults", request.getMaxResults());
}
if (request.hasOrderBy()) {
serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
}
if (request.hasPageToken()) {
serializer.putQueryParam(
fields, "pageToken", request.getPageToken());
}
return fields;
}
})
.setRequestBodyExtractor(
new FieldsExtractor<AggregatedListAddressesRequest, String>() {
@Override
public String extract(AggregatedListAddressesRequest request) {
return null;
}
})
.build())
.setResponseParser(
ProtoMessageResponseParser.<AddressAggregatedList>newBuilder()
.setDefaultInstance(AddressAggregatedList.getDefaultInstance())
.build())
.setOperationSnapshotFactory(
(AggregatedListAddressesRequest request, AddressAggregatedList response) -> {
StringBuilder opName = new StringBuilder(response.getId());
opName.append(":").append(request.getProject());
opName.append(":").append(request.getRegion());
return HttpJsonOperationSnapshot.newBuilder()
.setName(opName.toString())
.setMetadata(response)
.setDone(response.getStatus().equals(Status.DONE))
.setResponse(response)
.setError(response.getHttpErrorStatusCode(), response.getHttpErrorMessage())
.build();
})
.setPollingRequestFactory(
compoundOperationId -> {
List<String> idComponents = Arrays.asList(compoundOperationId.split(":"));
return GetRegionOperationRequest.newBuilder()
.setOperation(idComponents.get(0))
.setProject(idComponents.get(1))
.setRegion(idComponents.get(2))
.build();
})
.build();

private static final ApiMethodDescriptor<DeleteAddressRequest, Operation> deleteMethodDescriptor =
ApiMethodDescriptor.<DeleteAddressRequest, Operation>newBuilder()
Expand Down Expand Up @@ -413,9 +413,9 @@ protected HttpJsonAddressesStub(

HttpJsonCallSettings<AggregatedListAddressesRequest, AddressAggregatedList>
aggregatedListTransportSettings =
HttpJsonCallSettings.<AggregatedListAddressesRequest, AddressAggregatedList>newBuilder()
.setMethodDescriptor(aggregatedListMethodDescriptor)
.build();
HttpJsonCallSettings.<AggregatedListAddressesRequest, AddressAggregatedList>newBuilder()
.setMethodDescriptor(aggregatedListMethodDescriptor)
.build();
HttpJsonCallSettings<DeleteAddressRequest, Operation> deleteTransportSettings =
HttpJsonCallSettings.<DeleteAddressRequest, Operation>newBuilder()
.setMethodDescriptor(deleteMethodDescriptor)
Expand Down Expand Up @@ -464,13 +464,13 @@ public static List<ApiMethodDescriptor> getMethodDescriptors() {

@Override
public UnaryCallable<AggregatedListAddressesRequest, AddressAggregatedList>
aggregatedListCallable() {
aggregatedListCallable() {
return aggregatedListCallable;
}

@Override
public UnaryCallable<AggregatedListAddressesRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable() {
aggregatedListPagedCallable() {
return aggregatedListPagedCallable;
}

Expand All @@ -496,7 +496,13 @@ public UnaryCallable<ListAddressesRequest, ListPagedResponse> listPagedCallable(

@Override
public final void close() {
shutdown();
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla

@Override
public <RequestT, ResponseT, PagedListResponseT>
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createPagedCallable(
httpJsonCallSettings, callSettings, clientContext);
}
Expand All @@ -76,11 +76,11 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
"The surface for long-running operations is not stable yet and may change in the future.")
@Override
public <RequestT, ResponseT, MetadataT>
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, ApiMessage> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
BackgroundResource operationsStub) {
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, ApiMessage> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
BackgroundResource operationsStub) {
UnaryCallable<RequestT, Operation> innerCallable =
HttpJsonCallableFactory.createBaseUnaryCallable(
httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
Expand Down
Loading

0 comments on commit 8866587

Please sign in to comment.