Skip to content

Commit

Permalink
feat: Mark getDefaultEndpoint() with @ObsoleteApi (#2347)
Browse files Browse the repository at this point in the history
Client libraries no longer always use the default endpoint. The resolved
endpoint will be determined by the EndpointContext and used by the
client.
  • Loading branch information
lqiu96 authored Jul 12, 2024
1 parent 98b5bd7 commit e46648f
Show file tree
Hide file tree
Showing 34 changed files with 74 additions and 0 deletions.
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.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
import com.google.api.gax.batching.BatchingSettings;
import com.google.api.gax.batching.FlowControlSettings;
import com.google.api.gax.batching.FlowController.LimitExceededBehavior;
Expand Down Expand Up @@ -1190,6 +1191,12 @@ private List<MethodDefinition> createDefaultHelperAndGetterMethods(
.setReturnType(returnType)
.setName("getDefaultEndpoint")
.setReturnExpr(ValueExpr.withValue(StringObjectValue.withValue(service.defaultHost())))
.setAnnotations(
ImmutableList.of(
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get(ObsoleteApi.class.getSimpleName()))
.setDescription("Use getEndpoint() instead")
.build()))
.build());

// Create the getDefaultMtlsEndpoint method.
Expand Down Expand Up @@ -2068,6 +2075,7 @@ private static TypeStore createStaticTypes() {
List.class,
Lists.class,
MonitoredResourceDescriptor.class,
ObsoleteApi.class,
Operation.class,
OperationCallSettings.class,
OperationSnapshot.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.api.version.test.stub;

import com.google.api.core.ApiFunction;
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 @@ -91,6 +92,7 @@ public class EchoWithVersionStubSettings extends StubSettings<EchoWithVersionStu
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.testdata.v1.stub;

import com.google.api.core.ApiFunction;
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 @@ -107,6 +108,7 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import static com.google.showcase.v1beta1.EchoClient.SimplePagedExpandPagedRespo
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 @@ -291,6 +292,7 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import static com.google.logging.v2.LoggingServiceV2Client.ListMonitoredResource
import com.google.api.MonitoredResourceDescriptor;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ObsoleteApi;
import com.google.api.gax.batching.BatchingSettings;
import com.google.api.gax.batching.FlowControlSettings;
import com.google.api.gax.batching.FlowController;
Expand Down Expand Up @@ -433,6 +434,7 @@ public class LoggingServiceV2StubSettings extends StubSettings<LoggingServiceV2S
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "logging.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import static com.google.pubsub.v1.PublisherClient.ListTopicsPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ObsoleteApi;
import com.google.api.gax.batching.BatchingSettings;
import com.google.api.gax.batching.FlowControlSettings;
import com.google.api.gax.batching.FlowController;
Expand Down Expand Up @@ -442,6 +443,7 @@ public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "pubsub.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import static com.google.showcase.grpcrest.v1beta1.EchoClient.SimplePagedExpandP
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 @@ -307,6 +308,7 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.google.showcase.v1beta1.stub;

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 @@ -105,6 +106,7 @@ public class WickedStubSettings extends StubSettings<WickedStubSettings> {
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.google.showcase.v1beta1.stub;

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 @@ -137,6 +138,7 @@ public class ComplianceStubSettings extends StubSettings<ComplianceStubSettings>
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.api.version.test.stub;

import com.google.api.core.ApiFunction;
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 @@ -91,6 +92,7 @@ public class EchoWithVersionStubSettings extends StubSettings<EchoWithVersionStu
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
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 @@ -274,6 +275,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "localhost:7469";
}
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
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 @@ -194,6 +195,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "apigeeconnect.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.apigeeconnect.v1.stub;

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

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "apigeeconnect.googleapis.com:443";
}
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,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "cloudasset.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.bigtable.data.v2.stub;

import com.google.api.core.ApiFunction;
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 @@ -177,6 +178,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "bigtable.googleapis.com:443";
}
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.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 @@ -300,6 +301,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "compute.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.compute.v1small.stub;

import com.google.api.core.ApiFunction;
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 @@ -125,6 +126,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "compute.googleapis.com:443";
}
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 @@ -152,6 +153,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "iamcredentials.googleapis.com:443";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.iam.v1.stub;

import com.google.api.core.ApiFunction;
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 @@ -130,6 +131,7 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild
}

/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "iam-meta-api.googleapis.com:443";
}
Expand Down
Loading

0 comments on commit e46648f

Please sign in to comment.