diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java index c1e561e1a116..ddb60e977e77 100644 --- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java +++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java @@ -70,12 +70,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class ErrorGroupServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "clouderrorreporting.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -106,14 +100,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "clouderrorreporting.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -129,8 +118,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java index 20a233a7fba4..694db283b3d2 100644 --- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java +++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java @@ -83,12 +83,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class ErrorStatsServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "clouderrorreporting.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -131,14 +125,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "clouderrorreporting.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -154,8 +143,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java index 1aa849b37fca..372ce78d03ff 100644 --- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java +++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java @@ -69,12 +69,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class ReportErrorsServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "clouderrorreporting.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -101,14 +95,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "clouderrorreporting.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -124,8 +113,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1/LanguageServiceSettings.java index 9fb168334e29..2efab91f55de 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1/LanguageServiceSettings.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1/LanguageServiceSettings.java @@ -74,12 +74,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class LanguageServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "language.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -127,14 +121,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "language.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -150,8 +139,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta2/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta2/LanguageServiceSettings.java index a734059a9412..144b5bc80709 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta2/LanguageServiceSettings.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta2/LanguageServiceSettings.java @@ -76,12 +76,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class LanguageServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "language.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -137,14 +131,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "language.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -160,8 +149,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingOptions.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingOptions.java index 65998d5b0813..feb7cdcacac7 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingOptions.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingOptions.java @@ -34,8 +34,7 @@ public class LoggingOptions extends ServiceOptions { private static final String API_SHORT_NAME = "Logging"; private static final String LOGGING_SCOPE = "https://www.googleapis.com/auth/logging.admin"; private static final Set SCOPES = ImmutableSet.of(LOGGING_SCOPE); - private static final String DEFAULT_HOST = LoggingSettings.getDefaultServiceAddress() - + ':' + LoggingSettings.getDefaultServicePort(); + private static final String DEFAULT_HOST = LoggingSettings.getDefaultEndpoint(); private static final long serialVersionUID = 5753499510627426717L; public static class DefaultLoggingFactory implements LoggingFactory { diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigSettings.java index d6d78fc1dc6c..72fc086723ec 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigSettings.java @@ -81,12 +81,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class ConfigSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -143,14 +137,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "logging.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -166,8 +155,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingSettings.java index 831a65f88e38..6199d21d4532 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingSettings.java @@ -96,12 +96,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class LoggingSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -170,14 +164,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "logging.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -193,8 +182,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsSettings.java index a64d4b83f699..7606629adbe7 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsSettings.java @@ -81,12 +81,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class MetricsSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -145,14 +139,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "logging.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -168,8 +157,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/GroupServiceSettings.java b/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/GroupServiceSettings.java index c6fcfa942d01..efcf63783b42 100644 --- a/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/GroupServiceSettings.java +++ b/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/GroupServiceSettings.java @@ -85,12 +85,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class GroupServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "monitoring.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -156,14 +150,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "monitoring.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -179,8 +168,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/MetricServiceSettings.java b/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/MetricServiceSettings.java index 8972afdf9458..cb549bc18ed7 100644 --- a/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/MetricServiceSettings.java +++ b/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/spi/v3/MetricServiceSettings.java @@ -90,12 +90,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class MetricServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "monitoring.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -191,14 +185,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "monitoring.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -214,8 +203,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java index b6c311730d82..f46c5eb349c1 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java @@ -132,12 +132,16 @@ public void close() throws IOException { }); } + // TODO(pongad): remove this when we move to ManagedChannelBuilder + String defaultEndpoint = SubscriptionAdminSettings.getDefaultEndpoint(); + int colonPos = defaultEndpoint.indexOf(':'); + channelBuilder = builder.channelBuilder.isPresent() ? builder.channelBuilder.get() : NettyChannelBuilder.forAddress( - SubscriptionAdminSettings.getDefaultServiceAddress(), - SubscriptionAdminSettings.getDefaultServicePort()) + defaultEndpoint.substring(0, colonPos), + Integer.parseInt(defaultEndpoint.substring(colonPos+1))) .maxMessageSize(MAX_INBOUND_MESSAGE_SIZE) .flowControlWindow(5000000) // 2.5 MB .negotiationType(NegotiationType.TLS) diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriptionAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriptionAdminSettings.java index 137947897358..f28ca0cb58ef 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriptionAdminSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriptionAdminSettings.java @@ -102,12 +102,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class SubscriptionAdminSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -243,14 +237,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "pubsub.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -266,8 +255,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/TopicAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/TopicAdminSettings.java index 3d351be03466..9a98247b0985 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/TopicAdminSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/TopicAdminSettings.java @@ -101,12 +101,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class TopicAdminSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -192,14 +186,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "pubsub.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -215,8 +204,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1/SpeechSettings.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1/SpeechSettings.java index a1f8545775fa..db87fa0500b7 100644 --- a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1/SpeechSettings.java +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1/SpeechSettings.java @@ -74,12 +74,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class SpeechSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "speech.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -120,14 +114,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "speech.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -143,8 +132,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechClient.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechClient.java index 6da697beaccb..34618c5af1f6 100644 --- a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechClient.java +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechClient.java @@ -201,7 +201,7 @@ public final OperationsClient getOperationsClient() { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform synchronous speech-recognition: receive results after all audio has been sent and + * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * *

Sample code: @@ -222,9 +222,9 @@ public final OperationsClient getOperationsClient() { * } * * - * @param config [Required] The `config` message provides information to the recognizer that - * specifies how to process the request. - * @param audio [Required] The audio data to be recognized. + * @param config *Required* Provides information to the recognizer that specifies how to + * process the request. + * @param audio *Required* The audio data to be recognized. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final SyncRecognizeResponse syncRecognize( @@ -237,7 +237,7 @@ public final SyncRecognizeResponse syncRecognize( // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform synchronous speech-recognition: receive results after all audio has been sent and + * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * *

Sample code: @@ -271,7 +271,7 @@ public final SyncRecognizeResponse syncRecognize(SyncRecognizeRequest request) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform synchronous speech-recognition: receive results after all audio has been sent and + * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * *

Sample code: @@ -304,7 +304,8 @@ public final UnaryCallable syncReco // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform asynchronous speech-recognition: receive results via the google.longrunning.Operations + * Performs asynchronous speech recognition: receive results via the + * [google.longrunning.Operations] (/speech/reference/rest/v1beta1/operations#Operation) * interface. Returns either an `Operation.error` or an `Operation.response` which contains an * `AsyncRecognizeResponse` message. * @@ -326,9 +327,9 @@ public final UnaryCallable syncReco * } * * - * @param config [Required] The `config` message provides information to the recognizer that - * specifies how to process the request. - * @param audio [Required] The audio data to be recognized. + * @param config *Required* Provides information to the recognizer that specifies how to + * process the request. + * @param audio *Required* The audio data to be recognized. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final OperationFuture asyncRecognizeAsync( @@ -341,7 +342,8 @@ public final OperationFuture asyncRecognizeAsync( // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform asynchronous speech-recognition: receive results via the google.longrunning.Operations + * Performs asynchronous speech recognition: receive results via the + * [google.longrunning.Operations] (/speech/reference/rest/v1beta1/operations#Operation) * interface. Returns either an `Operation.error` or an `Operation.response` which contains an * `AsyncRecognizeResponse` message. * @@ -377,7 +379,8 @@ public final OperationFuture asyncRecognizeAsync( // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform asynchronous speech-recognition: receive results via the google.longrunning.Operations + * Performs asynchronous speech recognition: receive results via the + * [google.longrunning.Operations] (/speech/reference/rest/v1beta1/operations#Operation) * interface. Returns either an `Operation.error` or an `Operation.response` which contains an * `AsyncRecognizeResponse` message. * @@ -412,7 +415,8 @@ public final OperationFuture asyncRecognizeAsync( // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform asynchronous speech-recognition: receive results via the google.longrunning.Operations + * Performs asynchronous speech recognition: receive results via the + * [google.longrunning.Operations] (/speech/reference/rest/v1beta1/operations#Operation) * interface. Returns either an `Operation.error` or an `Operation.response` which contains an * `AsyncRecognizeResponse` message. * @@ -446,7 +450,7 @@ public final UnaryCallable asyncRecognizeCalla // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Perform bidirectional streaming speech-recognition: receive results while sending audio. This + * Performs bidirectional streaming speech recognition: receive results while sending audio. This * method is only available via the gRPC API (not REST). * *

Sample code: diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechSettings.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechSettings.java index a125449f2ab0..514ec5221f7b 100644 --- a/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechSettings.java +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/spi/v1beta1/SpeechSettings.java @@ -74,12 +74,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class SpeechSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "speech.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -121,14 +115,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "speech.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -144,8 +133,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-speech/src/test/java/com/google/cloud/speech/spi/v1/SpeechClientTest.java b/google-cloud-speech/src/test/java/com/google/cloud/speech/spi/v1/SpeechClientTest.java index c655d1b81f4c..60badf54b8a4 100644 --- a/google-cloud-speech/src/test/java/com/google/cloud/speech/spi/v1/SpeechClientTest.java +++ b/google-cloud-speech/src/test/java/com/google/cloud/speech/spi/v1/SpeechClientTest.java @@ -25,6 +25,7 @@ import com.google.cloud.speech.v1.LongRunningRecognizeResponse; import com.google.cloud.speech.v1.RecognitionAudio; import com.google.cloud.speech.v1.RecognitionConfig; +import com.google.cloud.speech.v1.RecognitionConfig.AudioEncoding; import com.google.cloud.speech.v1.RecognizeRequest; import com.google.cloud.speech.v1.RecognizeResponse; import com.google.cloud.speech.v1.StreamingRecognizeRequest; diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java index 892dd1d3449d..32fe957aafa7 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java @@ -79,12 +79,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class TraceServiceSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "cloudtrace.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() @@ -127,14 +121,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "cloudtrace.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -150,8 +139,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); } diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/spi/v1/ImageAnnotatorSettings.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/spi/v1/ImageAnnotatorSettings.java index 6857bbfd4841..e708b3cd54d6 100644 --- a/google-cloud-vision/src/main/java/com/google/cloud/vision/spi/v1/ImageAnnotatorSettings.java +++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/spi/v1/ImageAnnotatorSettings.java @@ -68,12 +68,6 @@ @Generated("by GAPIC v0.0.5") @ExperimentalApi public class ImageAnnotatorSettings extends ClientSettings { - /** The default address of the service. */ - private static final String DEFAULT_SERVICE_ADDRESS = "vision.googleapis.com"; - - /** The default port of the service. */ - private static final int DEFAULT_SERVICE_PORT = 443; - /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); @@ -100,14 +94,9 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild return InstantiatingExecutorProvider.newBuilder(); } - /** Returns the default service address. */ - public static String getDefaultServiceAddress() { - return DEFAULT_SERVICE_ADDRESS; - } - - /** Returns the default service port. */ - public static int getDefaultServicePort() { - return DEFAULT_SERVICE_PORT; + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "vision.googleapis.com:443"; } /** Returns the default service scopes. */ @@ -123,8 +112,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() { return InstantiatingChannelProvider.newBuilder() - .setServiceAddress(DEFAULT_SERVICE_ADDRESS) - .setPort(DEFAULT_SERVICE_PORT) + .setEndpoint(getDefaultEndpoint()) .setGeneratorHeader(DEFAULT_GAPIC_NAME, getGapicVersion()) .setCredentialsProvider(defaultCredentialsProviderBuilder().build()); }