Skip to content

Commit

Permalink
feat: Mark getDefaultEndpoint with @ObsoleteApi
Browse files Browse the repository at this point in the history
  • Loading branch information
lqiu96 committed Jan 5, 2024
1 parent 0cd9c0c commit 7cf57ca
Show file tree
Hide file tree
Showing 33 changed files with 93 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.api.generator.engine.ast;

import com.google.api.core.ObsoleteApi;
import com.google.auto.value.AutoValue;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
Expand All @@ -28,8 +27,6 @@ public abstract class AnnotationNode implements AstNode {
AnnotationNode.builder().setType(annotationType(Override.class)).build();
public static AnnotationNode DEPRECATED =
AnnotationNode.builder().setType(annotationType(Deprecated.class)).build();
public static AnnotationNode OBSOLETE_API =
AnnotationNode.builder().setType(annotationType(ObsoleteApi.class)).build();

private static TypeNode annotationType(Class<?> clazz) {
return TypeNode.withReference(ConcreteReference.withClazz(clazz));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,13 @@ private List<MethodDefinition> createDefaultHelperAndGetterMethods(
.setReturnType(returnType)
.setName("getDefaultEndpoint")
.setReturnExpr(ValueExpr.withValue(StringObjectValue.withValue(service.defaultHost())))
.setAnnotations(ImmutableList.of(AnnotationNode.OBSOLETE_API))
.setAnnotations(
ImmutableList.of(
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get(ObsoleteApi.class.getSimpleName()))
.setDescription(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
.build()))
.build());

// Create the getDefaultMtlsEndpoint method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ public class LoggingServiceV2StubSettings extends StubSettings<LoggingServiceV2S
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "logging.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "pubsub.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public class WickedStubSettings extends StubSettings<WickedStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public class ComplianceStubSettings extends StubSettings<ComplianceStubSettings>
}

/** Returns the default service endpoint. */
@ObsoleteApi
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -279,6 +280,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -516,7 +519,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -529,7 +531,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -438,6 +439,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -696,7 +699,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -709,7 +711,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -309,6 +310,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -524,7 +527,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -537,7 +539,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -451,6 +452,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -732,7 +735,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -745,7 +747,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -274,6 +275,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -507,7 +510,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -520,7 +522,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -391,6 +392,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down Expand Up @@ -612,7 +615,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -625,7 +627,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -194,6 +195,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "apigeeconnect.googleapis.com:443";
}
Expand Down Expand Up @@ -349,7 +352,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -362,7 +364,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

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

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -114,6 +115,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "apigeeconnect.googleapis.com:443";
}
Expand Down Expand Up @@ -229,7 +232,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
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 @@ -583,6 +584,8 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi(
"See https://github.com/googleapis/sdk-platform-java/issues/2346 for more information")
public static String getDefaultEndpoint() {
return "cloudasset.googleapis.com:443";
}
Expand Down Expand Up @@ -963,7 +966,6 @@ private static Builder createDefault() {
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand All @@ -976,7 +978,6 @@ private static Builder createHttpJsonDefault() {
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

Expand Down
Loading

0 comments on commit 7cf57ca

Please sign in to comment.