Skip to content

Commit

Permalink
chore: remove beta client LRO (#2497)
Browse files Browse the repository at this point in the history
Fixes #2103 ☕️
  • Loading branch information
JoeWang1127 authored Feb 22, 2024
1 parent 49e4eb0 commit fc18449
Show file tree
Hide file tree
Showing 29 changed files with 3 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,6 @@ private static MethodDefinition createMethodDefaultMethod(
.copyAndSetGenerics(
Arrays.asList(
lro.responseType().reference(), lro.metadataType().reference())));
if (method.lro().operationServiceStubType() != null) {
annotations.add(
AnnotationNode.withTypeAndDescription(
typeStore.get("BetaApi"),
"The surface for long-running operations is not stable yet and may change in the"
+ " future."));
}
}

// Construct the method that accepts a request proto.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private List<MethodDefinition> createLongRunningClientGetters(TypeStore typeStor
createCallableGetterMethodDefinition(
TypeNode.withReference(ConcreteReference.withClazz(LongRunningClient.class)),
"longRunningClient",
ImmutableList.of(AnnotationNode.withType(typeStore.get("BetaApi"))),
Collections.emptyList(),
typeStore));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2023,27 +2023,14 @@ private static List<MethodDefinition> createNestedClassSettingsBuilderGetterMeth
t.reference()
.copyAndSetGenerics(ImmutableList.of())
.equals(operationCallSettingsBuilderRef);
AnnotationNode lroBetaAnnotation =
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get("BetaApi"))
.setDescription(
"The surface for use by generated code is not stable yet and may change in the"
+ " future.")
.build();
AnnotationNode deprecatedAnnotation = AnnotationNode.withType(TypeNode.DEPRECATED);

List<MethodDefinition> javaMethods = new ArrayList<>();
for (Map.Entry<String, VariableExpr> settingsVarEntry :
nestedMethodSettingsMemberVarExprs.entrySet()) {
String varName = settingsVarEntry.getKey();
VariableExpr settingsVarExpr = settingsVarEntry.getValue();
boolean isOperationCallSettings =
isOperationCallSettingsBuilderFn.apply(settingsVarExpr.type());

List<AnnotationNode> annotations = new ArrayList<>();
if (isOperationCallSettings) {
annotations.add(lroBetaAnnotation);
}

boolean isDeprecated = nestedDeprecatedSettingVarNames.contains(varName);
if (isDeprecated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
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.ExprStatement;
Expand All @@ -36,6 +35,7 @@
import com.google.longrunning.Operation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -55,20 +55,6 @@ public static HttpJsonServiceCallableFactoryClassComposer instance() {
return INSTANCE;
}

@Override
protected List<AnnotationNode> createClassAnnotations(Service service, TypeStore typeStore) {
List<AnnotationNode> annotations = super.createClassAnnotations(service, typeStore);
// Always add @BetaApi annotation to the generated CallableFactory for now. It is a public class
// for technical reasons, end users are not expected to interact with it, but it may change
// when we add LRO support, that is why making it @BetaApi for now.
//
// Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized.
if (annotations.stream().noneMatch(a -> a.type().equals(typeStore.get("BetaApi")))) {
annotations.add(AnnotationNode.withType(typeStore.get("BetaApi")));
}
return annotations;
}

@Override
protected List<TypeNode> createClassImplements(Service service, TypeStore typeStore) {
TypeNode operationsStubType = getOperationsStubType(service);
Expand Down Expand Up @@ -104,16 +90,6 @@ protected MethodDefinition createOperationCallableMethod(Service service, TypeSt
List<String> methodTemplateNames =
Arrays.asList(requestTemplateName, responseTemplateName, "MetadataT");

// Always add @BetaApi annotation to the generated createOperationCallable() method for now,
// until LRO is fully implemented.
//
// Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized.
AnnotationNode betaAnnotation =
AnnotationNode.withTypeAndDescription(
typeStore.get("BetaApi"),
"The surface for long-running operations is not stable yet and may change in the"
+ " future.");

// Generate generic method without the body
TypeNode operationType = service.operationType();
if (operationType == null) {
Expand All @@ -133,7 +109,7 @@ protected MethodDefinition createOperationCallableMethod(Service service, TypeSt
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Arrays.asList(betaAnnotation));
Collections.emptyList());

List<Statement> createOperationCallableBody = new ArrayList<>();
List<VariableExpr> arguments = new ArrayList<>(method.arguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,6 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the builder for the settings used for calls to wait. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<WaitRequest, WaitResponse, WaitMetadata>
waitOperationSettings() {
return waitOperationSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,6 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the builder for the settings used for calls to wait. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<WaitRequest, WaitResponse, WaitMetadata>
waitOperationSettings() {
return waitOperationSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public class HttpJsonEchoCallableFactory
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public class HttpJsonComplianceCallableFactory
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,6 @@ public UnaryCallSettings.Builder<WaitRequest, Operation> waitSettings() {
}

/** Returns the builder for the settings used for calls to wait. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<WaitRequest, WaitResponse, WaitMetadata>
waitOperationSettings() {
return waitOperationSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,6 @@ public UnaryCallSettings.Builder<SearchBlurbsRequest, Operation> searchBlurbsSet
}

/** Returns the builder for the settings used for calls to searchBlurbs. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
SearchBlurbsRequest, SearchBlurbsResponse, SearchBlurbsMetadata>
searchBlurbsOperationSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.apigeeconnect.v1.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;
Expand All @@ -41,7 +40,6 @@
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonConnectionServiceCallableFactory
implements HttpJsonStubCallableFactory<Operation, OperationsStub> {

Expand Down Expand Up @@ -73,8 +71,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,6 @@ public UnaryCallSettings.Builder<ExportAssetsRequest, Operation> exportAssetsSet
}

/** Returns the builder for the settings used for calls to exportAssets. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
exportAssetsOperationSettings() {
Expand Down Expand Up @@ -1238,8 +1236,6 @@ public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings()
}

/** Returns the builder for the settings used for calls to analyzeIamPolicyLongrunning. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
AnalyzeIamPolicyLongrunningRequest,
AnalyzeIamPolicyLongrunningResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.asset.v1.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;
Expand All @@ -41,7 +40,6 @@
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonAssetServiceCallableFactory
implements HttpJsonStubCallableFactory<Operation, OperationsStub> {

Expand Down Expand Up @@ -73,8 +71,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
Expand Down Expand Up @@ -442,8 +441,6 @@ public final OperationFuture<Operation, Operation> deleteAsync(
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Operation, Operation> deleteAsync(DeleteAddressRequest request) {
return deleteOperationCallable().futureCall(request);
}
Expand Down Expand Up @@ -573,8 +570,6 @@ public final OperationFuture<Operation, Operation> insertAsync(
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Operation, Operation> insertAsync(InsertAddressRequest request) {
return insertOperationCallable().futureCall(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
Expand Down Expand Up @@ -579,8 +578,6 @@ public UnaryCallSettings.Builder<DeleteAddressRequest, Operation> deleteSettings
}

/** Returns the builder for the settings used for calls to delete. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<DeleteAddressRequest, Operation, Operation>
deleteOperationSettings() {
return deleteOperationSettings;
Expand All @@ -592,8 +589,6 @@ public UnaryCallSettings.Builder<InsertAddressRequest, Operation> insertSettings
}

/** Returns the builder for the settings used for calls to insert. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<InsertAddressRequest, Operation, Operation>
insertOperationSettings() {
return insertOperationSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.compute.v1small.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;
Expand All @@ -40,7 +39,6 @@
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonAddressesCallableFactory
implements HttpJsonStubCallableFactory<Operation, RegionOperationsStub> {

Expand Down Expand Up @@ -72,8 +70,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.compute.v1small.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;
Expand All @@ -41,7 +40,6 @@
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonRegionOperationsCallableFactory
implements HttpJsonStubCallableFactory<Operation, OperationsStub> {

Expand Down Expand Up @@ -73,8 +71,6 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}

@BetaApi(
"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(
Expand Down
Loading

0 comments on commit fc18449

Please sign in to comment.