diff --git a/gcloud-java-core/pom.xml b/gcloud-java-core/pom.xml index c09367fccddf..4cfb7b84b066 100644 --- a/gcloud-java-core/pom.xml +++ b/gcloud-java-core/pom.xml @@ -106,12 +106,12 @@ com.google.api gax - 0.0.13 + 0.0.14 com.google.api.grpc - grpc-core-proto - 0.0.4 + grpc-google-common-protos + 0.0.7 diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java index bc0eec93e22b..8352fff2b838 100644 --- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java +++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_config.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.PageAccessor; @@ -51,20 +31,19 @@ import java.util.List; import java.util.concurrent.ScheduledExecutorService; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND SERVICE /** - * Service Description: + * Service Description: Service for configuring sinks used to export log entries outside Stackdriver + * Logging. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

  * 
- * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
- *   ListSinksResponse response = configServiceV2Api.listSinks(formattedProjectName);
+ * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+ *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
+ *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
  * }
  * 
  * 
@@ -104,9 +83,6 @@ * ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create(configServiceV2Settings); * * - * - * - * */ @javax.annotation.Generated("by GAPIC") public class ConfigServiceV2Api implements AutoCloseable { @@ -126,7 +102,7 @@ public final ConfigServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate SINK_PATH_TEMPLATE = @@ -134,43 +110,33 @@ public final ConfigServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a sink resource. - * - * - * */ public static final String formatSinkName(String project, String sink) { - return SINK_PATH_TEMPLATE.instantiate("project", project, "sink", sink); + return SINK_PATH_TEMPLATE.instantiate( + "project", project, + "sink", sink); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a sink resource. - * - * - * */ public static final String parseProjectFromSinkName(String sinkName) { return SINK_PATH_TEMPLATE.parse(sinkName).get("project"); @@ -179,9 +145,6 @@ public static final String parseProjectFromSinkName(String sinkName) { /** * Parses the sink from the given fully-qualified path which * represents a sink resource. - * - * - * */ public static final String parseSinkFromSinkName(String sinkName) { return SINK_PATH_TEMPLATE.parse(sinkName).get("sink"); @@ -189,11 +152,8 @@ public static final String parseSinkFromSinkName(String sinkName) { /** * Constructs an instance of ConfigServiceV2Api with default settings. - * - * - * */ - public static final ConfigServiceV2Api createWithDefaults() throws IOException { + public static final ConfigServiceV2Api create() throws IOException { return create(ConfigServiceV2Settings.defaultBuilder().build()); } @@ -201,9 +161,6 @@ public static final ConfigServiceV2Api createWithDefaults() throws IOException { * Constructs an instance of ConfigServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final ConfigServiceV2Api create(ConfigServiceV2Settings settings) throws IOException { @@ -214,9 +171,6 @@ public static final ConfigServiceV2Api create(ConfigServiceV2Settings settings) * Constructs an instance of ConfigServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected ConfigServiceV2Api(ConfigServiceV2Settings settings) throws IOException { this.settings = settings; @@ -256,55 +210,47 @@ public void close() throws IOException { } } - // ----- listSinks ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
-   *   for (LogSink elements : configServiceV2Api.listSinks(formattedProjectName)) {
-   *     // doThingsWith(elements);
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
+   *   for (LogSink element : configServiceV2Api.listSinks(formattedParent)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * - * @param projectName Required. The resource name of the project containing the sinks. - * Example: `"projects/my-logging-project"`, `"projects/01234567890"`. + * @param parent Required. The resource name containing the sinks. + * Example: `"projects/my-logging-project"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final PageAccessor listSinks(String projectName) { - PROJECT_PATH_TEMPLATE.validate(projectName); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(projectName).build(); + public final PageAccessor listSinks(String parent) { + PARENT_PATH_TEMPLATE.validate(parent, "listSinks"); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build(); return listSinks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
-   *   for (LogSink elements : configServiceV2Api.listSinks(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogSink element : configServiceV2Api.listSinks(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -312,47 +258,44 @@ public final PageAccessor listSinks(ListSinksRequest request) { return listSinksPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   ListenableFuture<PageAccessor<LogSink>> future = configServiceV2Api.listSinksPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogSink elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogSink element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listSinksPagedCallable() { return listSinksPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   while (true) {
    *     ListSinksResponse response = configServiceV2Api.listSinksCallable().call(request);
-   *     for (LogSink elements : response.getSinksList()) {
-   *       // doThingsWith(elements);
+   *     for (LogSink element : response.getSinksList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -363,48 +306,40 @@ public final ApiCallable> listSinksPaged
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listSinksCallable() { return listSinksCallable; } - // ----- getSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to return. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogSink getSink(String sinkName) { - SINK_PATH_TEMPLATE.validate(sinkName); + SINK_PATH_TEMPLATE.validate(sinkName, "getSink"); GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(sinkName).build(); return getSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   GetSinkRequest request = GetSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -413,23 +348,20 @@ public final LogSink getSink(String sinkName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private LogSink getSink(GetSinkRequest request) { + private final LogSink getSink(GetSinkRequest request) { return getSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   GetSinkRequest request = GetSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -439,33 +371,25 @@ private LogSink getSink(GetSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable getSinkCallable() { return getSinkCallable; } - // ----- createSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configServiceV2Api.createSink(formattedProjectName, sink);
+   *   LogSink response = configServiceV2Api.createSink(formattedParent, sink);
    * }
    * 
* - * - * - * - * @param projectName The resource name of the project in which to create the sink. + * @param parent The resource in which to create the sink. * Example: `"projects/my-project-id"`. * * The new sink must be provided in the request. @@ -473,52 +397,48 @@ public final ApiCallable getSinkCallable() { * exists. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final LogSink createSink(String projectName, LogSink sink) { - PROJECT_PATH_TEMPLATE.validate(projectName); - + public final LogSink createSink(String parent, LogSink sink) { + PARENT_PATH_TEMPLATE.validate(parent, "createSink"); CreateSinkRequest request = - CreateSinkRequest.newBuilder().setProjectName(projectName).setSink(sink).build(); + CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build(); return createSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   CreateSinkRequest request = CreateSinkRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setSink(sink)
    *     .build();
    *   LogSink response = configServiceV2Api.createSink(request);
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogSink createSink(CreateSinkRequest request) { + public final LogSink createSink(CreateSinkRequest request) { return createSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   CreateSinkRequest request = CreateSinkRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setSink(sink)
    *     .build();
    *   ListenableFuture<LogSink> future = configServiceV2Api.createSinkCallable().futureCall(request);
@@ -526,32 +446,24 @@ public LogSink createSink(CreateSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable createSinkCallable() { return createSinkCallable; } - // ----- updateSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   LogSink response = configServiceV2Api.updateSink(formattedSinkName, sink);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to update. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @@ -564,20 +476,19 @@ public final ApiCallable createSinkCallable() { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogSink updateSink(String sinkName, LogSink sink) { - SINK_PATH_TEMPLATE.validate(sinkName); - + SINK_PATH_TEMPLATE.validate(sinkName, "updateSink"); UpdateSinkRequest request = UpdateSinkRequest.newBuilder().setSinkName(sinkName).setSink(sink).build(); return updateSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
@@ -588,23 +499,20 @@ public final LogSink updateSink(String sinkName, LogSink sink) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogSink updateSink(UpdateSinkRequest request) { + public final LogSink updateSink(UpdateSinkRequest request) { return updateSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
@@ -616,48 +524,40 @@ public LogSink updateSink(UpdateSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable updateSinkCallable() { return updateSinkCallable; } - // ----- deleteSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   configServiceV2Api.deleteSink(formattedSinkName);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to delete. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteSink(String sinkName) { - SINK_PATH_TEMPLATE.validate(sinkName); + SINK_PATH_TEMPLATE.validate(sinkName, "deleteSink"); DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(sinkName).build(); deleteSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -666,23 +566,20 @@ public final void deleteSink(String sinkName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteSink(DeleteSinkRequest request) { + private final void deleteSink(DeleteSinkRequest request) { deleteSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -692,9 +589,6 @@ private void deleteSink(DeleteSinkRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteSinkCallable() { return deleteSinkCallable; @@ -703,9 +597,6 @@ public final ApiCallable deleteSinkCallable() { /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -713,9 +604,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java index 9c1558fec565..39215faeef26 100644 --- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java +++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_config.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.ConnectionSettings; @@ -62,9 +42,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link ConfigServiceV2Api}. * @@ -79,13 +57,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of ListSinks to 30 seconds: + * object. For example, to set the total timeout of getSink to 30 seconds: * *

  * 
  * ConfigServiceV2Settings.Builder configServiceV2SettingsBuilder =
  *     ConfigServiceV2Settings.defaultBuilder();
- * configServiceV2SettingsBuilder.ListSinksSettings().getRetrySettingsBuilder()
+ * configServiceV2SettingsBuilder.getSinkSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * ConfigServiceV2Settings configServiceV2Settings = configServiceV2SettingsBuilder.build();
  * 
@@ -93,33 +71,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class ConfigServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -134,7 +105,6 @@ public class ConfigServiceV2Settings extends ServiceApiSettings {
 
   private final PageStreamingCallSettings
       listSinksSettings;
-
   private final SimpleCallSettings getSinkSettings;
   private final SimpleCallSettings createSinkSettings;
   private final SimpleCallSettings updateSinkSettings;
@@ -176,6 +146,27 @@ public SimpleCallSettings deleteSinkSettings() {
     return deleteSinkSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -307,6 +298,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .listSinksSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
index 70960a025987..be62409e99a9 100644
--- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
+++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
@@ -11,26 +11,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/*
- * EDITING INSTRUCTIONS
- * This file was generated from the file
- * https://github.com/google/googleapis/blob/master/google/logging/v2/logging.proto
- * and updates to that file get reflected here through a refresh process.
- * For the short term, the refresh process will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, only certain types of modifications are
- * allowed.
- *
- * Allowed modifications - currently these are the only types allowed:
- * 1. New methods (these should be added to the end of the class)
- * 2. New imports
- * 3. Additional documentation between "manual edit" demarcations
- *
- * Happy editing!
- */
-
 package com.google.cloud.logging.spi.v2;
 
 import com.google.api.MonitoredResource;
@@ -51,13 +31,12 @@
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ScheduledExecutorService;
 
-// Manually-added imports: add custom (non-generated) imports after this point.
-
-// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
 /**
  * Service Description: Service for ingesting and querying logs.
  *
@@ -66,7 +45,7 @@
  *
  * 
  * 
- * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+ * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
  *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
  *   loggingServiceV2Api.deleteLog(formattedLogName);
  * }
@@ -108,9 +87,6 @@
  * LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create(loggingServiceV2Settings);
  * 
  * 
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class LoggingServiceV2Api implements AutoCloseable { @@ -136,7 +112,7 @@ public final LoggingServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate LOG_PATH_TEMPLATE = @@ -144,43 +120,33 @@ public final LoggingServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a log resource. - * - * - * */ public static final String formatLogName(String project, String log) { - return LOG_PATH_TEMPLATE.instantiate("project", project, "log", log); + return LOG_PATH_TEMPLATE.instantiate( + "project", project, + "log", log); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a log resource. - * - * - * */ public static final String parseProjectFromLogName(String logName) { return LOG_PATH_TEMPLATE.parse(logName).get("project"); @@ -189,9 +155,6 @@ public static final String parseProjectFromLogName(String logName) { /** * Parses the log from the given fully-qualified path which * represents a log resource. - * - * - * */ public static final String parseLogFromLogName(String logName) { return LOG_PATH_TEMPLATE.parse(logName).get("log"); @@ -199,11 +162,8 @@ public static final String parseLogFromLogName(String logName) { /** * Constructs an instance of LoggingServiceV2Api with default settings. - * - * - * */ - public static final LoggingServiceV2Api createWithDefaults() throws IOException { + public static final LoggingServiceV2Api create() throws IOException { return create(LoggingServiceV2Settings.defaultBuilder().build()); } @@ -211,9 +171,6 @@ public static final LoggingServiceV2Api createWithDefaults() throws IOException * Constructs an instance of LoggingServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final LoggingServiceV2Api create(LoggingServiceV2Settings settings) throws IOException { @@ -224,9 +181,6 @@ public static final LoggingServiceV2Api create(LoggingServiceV2Settings settings * Constructs an instance of LoggingServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected LoggingServiceV2Api(LoggingServiceV2Settings settings) throws IOException { this.settings = settings; @@ -269,42 +223,37 @@ public void close() throws IOException { } } - // ----- deleteLog ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   loggingServiceV2Api.deleteLog(formattedLogName);
    * }
    * 
* - * - * - * * @param logName Required. The resource name of the log to delete. Example: * `"projects/my-project/logs/syslog"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteLog(String logName) { - LOG_PATH_TEMPLATE.validate(logName); + LOG_PATH_TEMPLATE.validate(logName, "deleteLog"); DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(logName).build(); deleteLog(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   DeleteLogRequest request = DeleteLogRequest.newBuilder()
    *     .setLogName(formattedLogName)
@@ -313,24 +262,21 @@ public final void deleteLog(String logName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteLog(DeleteLogRequest request) { + private final void deleteLog(DeleteLogRequest request) { deleteLogCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   DeleteLogRequest request = DeleteLogRequest.newBuilder()
    *     .setLogName(formattedLogName)
@@ -340,24 +286,19 @@ private void deleteLog(DeleteLogRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteLogCallable() { return deleteLogCallable; } - // ----- writeLogEntries ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String logName = "";
    *   MonitoredResource resource = MonitoredResource.newBuilder().build();
    *   Map<String, String> labels = new HashMap<>();
@@ -366,9 +307,6 @@ public final ApiCallable deleteLogCallable() {
    * }
    * 
* - * - * - * * @param logName Optional. A default log resource name for those log entries in `entries` * that do not specify their own `logName`. Example: * `"projects/my-project/logs/syslog"`. See @@ -381,6 +319,10 @@ public final ApiCallable deleteLogCallable() { * Example: `{ "size": "large", "color":"red" }` * @param entries Required. The log entries to write. The log entries must have values for * all required fields. + * + * To improve throughput and to avoid exceeding the quota limit for calls + * to `entries.write`, use this field to write multiple log entries at once + * rather than // calling this method for each log entry. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final WriteLogEntriesResponse writeLogEntries( @@ -388,8 +330,7 @@ public final WriteLogEntriesResponse writeLogEntries( MonitoredResource resource, Map labels, List entries) { - LOG_PATH_TEMPLATE.validate(logName); - + LOG_PATH_TEMPLATE.validate(logName, "writeLogEntries"); WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder() .setLogName(logName) @@ -400,14 +341,14 @@ public final WriteLogEntriesResponse writeLogEntries( return writeLogEntries(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<LogEntry> entries = new ArrayList<>();
    *   WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
    *     .addAllEntries(entries)
@@ -416,24 +357,21 @@ public final WriteLogEntriesResponse writeLogEntries(
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { + public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { return writeLogEntriesCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<LogEntry> entries = new ArrayList<>();
    *   WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
    *     .addAllEntries(entries)
@@ -443,18 +381,13 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) {
    *   WriteLogEntriesResponse response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable writeLogEntriesCallable() { return writeLogEntriesCallable; } - // ----- listLogEntries ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -462,19 +395,16 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   String filter = "";
    *   String orderBy = "";
-   *   for (LogEntry elements : loggingServiceV2Api.listLogEntries(projectIds, filter, orderBy)) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : loggingServiceV2Api.listLogEntries(projectIds, filter, orderBy)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param projectIds Required. One or more project IDs or project numbers from which to retrieve * log entries. Examples of a project ID: `"my-project-1A"`, `"1234567890"`. * @param filter Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). @@ -482,7 +412,7 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { * `projectIds`. Only entries that match the filter are retrieved. An empty * filter matches all log entries. * @param orderBy Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp"` (default) and `"timestamp desc"`. The first + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first * option returns entries in order of increasing values of * `LogEntry.timestamp` (oldest first), and the second option returns entries * in order of decreasing timestamps (newest first). Entries with equal @@ -491,7 +421,6 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { */ public final PageAccessor listLogEntries( List projectIds, String filter, String orderBy) { - ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder() .addAllProjectIds(projectIds) @@ -501,7 +430,7 @@ public final PageAccessor listLogEntries( return listLogEntries(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -509,20 +438,17 @@ public final PageAccessor listLogEntries( * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
-   *   for (LogEntry elements : loggingServiceV2Api.listLogEntries(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : loggingServiceV2Api.listLogEntries(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -530,7 +456,7 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request return listLogEntriesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -538,28 +464,25 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
    *   ListenableFuture<PageAccessor<LogEntry>> future = loggingServiceV2Api.listLogEntriesPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogEntry elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listLogEntriesPagedCallable() { return listLogEntriesPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -567,15 +490,15 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
    *   while (true) {
    *     ListLogEntriesResponse response = loggingServiceV2Api.listLogEntriesCallable().call(request);
-   *     for (LogEntry elements : response.getEntriesList()) {
-   *       // doThingsWith(elements);
+   *     for (LogEntry element : response.getEntriesList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -586,34 +509,26 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listLogEntriesCallable() { return listLogEntriesCallable; } - // ----- listMonitoredResourceDescriptors ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
-   *   for (MonitoredResourceDescriptor elements : loggingServiceV2Api.listMonitoredResourceDescriptors(request)) {
-   *     // doThingsWith(elements);
+   *   for (MonitoredResourceDescriptor element : loggingServiceV2Api.listMonitoredResourceDescriptors(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -622,25 +537,22 @@ public final PageAccessor listMonitoredResourceDesc return listMonitoredResourceDescriptorsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
    *   ListenableFuture<PageAccessor<MonitoredResourceDescriptor>> future = loggingServiceV2Api.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (MonitoredResourceDescriptor elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (MonitoredResourceDescriptor element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable< ListMonitoredResourceDescriptorsRequest, PageAccessor> @@ -648,19 +560,19 @@ public final PageAccessor listMonitoredResourceDesc return listMonitoredResourceDescriptorsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
    *   while (true) {
    *     ListMonitoredResourceDescriptorsResponse response = loggingServiceV2Api.listMonitoredResourceDescriptorsCallable().call(request);
-   *     for (MonitoredResourceDescriptor elements : response.getResourceDescriptorsList()) {
-   *       // doThingsWith(elements);
+   *     for (MonitoredResourceDescriptor element : response.getResourceDescriptorsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -671,9 +583,6 @@ public final PageAccessor listMonitoredResourceDesc
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable< ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> @@ -684,9 +593,6 @@ public final PageAccessor listMonitoredResourceDesc /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -694,9 +600,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java index c37e5c4ad305..0e0f4da5e345 100644 --- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java +++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.MonitoredResourceDescriptor; @@ -64,9 +44,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link LoggingServiceV2Api}. * @@ -81,13 +59,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of DeleteLog to 30 seconds: + * object. For example, to set the total timeout of deleteLog to 30 seconds: * *

  * 
  * LoggingServiceV2Settings.Builder loggingServiceV2SettingsBuilder =
  *     LoggingServiceV2Settings.defaultBuilder();
- * loggingServiceV2SettingsBuilder.DeleteLogSettings().getRetrySettingsBuilder()
+ * loggingServiceV2SettingsBuilder.deleteLogSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * LoggingServiceV2Settings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
  * 
@@ -95,33 +73,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class LoggingServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -139,7 +110,6 @@ public class LoggingServiceV2Settings extends ServiceApiSettings {
       writeLogEntriesSettings;
   private final PageStreamingCallSettings
       listLogEntriesSettings;
-
   private final PageStreamingCallSettings<
           ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
           MonitoredResourceDescriptor>
@@ -178,6 +148,27 @@ public SimpleCallSettings deleteLogSettings() {
     return listMonitoredResourceDescriptorsSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -356,6 +347,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .deleteLogSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
index adb4d1c325cd..8d76a2579dba 100644
--- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
+++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
@@ -11,26 +11,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/*
- * EDITING INSTRUCTIONS
- * This file was generated from the file
- * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_metrics.proto
- * and updates to that file get reflected here through a refresh process.
- * For the short term, the refresh process will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, only certain types of modifications are
- * allowed.
- *
- * Allowed modifications - currently these are the only types allowed:
- * 1. New methods (these should be added to the end of the class)
- * 2. New imports
- * 3. Additional documentation between "manual edit" demarcations
- *
- * Happy editing!
- */
-
 package com.google.cloud.logging.spi.v2;
 
 import com.google.api.gax.core.PageAccessor;
@@ -51,20 +31,18 @@
 import java.util.List;
 import java.util.concurrent.ScheduledExecutorService;
 
-// Manually-added imports: add custom (non-generated) imports after this point.
-
-// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
 /**
- * Service Description:
+ * Service Description: Service for configuring logs-based metrics.
  *
  * 

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

  * 
- * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
- *   ListLogMetricsResponse response = metricsServiceV2Api.listLogMetrics(formattedProjectName);
+ * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+ *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
  * }
  * 
  * 
@@ -104,9 +82,6 @@ * MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create(metricsServiceV2Settings); * *
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class MetricsServiceV2Api implements AutoCloseable { @@ -127,7 +102,7 @@ public final MetricsServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate METRIC_PATH_TEMPLATE = @@ -135,43 +110,33 @@ public final MetricsServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a metric resource. - * - * - * */ public static final String formatMetricName(String project, String metric) { - return METRIC_PATH_TEMPLATE.instantiate("project", project, "metric", metric); + return METRIC_PATH_TEMPLATE.instantiate( + "project", project, + "metric", metric); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a metric resource. - * - * - * */ public static final String parseProjectFromMetricName(String metricName) { return METRIC_PATH_TEMPLATE.parse(metricName).get("project"); @@ -180,9 +145,6 @@ public static final String parseProjectFromMetricName(String metricName) { /** * Parses the metric from the given fully-qualified path which * represents a metric resource. - * - * - * */ public static final String parseMetricFromMetricName(String metricName) { return METRIC_PATH_TEMPLATE.parse(metricName).get("metric"); @@ -190,11 +152,8 @@ public static final String parseMetricFromMetricName(String metricName) { /** * Constructs an instance of MetricsServiceV2Api with default settings. - * - * - * */ - public static final MetricsServiceV2Api createWithDefaults() throws IOException { + public static final MetricsServiceV2Api create() throws IOException { return create(MetricsServiceV2Settings.defaultBuilder().build()); } @@ -202,9 +161,6 @@ public static final MetricsServiceV2Api createWithDefaults() throws IOException * Constructs an instance of MetricsServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final MetricsServiceV2Api create(MetricsServiceV2Settings settings) throws IOException { @@ -215,9 +171,6 @@ public static final MetricsServiceV2Api create(MetricsServiceV2Settings settings * Constructs an instance of MetricsServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected MetricsServiceV2Api(MetricsServiceV2Settings settings) throws IOException { this.settings = settings; @@ -258,56 +211,47 @@ public void close() throws IOException { } } - // ----- listLogMetrics ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
-   *   for (LogMetric elements : metricsServiceV2Api.listLogMetrics(formattedProjectName)) {
-   *     // doThingsWith(elements);
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
+   *   for (LogMetric element : metricsServiceV2Api.listLogMetrics(formattedParent)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * - * @param projectName Required. The resource name of the project containing the metrics. + * @param parent Required. The resource name containing the metrics. * Example: `"projects/my-project-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final PageAccessor listLogMetrics(String projectName) { - PROJECT_PATH_TEMPLATE.validate(projectName); - ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(projectName).build(); + public final PageAccessor listLogMetrics(String parent) { + PARENT_PATH_TEMPLATE.validate(parent, "listLogMetrics"); + ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build(); return listLogMetrics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
-   *   for (LogMetric elements : metricsServiceV2Api.listLogMetrics(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogMetric element : metricsServiceV2Api.listLogMetrics(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -315,48 +259,45 @@ public final PageAccessor listLogMetrics(ListLogMetricsRequest reques return listLogMetricsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   ListenableFuture<PageAccessor<LogMetric>> future = metricsServiceV2Api.listLogMetricsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogMetric elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogMetric element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listLogMetricsPagedCallable() { return listLogMetricsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   while (true) {
    *     ListLogMetricsResponse response = metricsServiceV2Api.listLogMetricsCallable().call(request);
-   *     for (LogMetric elements : response.getMetricsList()) {
-   *       // doThingsWith(elements);
+   *     for (LogMetric element : response.getMetricsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -367,49 +308,41 @@ public final PageAccessor listLogMetrics(ListLogMetricsRequest reques
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listLogMetricsCallable() { return listLogMetricsCallable; } - // ----- getLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
    * }
    * 
* - * - * - * * @param metricName The resource name of the desired metric. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogMetric getLogMetric(String metricName) { - METRIC_PATH_TEMPLATE.validate(metricName); + METRIC_PATH_TEMPLATE.validate(metricName, "getLogMetric"); GetLogMetricRequest request = GetLogMetricRequest.newBuilder().setMetricName(metricName).build(); return getLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -418,23 +351,20 @@ public final LogMetric getLogMetric(String metricName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private LogMetric getLogMetric(GetLogMetricRequest request) { + private final LogMetric getLogMetric(GetLogMetricRequest request) { return getLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -444,33 +374,25 @@ private LogMetric getLogMetric(GetLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable getLogMetricCallable() { return getLogMetricCallable; } - // ----- createLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsServiceV2Api.createLogMetric(formattedProjectName, metric);
+   *   LogMetric response = metricsServiceV2Api.createLogMetric(formattedParent, metric);
    * }
    * 
* - * - * - * - * @param projectName The resource name of the project in which to create the metric. + * @param parent The resource name of the project in which to create the metric. * Example: `"projects/my-project-id"`. * * The new metric must be provided in the request. @@ -478,52 +400,48 @@ public final ApiCallable getLogMetricCallable() * already exists. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final LogMetric createLogMetric(String projectName, LogMetric metric) { - PROJECT_PATH_TEMPLATE.validate(projectName); - + public final LogMetric createLogMetric(String parent, LogMetric metric) { + PARENT_PATH_TEMPLATE.validate(parent, "createLogMetric"); CreateLogMetricRequest request = - CreateLogMetricRequest.newBuilder().setProjectName(projectName).setMetric(metric).build(); + CreateLogMetricRequest.newBuilder().setParent(parent).setMetric(metric).build(); return createLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setMetric(metric)
    *     .build();
    *   LogMetric response = metricsServiceV2Api.createLogMetric(request);
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogMetric createLogMetric(CreateLogMetricRequest request) { + public final LogMetric createLogMetric(CreateLogMetricRequest request) { return createLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setMetric(metric)
    *     .build();
    *   ListenableFuture<LogMetric> future = metricsServiceV2Api.createLogMetricCallable().futureCall(request);
@@ -531,32 +449,24 @@ public LogMetric createLogMetric(CreateLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable createLogMetricCallable() { return createLogMetricCallable; } - // ----- updateLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   LogMetric response = metricsServiceV2Api.updateLogMetric(formattedMetricName, metric);
    * }
    * 
* - * - * - * * @param metricName The resource name of the metric to update. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @@ -569,20 +479,19 @@ public final ApiCallable createLogMetricCalla * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogMetric updateLogMetric(String metricName, LogMetric metric) { - METRIC_PATH_TEMPLATE.validate(metricName); - + METRIC_PATH_TEMPLATE.validate(metricName, "updateLogMetric"); UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
@@ -593,23 +502,20 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogMetric updateLogMetric(UpdateLogMetricRequest request) { + public final LogMetric updateLogMetric(UpdateLogMetricRequest request) { return updateLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
@@ -621,49 +527,41 @@ public LogMetric updateLogMetric(UpdateLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable updateLogMetricCallable() { return updateLogMetricCallable; } - // ----- deleteLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   metricsServiceV2Api.deleteLogMetric(formattedMetricName);
    * }
    * 
* - * - * - * * @param metricName The resource name of the metric to delete. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteLogMetric(String metricName) { - METRIC_PATH_TEMPLATE.validate(metricName); + METRIC_PATH_TEMPLATE.validate(metricName, "deleteLogMetric"); DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(metricName).build(); deleteLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -672,23 +570,20 @@ public final void deleteLogMetric(String metricName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteLogMetric(DeleteLogMetricRequest request) { + private final void deleteLogMetric(DeleteLogMetricRequest request) { deleteLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -698,9 +593,6 @@ private void deleteLogMetric(DeleteLogMetricRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteLogMetricCallable() { return deleteLogMetricCallable; @@ -709,9 +601,6 @@ public final ApiCallable deleteLogMetricCallable( /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -719,9 +608,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java index 1308b95eb029..9667eca31176 100644 --- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java +++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_metrics.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.ConnectionSettings; @@ -62,9 +42,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link MetricsServiceV2Api}. * @@ -79,13 +57,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of ListLogMetrics to 30 seconds: + * object. For example, to set the total timeout of getLogMetric to 30 seconds: * *

  * 
  * MetricsServiceV2Settings.Builder metricsServiceV2SettingsBuilder =
  *     MetricsServiceV2Settings.defaultBuilder();
- * metricsServiceV2SettingsBuilder.ListLogMetricsSettings().getRetrySettingsBuilder()
+ * metricsServiceV2SettingsBuilder.getLogMetricSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * MetricsServiceV2Settings metricsServiceV2Settings = metricsServiceV2SettingsBuilder.build();
  * 
@@ -93,33 +71,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class MetricsServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -134,7 +105,6 @@ public class MetricsServiceV2Settings extends ServiceApiSettings {
 
   private final PageStreamingCallSettings
       listLogMetricsSettings;
-
   private final SimpleCallSettings getLogMetricSettings;
   private final SimpleCallSettings createLogMetricSettings;
   private final SimpleCallSettings updateLogMetricSettings;
@@ -176,6 +146,27 @@ public SimpleCallSettings deleteLogMetricSettings
     return deleteLogMetricSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -312,6 +303,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .listLogMetricsSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/package-info.java b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
index 81ee3d3fce7e..30c648516059 100644
--- a/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
+++ b/gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
@@ -12,75 +12,59 @@
  * the License.
  */
 
-/*
- * EDITING INSTRUCTIONS
- * This file was automatically generated. For the short term, the process for
- * refreshing this file will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, additional documentation should be added between
- * "manual edit" demarcations.
- *
- * Other generated files allow additional edits - see the editing instructions
- * in those files for more details.
- *
- * Happy editing!
- */
-
 /**
  * A client to Google Cloud Logging API.
  *
  * The interfaces provided are listed below, along with a usage sample
  *
- * ===================
- * LoggingServiceV2Api
- * ===================
+ * ==================
+ * ConfigServiceV2Api
+ * ==================
  *
- * Service Description: Service for ingesting and querying logs.
+ * Service Description: Service for configuring sinks used to export log entries outside Stackdriver
+ * Logging.
  *
- * Sample for LoggingServiceV2Api:
+ * Sample for ConfigServiceV2Api:
  * 
  * 
- * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
- *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
- *   loggingServiceV2Api.deleteLog(formattedLogName);
+ * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+ *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
+ *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
  * }
  * 
  * 
* - * ================== - * ConfigServiceV2Api - * ================== + * =================== + * MetricsServiceV2Api + * =================== * - * Service Description: + * Service Description: Service for configuring logs-based metrics. * - * Sample for ConfigServiceV2Api: + * Sample for MetricsServiceV2Api: *
  * 
- * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
- *   ListSinksResponse response = configServiceV2Api.listSinks(formattedProjectName);
+ * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+ *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
  * }
  * 
  * 
* * =================== - * MetricsServiceV2Api + * LoggingServiceV2Api * =================== * - * Service Description: + * Service Description: Service for ingesting and querying logs. * - * Sample for MetricsServiceV2Api: + * Sample for LoggingServiceV2Api: *
  * 
- * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
- *   ListLogMetricsResponse response = metricsServiceV2Api.listLogMetrics(formattedProjectName);
+ * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
+ *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
+ *   loggingServiceV2Api.deleteLog(formattedLogName);
  * }
  * 
  * 
* - * - * */ package com.google.cloud.logging.spi.v2; diff --git a/gcloud-java-logging/pom.xml b/gcloud-java-logging/pom.xml index c380177d9829..59b5fe36fa5e 100644 --- a/gcloud-java-logging/pom.xml +++ b/gcloud-java-logging/pom.xml @@ -29,18 +29,13 @@ com.google.api.grpc - grpc-logging-type - 0.0.2 - - - com.google.api.grpc - grpc-logging-v2 - 0.0.2 + grpc-google-logging-v2 + 0.0.7 io.grpc grpc-all - 0.14.0 + 0.15.0 com.google.auto.value diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/HttpRequest.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/HttpRequest.java index c1c0e41e121b..7b877f6de1da 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/HttpRequest.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/HttpRequest.java @@ -458,7 +458,7 @@ com.google.logging.type.HttpRequest toPb() { // todo(mziccard) uncomment when #1042 gets fixed // builder.setCacheLookup(cacheLookup); builder.setCacheHit(cacheHit); - builder.setValidatedWithOriginServer(cacheValidatedWithOriginServer); + builder.setCacheValidatedWithOriginServer(cacheValidatedWithOriginServer); // todo(mziccard) uncomment when #1042 gets fixed //if (cacheFillBytes != null) { // builder.setCacheFillBytes(cacheFillBytes); @@ -506,7 +506,7 @@ static HttpRequest fromPb(com.google.logging.type.HttpRequest requestPb) { // todo(mziccard) uncomment when #1042 gets fixed // builder.cacheLookup(requestPb.getCacheLookup()); builder.cacheHit(requestPb.getCacheHit()); - builder.cacheValidatedWithOriginServer(requestPb.getValidatedWithOriginServer()); + builder.cacheValidatedWithOriginServer(requestPb.getCacheValidatedWithOriginServer()); // todo(mziccard) uncomment when #1042 gets fixed //if (requestPb.getCacheFillBytes() != 0L) { // builder.cacheFillBytes(requestPb.getCacheFillBytes()); diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java index 1432b6ef8478..531105005b04 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java @@ -195,7 +195,7 @@ public Sink create(SinkInfo sink) { @Override public Future createAsync(SinkInfo sink) { CreateSinkRequest request = CreateSinkRequest.newBuilder() - .setProjectName(ConfigServiceV2Api.formatProjectName(options().projectId())) + .setParent(ConfigServiceV2Api.formatParentName(options().projectId())) .setSink(sink.toPb(options().projectId())) .build(); return lazyTransform(rpc.create(request), Sink.fromPbFunction(this)); @@ -231,7 +231,7 @@ public Future getSinkAsync(String sink) { private static ListSinksRequest listSinksRequest(LoggingOptions serviceOptions, Map options) { ListSinksRequest.Builder builder = ListSinksRequest.newBuilder(); - builder.setProjectName(ConfigServiceV2Api.formatProjectName(serviceOptions.projectId())); + builder.setParent(ConfigServiceV2Api.formatParentName(serviceOptions.projectId())); Integer pageSize = PAGE_SIZE.get(options); String pageToken = PAGE_TOKEN.get(options); if (pageSize != null) { @@ -352,7 +352,7 @@ public Metric create(MetricInfo metric) { @Override public Future createAsync(MetricInfo metric) { CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() - .setProjectName(MetricsServiceV2Api.formatProjectName(options().projectId())) + .setParent(MetricsServiceV2Api.formatParentName(options().projectId())) .setMetric(metric.toPb()) .build(); return lazyTransform(rpc.create(request), Metric.fromPbFunction(this)); @@ -388,7 +388,7 @@ public Future getMetricAsync(String metric) { private static ListLogMetricsRequest listMetricsRequest(LoggingOptions serviceOptions, Map options) { ListLogMetricsRequest.Builder builder = ListLogMetricsRequest.newBuilder(); - builder.setProjectName(MetricsServiceV2Api.formatProjectName(serviceOptions.projectId())); + builder.setParent(MetricsServiceV2Api.formatParentName(serviceOptions.projectId())); Integer pageSize = PAGE_SIZE.get(options); String pageToken = PAGE_TOKEN.get(options); if (pageSize != null) { diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java index ae6825c9fa27..924e8e8f1ac9 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java @@ -123,11 +123,11 @@ public DefaultLoggingRpc(LoggingOptions options) throws IOException { } else { GoogleCredentials credentials = options.authCredentials().credentials(); confBuilder.provideChannelWith( - credentials.createScoped(ConfigServiceV2Settings.DEFAULT_SERVICE_SCOPES)); + credentials.createScoped(ConfigServiceV2Settings.getDefaultServiceScopes())); logBuilder.provideChannelWith( - credentials.createScoped(LoggingServiceV2Settings.DEFAULT_SERVICE_SCOPES)); + credentials.createScoped(LoggingServiceV2Settings.getDefaultServiceScopes())); metricsBuilder.provideChannelWith( - credentials.createScoped(MetricsServiceV2Settings.DEFAULT_SERVICE_SCOPES)); + credentials.createScoped(MetricsServiceV2Settings.getDefaultServiceScopes())); } ApiCallSettings.Builder callBuilder = apiCallSettings(options); confBuilder.applyToAllApiMethods(callBuilder); diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java index bc0eec93e22b..8352fff2b838 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_config.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.PageAccessor; @@ -51,20 +31,19 @@ import java.util.List; import java.util.concurrent.ScheduledExecutorService; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND SERVICE /** - * Service Description: + * Service Description: Service for configuring sinks used to export log entries outside Stackdriver + * Logging. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

  * 
- * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
- *   ListSinksResponse response = configServiceV2Api.listSinks(formattedProjectName);
+ * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+ *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
+ *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
  * }
  * 
  * 
@@ -104,9 +83,6 @@ * ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create(configServiceV2Settings); * *
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class ConfigServiceV2Api implements AutoCloseable { @@ -126,7 +102,7 @@ public final ConfigServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate SINK_PATH_TEMPLATE = @@ -134,43 +110,33 @@ public final ConfigServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a sink resource. - * - * - * */ public static final String formatSinkName(String project, String sink) { - return SINK_PATH_TEMPLATE.instantiate("project", project, "sink", sink); + return SINK_PATH_TEMPLATE.instantiate( + "project", project, + "sink", sink); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a sink resource. - * - * - * */ public static final String parseProjectFromSinkName(String sinkName) { return SINK_PATH_TEMPLATE.parse(sinkName).get("project"); @@ -179,9 +145,6 @@ public static final String parseProjectFromSinkName(String sinkName) { /** * Parses the sink from the given fully-qualified path which * represents a sink resource. - * - * - * */ public static final String parseSinkFromSinkName(String sinkName) { return SINK_PATH_TEMPLATE.parse(sinkName).get("sink"); @@ -189,11 +152,8 @@ public static final String parseSinkFromSinkName(String sinkName) { /** * Constructs an instance of ConfigServiceV2Api with default settings. - * - * - * */ - public static final ConfigServiceV2Api createWithDefaults() throws IOException { + public static final ConfigServiceV2Api create() throws IOException { return create(ConfigServiceV2Settings.defaultBuilder().build()); } @@ -201,9 +161,6 @@ public static final ConfigServiceV2Api createWithDefaults() throws IOException { * Constructs an instance of ConfigServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final ConfigServiceV2Api create(ConfigServiceV2Settings settings) throws IOException { @@ -214,9 +171,6 @@ public static final ConfigServiceV2Api create(ConfigServiceV2Settings settings) * Constructs an instance of ConfigServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected ConfigServiceV2Api(ConfigServiceV2Settings settings) throws IOException { this.settings = settings; @@ -256,55 +210,47 @@ public void close() throws IOException { } } - // ----- listSinks ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
-   *   for (LogSink elements : configServiceV2Api.listSinks(formattedProjectName)) {
-   *     // doThingsWith(elements);
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
+   *   for (LogSink element : configServiceV2Api.listSinks(formattedParent)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * - * @param projectName Required. The resource name of the project containing the sinks. - * Example: `"projects/my-logging-project"`, `"projects/01234567890"`. + * @param parent Required. The resource name containing the sinks. + * Example: `"projects/my-logging-project"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final PageAccessor listSinks(String projectName) { - PROJECT_PATH_TEMPLATE.validate(projectName); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(projectName).build(); + public final PageAccessor listSinks(String parent) { + PARENT_PATH_TEMPLATE.validate(parent, "listSinks"); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build(); return listSinks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
-   *   for (LogSink elements : configServiceV2Api.listSinks(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogSink element : configServiceV2Api.listSinks(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -312,47 +258,44 @@ public final PageAccessor listSinks(ListSinksRequest request) { return listSinksPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   ListenableFuture<PageAccessor<LogSink>> future = configServiceV2Api.listSinksPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogSink elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogSink element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listSinksPagedCallable() { return listSinksPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists sinks. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   ListSinksRequest request = ListSinksRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   while (true) {
    *     ListSinksResponse response = configServiceV2Api.listSinksCallable().call(request);
-   *     for (LogSink elements : response.getSinksList()) {
-   *       // doThingsWith(elements);
+   *     for (LogSink element : response.getSinksList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -363,48 +306,40 @@ public final ApiCallable> listSinksPaged
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listSinksCallable() { return listSinksCallable; } - // ----- getSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to return. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogSink getSink(String sinkName) { - SINK_PATH_TEMPLATE.validate(sinkName); + SINK_PATH_TEMPLATE.validate(sinkName, "getSink"); GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(sinkName).build(); return getSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   GetSinkRequest request = GetSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -413,23 +348,20 @@ public final LogSink getSink(String sinkName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private LogSink getSink(GetSinkRequest request) { + private final LogSink getSink(GetSinkRequest request) { return getSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   GetSinkRequest request = GetSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -439,33 +371,25 @@ private LogSink getSink(GetSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable getSinkCallable() { return getSinkCallable; } - // ----- createSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
-   *   LogSink response = configServiceV2Api.createSink(formattedProjectName, sink);
+   *   LogSink response = configServiceV2Api.createSink(formattedParent, sink);
    * }
    * 
* - * - * - * - * @param projectName The resource name of the project in which to create the sink. + * @param parent The resource in which to create the sink. * Example: `"projects/my-project-id"`. * * The new sink must be provided in the request. @@ -473,52 +397,48 @@ public final ApiCallable getSinkCallable() { * exists. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final LogSink createSink(String projectName, LogSink sink) { - PROJECT_PATH_TEMPLATE.validate(projectName); - + public final LogSink createSink(String parent, LogSink sink) { + PARENT_PATH_TEMPLATE.validate(parent, "createSink"); CreateSinkRequest request = - CreateSinkRequest.newBuilder().setProjectName(projectName).setSink(sink).build(); + CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build(); return createSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   CreateSinkRequest request = CreateSinkRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setSink(sink)
    *     .build();
    *   LogSink response = configServiceV2Api.createSink(request);
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogSink createSink(CreateSinkRequest request) { + public final LogSink createSink(CreateSinkRequest request) { return createSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+   *   String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   CreateSinkRequest request = CreateSinkRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setSink(sink)
    *     .build();
    *   ListenableFuture<LogSink> future = configServiceV2Api.createSinkCallable().futureCall(request);
@@ -526,32 +446,24 @@ public LogSink createSink(CreateSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable createSinkCallable() { return createSinkCallable; } - // ----- updateSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   LogSink response = configServiceV2Api.updateSink(formattedSinkName, sink);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to update. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @@ -564,20 +476,19 @@ public final ApiCallable createSinkCallable() { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogSink updateSink(String sinkName, LogSink sink) { - SINK_PATH_TEMPLATE.validate(sinkName); - + SINK_PATH_TEMPLATE.validate(sinkName, "updateSink"); UpdateSinkRequest request = UpdateSinkRequest.newBuilder().setSinkName(sinkName).setSink(sink).build(); return updateSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
@@ -588,23 +499,20 @@ public final LogSink updateSink(String sinkName, LogSink sink) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogSink updateSink(UpdateSinkRequest request) { + public final LogSink updateSink(UpdateSinkRequest request) { return updateSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   LogSink sink = LogSink.newBuilder().build();
    *   UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
@@ -616,48 +524,40 @@ public LogSink updateSink(UpdateSinkRequest request) {
    *   LogSink response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable updateSinkCallable() { return updateSinkCallable; } - // ----- deleteSink ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   configServiceV2Api.deleteSink(formattedSinkName);
    * }
    * 
* - * - * - * * @param sinkName The resource name of the sink to delete. * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteSink(String sinkName) { - SINK_PATH_TEMPLATE.validate(sinkName); + SINK_PATH_TEMPLATE.validate(sinkName, "deleteSink"); DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(sinkName).build(); deleteSink(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -666,23 +566,20 @@ public final void deleteSink(String sinkName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteSink(DeleteSinkRequest request) { + private final void deleteSink(DeleteSinkRequest request) { deleteSinkCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a sink. * * Sample code: *

-   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
+   * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
    *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
    *   DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
    *     .setSinkName(formattedSinkName)
@@ -692,9 +589,6 @@ private void deleteSink(DeleteSinkRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteSinkCallable() { return deleteSinkCallable; @@ -703,9 +597,6 @@ public final ApiCallable deleteSinkCallable() { /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -713,9 +604,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java index 9c1558fec565..39215faeef26 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_config.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.ConnectionSettings; @@ -62,9 +42,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link ConfigServiceV2Api}. * @@ -79,13 +57,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of ListSinks to 30 seconds: + * object. For example, to set the total timeout of getSink to 30 seconds: * *

  * 
  * ConfigServiceV2Settings.Builder configServiceV2SettingsBuilder =
  *     ConfigServiceV2Settings.defaultBuilder();
- * configServiceV2SettingsBuilder.ListSinksSettings().getRetrySettingsBuilder()
+ * configServiceV2SettingsBuilder.getSinkSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * ConfigServiceV2Settings configServiceV2Settings = configServiceV2SettingsBuilder.build();
  * 
@@ -93,33 +71,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class ConfigServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -134,7 +105,6 @@ public class ConfigServiceV2Settings extends ServiceApiSettings {
 
   private final PageStreamingCallSettings
       listSinksSettings;
-
   private final SimpleCallSettings getSinkSettings;
   private final SimpleCallSettings createSinkSettings;
   private final SimpleCallSettings updateSinkSettings;
@@ -176,6 +146,27 @@ public SimpleCallSettings deleteSinkSettings() {
     return deleteSinkSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -307,6 +298,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .listSinksSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
index 70960a025987..be62409e99a9 100644
--- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
+++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
@@ -11,26 +11,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/*
- * EDITING INSTRUCTIONS
- * This file was generated from the file
- * https://github.com/google/googleapis/blob/master/google/logging/v2/logging.proto
- * and updates to that file get reflected here through a refresh process.
- * For the short term, the refresh process will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, only certain types of modifications are
- * allowed.
- *
- * Allowed modifications - currently these are the only types allowed:
- * 1. New methods (these should be added to the end of the class)
- * 2. New imports
- * 3. Additional documentation between "manual edit" demarcations
- *
- * Happy editing!
- */
-
 package com.google.cloud.logging.spi.v2;
 
 import com.google.api.MonitoredResource;
@@ -51,13 +31,12 @@
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ScheduledExecutorService;
 
-// Manually-added imports: add custom (non-generated) imports after this point.
-
-// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
 /**
  * Service Description: Service for ingesting and querying logs.
  *
@@ -66,7 +45,7 @@
  *
  * 
  * 
- * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+ * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
  *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
  *   loggingServiceV2Api.deleteLog(formattedLogName);
  * }
@@ -108,9 +87,6 @@
  * LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create(loggingServiceV2Settings);
  * 
  * 
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class LoggingServiceV2Api implements AutoCloseable { @@ -136,7 +112,7 @@ public final LoggingServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate LOG_PATH_TEMPLATE = @@ -144,43 +120,33 @@ public final LoggingServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a log resource. - * - * - * */ public static final String formatLogName(String project, String log) { - return LOG_PATH_TEMPLATE.instantiate("project", project, "log", log); + return LOG_PATH_TEMPLATE.instantiate( + "project", project, + "log", log); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a log resource. - * - * - * */ public static final String parseProjectFromLogName(String logName) { return LOG_PATH_TEMPLATE.parse(logName).get("project"); @@ -189,9 +155,6 @@ public static final String parseProjectFromLogName(String logName) { /** * Parses the log from the given fully-qualified path which * represents a log resource. - * - * - * */ public static final String parseLogFromLogName(String logName) { return LOG_PATH_TEMPLATE.parse(logName).get("log"); @@ -199,11 +162,8 @@ public static final String parseLogFromLogName(String logName) { /** * Constructs an instance of LoggingServiceV2Api with default settings. - * - * - * */ - public static final LoggingServiceV2Api createWithDefaults() throws IOException { + public static final LoggingServiceV2Api create() throws IOException { return create(LoggingServiceV2Settings.defaultBuilder().build()); } @@ -211,9 +171,6 @@ public static final LoggingServiceV2Api createWithDefaults() throws IOException * Constructs an instance of LoggingServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final LoggingServiceV2Api create(LoggingServiceV2Settings settings) throws IOException { @@ -224,9 +181,6 @@ public static final LoggingServiceV2Api create(LoggingServiceV2Settings settings * Constructs an instance of LoggingServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected LoggingServiceV2Api(LoggingServiceV2Settings settings) throws IOException { this.settings = settings; @@ -269,42 +223,37 @@ public void close() throws IOException { } } - // ----- deleteLog ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   loggingServiceV2Api.deleteLog(formattedLogName);
    * }
    * 
* - * - * - * * @param logName Required. The resource name of the log to delete. Example: * `"projects/my-project/logs/syslog"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteLog(String logName) { - LOG_PATH_TEMPLATE.validate(logName); + LOG_PATH_TEMPLATE.validate(logName, "deleteLog"); DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(logName).build(); deleteLog(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   DeleteLogRequest request = DeleteLogRequest.newBuilder()
    *     .setLogName(formattedLogName)
@@ -313,24 +262,21 @@ public final void deleteLog(String logName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteLog(DeleteLogRequest request) { + private final void deleteLog(DeleteLogRequest request) { deleteLogCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a log and all its log entries. * The log will reappear if it receives new entries. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
    *   DeleteLogRequest request = DeleteLogRequest.newBuilder()
    *     .setLogName(formattedLogName)
@@ -340,24 +286,19 @@ private void deleteLog(DeleteLogRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteLogCallable() { return deleteLogCallable; } - // ----- writeLogEntries ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   String logName = "";
    *   MonitoredResource resource = MonitoredResource.newBuilder().build();
    *   Map<String, String> labels = new HashMap<>();
@@ -366,9 +307,6 @@ public final ApiCallable deleteLogCallable() {
    * }
    * 
* - * - * - * * @param logName Optional. A default log resource name for those log entries in `entries` * that do not specify their own `logName`. Example: * `"projects/my-project/logs/syslog"`. See @@ -381,6 +319,10 @@ public final ApiCallable deleteLogCallable() { * Example: `{ "size": "large", "color":"red" }` * @param entries Required. The log entries to write. The log entries must have values for * all required fields. + * + * To improve throughput and to avoid exceeding the quota limit for calls + * to `entries.write`, use this field to write multiple log entries at once + * rather than // calling this method for each log entry. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final WriteLogEntriesResponse writeLogEntries( @@ -388,8 +330,7 @@ public final WriteLogEntriesResponse writeLogEntries( MonitoredResource resource, Map labels, List entries) { - LOG_PATH_TEMPLATE.validate(logName); - + LOG_PATH_TEMPLATE.validate(logName, "writeLogEntries"); WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder() .setLogName(logName) @@ -400,14 +341,14 @@ public final WriteLogEntriesResponse writeLogEntries( return writeLogEntries(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<LogEntry> entries = new ArrayList<>();
    *   WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
    *     .addAllEntries(entries)
@@ -416,24 +357,21 @@ public final WriteLogEntriesResponse writeLogEntries(
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { + public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { return writeLogEntriesCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Cloud Logging. - * All log entries in Cloud Logging are written by this method. + * Writes log entries to Stackdriver Logging. All log entries are + * written by this method. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<LogEntry> entries = new ArrayList<>();
    *   WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
    *     .addAllEntries(entries)
@@ -443,18 +381,13 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) {
    *   WriteLogEntriesResponse response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable writeLogEntriesCallable() { return writeLogEntriesCallable; } - // ----- listLogEntries ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -462,19 +395,16 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   String filter = "";
    *   String orderBy = "";
-   *   for (LogEntry elements : loggingServiceV2Api.listLogEntries(projectIds, filter, orderBy)) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : loggingServiceV2Api.listLogEntries(projectIds, filter, orderBy)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param projectIds Required. One or more project IDs or project numbers from which to retrieve * log entries. Examples of a project ID: `"my-project-1A"`, `"1234567890"`. * @param filter Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). @@ -482,7 +412,7 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { * `projectIds`. Only entries that match the filter are retrieved. An empty * filter matches all log entries. * @param orderBy Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp"` (default) and `"timestamp desc"`. The first + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first * option returns entries in order of increasing values of * `LogEntry.timestamp` (oldest first), and the second option returns entries * in order of decreasing timestamps (newest first). Entries with equal @@ -491,7 +421,6 @@ public WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) { */ public final PageAccessor listLogEntries( List projectIds, String filter, String orderBy) { - ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder() .addAllProjectIds(projectIds) @@ -501,7 +430,7 @@ public final PageAccessor listLogEntries( return listLogEntries(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -509,20 +438,17 @@ public final PageAccessor listLogEntries( * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
-   *   for (LogEntry elements : loggingServiceV2Api.listLogEntries(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : loggingServiceV2Api.listLogEntries(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -530,7 +456,7 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request return listLogEntriesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -538,28 +464,25 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
    *   ListenableFuture<PageAccessor<LogEntry>> future = loggingServiceV2Api.listLogEntriesPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogEntry elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogEntry element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listLogEntriesPagedCallable() { return listLogEntriesPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists log entries. Use this method to retrieve log entries from Cloud * Logging. For ways to export log entries, see @@ -567,15 +490,15 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   List<String> projectIds = new ArrayList<>();
    *   ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
    *     .addAllProjectIds(projectIds)
    *     .build();
    *   while (true) {
    *     ListLogEntriesResponse response = loggingServiceV2Api.listLogEntriesCallable().call(request);
-   *     for (LogEntry elements : response.getEntriesList()) {
-   *       // doThingsWith(elements);
+   *     for (LogEntry element : response.getEntriesList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -586,34 +509,26 @@ public final PageAccessor listLogEntries(ListLogEntriesRequest request
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listLogEntriesCallable() { return listLogEntriesCallable; } - // ----- listMonitoredResourceDescriptors ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
-   *   for (MonitoredResourceDescriptor elements : loggingServiceV2Api.listMonitoredResourceDescriptors(request)) {
-   *     // doThingsWith(elements);
+   *   for (MonitoredResourceDescriptor element : loggingServiceV2Api.listMonitoredResourceDescriptors(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -622,25 +537,22 @@ public final PageAccessor listMonitoredResourceDesc return listMonitoredResourceDescriptorsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
    *   ListenableFuture<PageAccessor<MonitoredResourceDescriptor>> future = loggingServiceV2Api.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (MonitoredResourceDescriptor elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (MonitoredResourceDescriptor element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable< ListMonitoredResourceDescriptorsRequest, PageAccessor> @@ -648,19 +560,19 @@ public final PageAccessor listMonitoredResourceDesc return listMonitoredResourceDescriptorsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists monitored resource descriptors that are used by Cloud Logging. + * Lists the monitored resource descriptors used by Stackdriver Logging. * * Sample code: *

-   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
+   * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
    *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
    *     .build();
    *   while (true) {
    *     ListMonitoredResourceDescriptorsResponse response = loggingServiceV2Api.listMonitoredResourceDescriptorsCallable().call(request);
-   *     for (MonitoredResourceDescriptor elements : response.getResourceDescriptorsList()) {
-   *       // doThingsWith(elements);
+   *     for (MonitoredResourceDescriptor element : response.getResourceDescriptorsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -671,9 +583,6 @@ public final PageAccessor listMonitoredResourceDesc
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable< ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> @@ -684,9 +593,6 @@ public final PageAccessor listMonitoredResourceDesc /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -694,9 +600,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java index c37e5c4ad305..0e0f4da5e345 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.MonitoredResourceDescriptor; @@ -64,9 +44,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link LoggingServiceV2Api}. * @@ -81,13 +59,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of DeleteLog to 30 seconds: + * object. For example, to set the total timeout of deleteLog to 30 seconds: * *

  * 
  * LoggingServiceV2Settings.Builder loggingServiceV2SettingsBuilder =
  *     LoggingServiceV2Settings.defaultBuilder();
- * loggingServiceV2SettingsBuilder.DeleteLogSettings().getRetrySettingsBuilder()
+ * loggingServiceV2SettingsBuilder.deleteLogSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * LoggingServiceV2Settings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
  * 
@@ -95,33 +73,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class LoggingServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -139,7 +110,6 @@ public class LoggingServiceV2Settings extends ServiceApiSettings {
       writeLogEntriesSettings;
   private final PageStreamingCallSettings
       listLogEntriesSettings;
-
   private final PageStreamingCallSettings<
           ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
           MonitoredResourceDescriptor>
@@ -178,6 +148,27 @@ public SimpleCallSettings deleteLogSettings() {
     return listMonitoredResourceDescriptorsSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -356,6 +347,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .deleteLogSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
index adb4d1c325cd..8d76a2579dba 100644
--- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
+++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
@@ -11,26 +11,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/*
- * EDITING INSTRUCTIONS
- * This file was generated from the file
- * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_metrics.proto
- * and updates to that file get reflected here through a refresh process.
- * For the short term, the refresh process will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, only certain types of modifications are
- * allowed.
- *
- * Allowed modifications - currently these are the only types allowed:
- * 1. New methods (these should be added to the end of the class)
- * 2. New imports
- * 3. Additional documentation between "manual edit" demarcations
- *
- * Happy editing!
- */
-
 package com.google.cloud.logging.spi.v2;
 
 import com.google.api.gax.core.PageAccessor;
@@ -51,20 +31,18 @@
 import java.util.List;
 import java.util.concurrent.ScheduledExecutorService;
 
-// Manually-added imports: add custom (non-generated) imports after this point.
-
-// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
 /**
- * Service Description:
+ * Service Description: Service for configuring logs-based metrics.
  *
  * 

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

  * 
- * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
- *   ListLogMetricsResponse response = metricsServiceV2Api.listLogMetrics(formattedProjectName);
+ * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+ *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
  * }
  * 
  * 
@@ -104,9 +82,6 @@ * MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create(metricsServiceV2Settings); * *
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class MetricsServiceV2Api implements AutoCloseable { @@ -127,7 +102,7 @@ public final MetricsServiceV2Settings getSettings() { return settings; } - private static final PathTemplate PROJECT_PATH_TEMPLATE = + private static final PathTemplate PARENT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); private static final PathTemplate METRIC_PATH_TEMPLATE = @@ -135,43 +110,33 @@ public final MetricsServiceV2Settings getSettings() { /** * Formats a string containing the fully-qualified path to represent - * a project resource. - * - * - * + * a parent resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); + public static final String formatParentName(String project) { + return PARENT_PATH_TEMPLATE.instantiate("project", project); } /** * Formats a string containing the fully-qualified path to represent * a metric resource. - * - * - * */ public static final String formatMetricName(String project, String metric) { - return METRIC_PATH_TEMPLATE.instantiate("project", project, "metric", metric); + return METRIC_PATH_TEMPLATE.instantiate( + "project", project, + "metric", metric); } /** * Parses the project from the given fully-qualified path which - * represents a project resource. - * - * - * + * represents a parent resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); + public static final String parseProjectFromParentName(String parentName) { + return PARENT_PATH_TEMPLATE.parse(parentName).get("project"); } /** * Parses the project from the given fully-qualified path which * represents a metric resource. - * - * - * */ public static final String parseProjectFromMetricName(String metricName) { return METRIC_PATH_TEMPLATE.parse(metricName).get("project"); @@ -180,9 +145,6 @@ public static final String parseProjectFromMetricName(String metricName) { /** * Parses the metric from the given fully-qualified path which * represents a metric resource. - * - * - * */ public static final String parseMetricFromMetricName(String metricName) { return METRIC_PATH_TEMPLATE.parse(metricName).get("metric"); @@ -190,11 +152,8 @@ public static final String parseMetricFromMetricName(String metricName) { /** * Constructs an instance of MetricsServiceV2Api with default settings. - * - * - * */ - public static final MetricsServiceV2Api createWithDefaults() throws IOException { + public static final MetricsServiceV2Api create() throws IOException { return create(MetricsServiceV2Settings.defaultBuilder().build()); } @@ -202,9 +161,6 @@ public static final MetricsServiceV2Api createWithDefaults() throws IOException * Constructs an instance of MetricsServiceV2Api, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final MetricsServiceV2Api create(MetricsServiceV2Settings settings) throws IOException { @@ -215,9 +171,6 @@ public static final MetricsServiceV2Api create(MetricsServiceV2Settings settings * Constructs an instance of MetricsServiceV2Api, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected MetricsServiceV2Api(MetricsServiceV2Settings settings) throws IOException { this.settings = settings; @@ -258,56 +211,47 @@ public void close() throws IOException { } } - // ----- listLogMetrics ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
-   *   for (LogMetric elements : metricsServiceV2Api.listLogMetrics(formattedProjectName)) {
-   *     // doThingsWith(elements);
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
+   *   for (LogMetric element : metricsServiceV2Api.listLogMetrics(formattedParent)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * - * @param projectName Required. The resource name of the project containing the metrics. + * @param parent Required. The resource name containing the metrics. * Example: `"projects/my-project-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final PageAccessor listLogMetrics(String projectName) { - PROJECT_PATH_TEMPLATE.validate(projectName); - ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(projectName).build(); + public final PageAccessor listLogMetrics(String parent) { + PARENT_PATH_TEMPLATE.validate(parent, "listLogMetrics"); + ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build(); return listLogMetrics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
-   *   for (LogMetric elements : metricsServiceV2Api.listLogMetrics(request)) {
-   *     // doThingsWith(elements);
+   *   for (LogMetric element : metricsServiceV2Api.listLogMetrics(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -315,48 +259,45 @@ public final PageAccessor listLogMetrics(ListLogMetricsRequest reques return listLogMetricsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   ListenableFuture<PageAccessor<LogMetric>> future = metricsServiceV2Api.listLogMetricsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (LogMetric elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (LogMetric element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listLogMetricsPagedCallable() { return listLogMetricsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists logs-based metrics. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .build();
    *   while (true) {
    *     ListLogMetricsResponse response = metricsServiceV2Api.listLogMetricsCallable().call(request);
-   *     for (LogMetric elements : response.getMetricsList()) {
-   *       // doThingsWith(elements);
+   *     for (LogMetric element : response.getMetricsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -367,49 +308,41 @@ public final PageAccessor listLogMetrics(ListLogMetricsRequest reques
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listLogMetricsCallable() { return listLogMetricsCallable; } - // ----- getLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
    * }
    * 
* - * - * - * * @param metricName The resource name of the desired metric. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogMetric getLogMetric(String metricName) { - METRIC_PATH_TEMPLATE.validate(metricName); + METRIC_PATH_TEMPLATE.validate(metricName, "getLogMetric"); GetLogMetricRequest request = GetLogMetricRequest.newBuilder().setMetricName(metricName).build(); return getLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -418,23 +351,20 @@ public final LogMetric getLogMetric(String metricName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private LogMetric getLogMetric(GetLogMetricRequest request) { + private final LogMetric getLogMetric(GetLogMetricRequest request) { return getLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -444,33 +374,25 @@ private LogMetric getLogMetric(GetLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable getLogMetricCallable() { return getLogMetricCallable; } - // ----- createLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
-   *   LogMetric response = metricsServiceV2Api.createLogMetric(formattedProjectName, metric);
+   *   LogMetric response = metricsServiceV2Api.createLogMetric(formattedParent, metric);
    * }
    * 
* - * - * - * - * @param projectName The resource name of the project in which to create the metric. + * @param parent The resource name of the project in which to create the metric. * Example: `"projects/my-project-id"`. * * The new metric must be provided in the request. @@ -478,52 +400,48 @@ public final ApiCallable getLogMetricCallable() * already exists. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public final LogMetric createLogMetric(String projectName, LogMetric metric) { - PROJECT_PATH_TEMPLATE.validate(projectName); - + public final LogMetric createLogMetric(String parent, LogMetric metric) { + PARENT_PATH_TEMPLATE.validate(parent, "createLogMetric"); CreateLogMetricRequest request = - CreateLogMetricRequest.newBuilder().setProjectName(projectName).setMetric(metric).build(); + CreateLogMetricRequest.newBuilder().setParent(parent).setMetric(metric).build(); return createLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setMetric(metric)
    *     .build();
    *   LogMetric response = metricsServiceV2Api.createLogMetric(request);
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogMetric createLogMetric(CreateLogMetricRequest request) { + public final LogMetric createLogMetric(CreateLogMetricRequest request) { return createLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
-   *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+   *   String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
-   *     .setProjectName(formattedProjectName)
+   *     .setParent(formattedParent)
    *     .setMetric(metric)
    *     .build();
    *   ListenableFuture<LogMetric> future = metricsServiceV2Api.createLogMetricCallable().futureCall(request);
@@ -531,32 +449,24 @@ public LogMetric createLogMetric(CreateLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable createLogMetricCallable() { return createLogMetricCallable; } - // ----- updateLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   LogMetric response = metricsServiceV2Api.updateLogMetric(formattedMetricName, metric);
    * }
    * 
* - * - * - * * @param metricName The resource name of the metric to update. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @@ -569,20 +479,19 @@ public final ApiCallable createLogMetricCalla * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final LogMetric updateLogMetric(String metricName, LogMetric metric) { - METRIC_PATH_TEMPLATE.validate(metricName); - + METRIC_PATH_TEMPLATE.validate(metricName, "updateLogMetric"); UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
@@ -593,23 +502,20 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public LogMetric updateLogMetric(UpdateLogMetricRequest request) { + public final LogMetric updateLogMetric(UpdateLogMetricRequest request) { return updateLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates or updates a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
@@ -621,49 +527,41 @@ public LogMetric updateLogMetric(UpdateLogMetricRequest request) {
    *   LogMetric response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable updateLogMetricCallable() { return updateLogMetricCallable; } - // ----- deleteLogMetric ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   metricsServiceV2Api.deleteLogMetric(formattedMetricName);
    * }
    * 
* - * - * - * * @param metricName The resource name of the metric to delete. * Example: `"projects/my-project-id/metrics/my-metric-id"`. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteLogMetric(String metricName) { - METRIC_PATH_TEMPLATE.validate(metricName); + METRIC_PATH_TEMPLATE.validate(metricName, "deleteLogMetric"); DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(metricName).build(); deleteLogMetric(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -672,23 +570,20 @@ public final void deleteLogMetric(String metricName) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteLogMetric(DeleteLogMetricRequest request) { + private final void deleteLogMetric(DeleteLogMetricRequest request) { deleteLogMetricCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes a logs-based metric. * * Sample code: *

-   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
+   * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
    *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
    *   DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
    *     .setMetricName(formattedMetricName)
@@ -698,9 +593,6 @@ private void deleteLogMetric(DeleteLogMetricRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteLogMetricCallable() { return deleteLogMetricCallable; @@ -709,9 +601,6 @@ public final ApiCallable deleteLogMetricCallable( /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -719,9 +608,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java index 1308b95eb029..9667eca31176 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java +++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/logging/v2/logging_metrics.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.logging.spi.v2; import com.google.api.gax.core.ConnectionSettings; @@ -62,9 +42,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link MetricsServiceV2Api}. * @@ -79,13 +57,13 @@ * *

The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of ListLogMetrics to 30 seconds: + * object. For example, to set the total timeout of getLogMetric to 30 seconds: * *

  * 
  * MetricsServiceV2Settings.Builder metricsServiceV2SettingsBuilder =
  *     MetricsServiceV2Settings.defaultBuilder();
- * metricsServiceV2SettingsBuilder.ListLogMetricsSettings().getRetrySettingsBuilder()
+ * metricsServiceV2SettingsBuilder.getLogMetricSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.standardSeconds(30));
  * MetricsServiceV2Settings metricsServiceV2Settings = metricsServiceV2SettingsBuilder.build();
  * 
@@ -93,33 +71,26 @@
  */
 @javax.annotation.Generated("by GAPIC")
 public class MetricsServiceV2Settings extends ServiceApiSettings {
-
   /**
    * The default address of the service.
-   *
-   * 
-   * 
    */
-  public static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
+  private static final String DEFAULT_SERVICE_ADDRESS = "logging.googleapis.com";
 
   /**
    * The default port of the service.
-   *
-   * 
-   * 
    */
-  public static final int DEFAULT_SERVICE_PORT = 443;
+  private static final int DEFAULT_SERVICE_PORT = 443;
 
   /**
    * The default scopes of the service.
    */
-  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
+  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
       ImmutableList.builder()
-          .add("https://www.googleapis.com/auth/logging.write")
+          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
           .add("https://www.googleapis.com/auth/logging.admin")
           .add("https://www.googleapis.com/auth/logging.read")
-          .add("https://www.googleapis.com/auth/cloud-platform.read-only")
-          .add("https://www.googleapis.com/auth/cloud-platform")
+          .add("https://www.googleapis.com/auth/logging.write")
           .build();
 
   /**
@@ -134,7 +105,6 @@ public class MetricsServiceV2Settings extends ServiceApiSettings {
 
   private final PageStreamingCallSettings
       listLogMetricsSettings;
-
   private final SimpleCallSettings getLogMetricSettings;
   private final SimpleCallSettings createLogMetricSettings;
   private final SimpleCallSettings updateLogMetricSettings;
@@ -176,6 +146,27 @@ public SimpleCallSettings deleteLogMetricSettings
     return deleteLogMetricSettings;
   }
 
+  /**
+   * 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 scopes.
+   */
+  public static ImmutableList getDefaultServiceScopes() {
+    return DEFAULT_SERVICE_SCOPES;
+  }
+
   /**
    * Returns a builder for this class with recommended defaults.
    */
@@ -312,6 +303,7 @@ private Builder() {
 
     private static Builder createDefault() {
       Builder builder = new Builder();
+
       builder
           .listLogMetricsSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/package-info.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
index 81ee3d3fce7e..30c648516059 100644
--- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
+++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/v2/package-info.java
@@ -12,75 +12,59 @@
  * the License.
  */
 
-/*
- * EDITING INSTRUCTIONS
- * This file was automatically generated. For the short term, the process for
- * refreshing this file will only be runnable by Google engineers.
- * Manual additions are allowed because the refresh process performs
- * a 3-way merge in order to preserve those manual additions. In order to not
- * break the refresh process, additional documentation should be added between
- * "manual edit" demarcations.
- *
- * Other generated files allow additional edits - see the editing instructions
- * in those files for more details.
- *
- * Happy editing!
- */
-
 /**
  * A client to Google Cloud Logging API.
  *
  * The interfaces provided are listed below, along with a usage sample
  *
- * ===================
- * LoggingServiceV2Api
- * ===================
+ * ==================
+ * ConfigServiceV2Api
+ * ==================
  *
- * Service Description: Service for ingesting and querying logs.
+ * Service Description: Service for configuring sinks used to export log entries outside Stackdriver
+ * Logging.
  *
- * Sample for LoggingServiceV2Api:
+ * Sample for ConfigServiceV2Api:
  * 
  * 
- * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.createWithDefaults()) {
- *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
- *   loggingServiceV2Api.deleteLog(formattedLogName);
+ * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
+ *   String formattedSinkName = ConfigServiceV2Api.formatSinkName("[PROJECT]", "[SINK]");
+ *   LogSink response = configServiceV2Api.getSink(formattedSinkName);
  * }
  * 
  * 
* - * ================== - * ConfigServiceV2Api - * ================== + * =================== + * MetricsServiceV2Api + * =================== * - * Service Description: + * Service Description: Service for configuring logs-based metrics. * - * Sample for ConfigServiceV2Api: + * Sample for MetricsServiceV2Api: *
  * 
- * try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = ConfigServiceV2Api.formatProjectName("[PROJECT]");
- *   ListSinksResponse response = configServiceV2Api.listSinks(formattedProjectName);
+ * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
+ *   String formattedMetricName = MetricsServiceV2Api.formatMetricName("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsServiceV2Api.getLogMetric(formattedMetricName);
  * }
  * 
  * 
* * =================== - * MetricsServiceV2Api + * LoggingServiceV2Api * =================== * - * Service Description: + * Service Description: Service for ingesting and querying logs. * - * Sample for MetricsServiceV2Api: + * Sample for LoggingServiceV2Api: *
  * 
- * try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.createWithDefaults()) {
- *   String formattedProjectName = MetricsServiceV2Api.formatProjectName("[PROJECT]");
- *   ListLogMetricsResponse response = metricsServiceV2Api.listLogMetrics(formattedProjectName);
+ * try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
+ *   String formattedLogName = LoggingServiceV2Api.formatLogName("[PROJECT]", "[LOG]");
+ *   loggingServiceV2Api.deleteLog(formattedLogName);
  * }
  * 
  * 
* - * - * */ package com.google.cloud.logging.spi.v2; diff --git a/gcloud-java-logging/src/test/java/com/google/cloud/logging/LoggingImplTest.java b/gcloud-java-logging/src/test/java/com/google/cloud/logging/LoggingImplTest.java index a9b1b3dcb05f..2c70ba2da03f 100644 --- a/gcloud-java-logging/src/test/java/com/google/cloud/logging/LoggingImplTest.java +++ b/gcloud-java-logging/src/test/java/com/google/cloud/logging/LoggingImplTest.java @@ -169,7 +169,7 @@ public void testCreateSink() { LogSink sinkPb = SINK_INFO.toPb(PROJECT); Future response = Futures.immediateFuture(sinkPb); CreateSinkRequest request = CreateSinkRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setSink(sinkPb) .build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); @@ -184,7 +184,7 @@ public void testCreateSinkAsync() throws ExecutionException, InterruptedExceptio LogSink sinkPb = SINK_INFO.toPb(PROJECT); Future response = Futures.immediateFuture(sinkPb); CreateSinkRequest request = CreateSinkRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setSink(sinkPb) .build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); @@ -313,7 +313,7 @@ public void testListSinks() { String cursor = "cursor"; EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of( new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO))); @@ -334,9 +334,9 @@ public void testListSinksNextPage() { String cursor1 = "cursor"; EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request1 = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request1 = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); ListSinksRequest request2 = ListSinksRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setPageToken(cursor1) .build(); List sinkList1 = ImmutableList.of( @@ -370,7 +370,7 @@ public void testListSinksNextPage() { public void testListSinksEmpty() { EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of(); ListSinksResponse response = ListSinksResponse.newBuilder() .setNextPageToken("") @@ -393,7 +393,7 @@ public void testListSinksWithOptions() { ListSinksRequest request = ListSinksRequest.newBuilder() .setPageToken(cursor) .setPageSize(42) - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .build(); List sinkList = ImmutableList.of( new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), @@ -415,7 +415,7 @@ public void testListSinksAsync() throws ExecutionException, InterruptedException String cursor = "cursor"; EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of( new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO))); @@ -436,9 +436,9 @@ public void testListSinksAsyncNextPage() throws ExecutionException, InterruptedE String cursor1 = "cursor"; EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request1 = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request1 = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); ListSinksRequest request2 = ListSinksRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setPageToken(cursor1) .build(); List sinkList1 = ImmutableList.of( @@ -472,7 +472,7 @@ public void testListSinksAsyncNextPage() throws ExecutionException, InterruptedE public void testListSinksAsyncEmpty() throws ExecutionException, InterruptedException { EasyMock.replay(rpcFactoryMock); logging = options.service(); - ListSinksRequest request = ListSinksRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of(); ListSinksResponse response = ListSinksResponse.newBuilder() .setNextPageToken("") @@ -495,7 +495,7 @@ public void testListSinksWithOptionsAsync() throws ExecutionException, Interrupt ListSinksRequest request = ListSinksRequest.newBuilder() .setPageToken(cursor) .setPageSize(42) - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .build(); List sinkList = ImmutableList.of( new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), @@ -518,7 +518,7 @@ public void testCreateMetric() { LogMetric metricPb = METRIC_INFO.toPb(); Future response = Futures.immediateFuture(metricPb); CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setMetric(metricPb) .build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); @@ -533,7 +533,7 @@ public void testCreateMetricAsync() throws ExecutionException, InterruptedExcept LogMetric metricPb = METRIC_INFO.toPb(); Future response = Futures.immediateFuture(metricPb); CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setMetric(metricPb) .build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); @@ -671,7 +671,7 @@ public void testListMetrics() { EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of( new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO)), new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO))); @@ -693,9 +693,9 @@ public void testListMetricsNextPage() { EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request1 = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); ListLogMetricsRequest request2 = ListLogMetricsRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setPageToken(cursor1) .build(); List sinkList1 = ImmutableList.of( @@ -730,7 +730,7 @@ public void testListMetricsEmpty() { EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of(); ListLogMetricsResponse response = ListLogMetricsResponse.newBuilder() .setNextPageToken("") @@ -753,7 +753,7 @@ public void testListMetricsWithOptions() { ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder() .setPageToken(cursor) .setPageSize(42) - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .build(); List sinkList = ImmutableList.of( new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO)), @@ -776,7 +776,7 @@ public void testListMetricsAsync() throws ExecutionException, InterruptedExcepti EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of( new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO)), new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO))); @@ -798,9 +798,9 @@ public void testListMetricsAsyncNextPage() throws ExecutionException, Interrupte EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request1 = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); ListLogMetricsRequest request2 = ListLogMetricsRequest.newBuilder() - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .setPageToken(cursor1) .build(); List sinkList1 = ImmutableList.of( @@ -835,7 +835,7 @@ public void testListMetricsAsyncEmpty() throws ExecutionException, InterruptedEx EasyMock.replay(rpcFactoryMock); logging = options.service(); ListLogMetricsRequest request = - ListLogMetricsRequest.newBuilder().setProjectName(PROJECT_PB).build(); + ListLogMetricsRequest.newBuilder().setParent(PROJECT_PB).build(); List sinkList = ImmutableList.of(); ListLogMetricsResponse response = ListLogMetricsResponse.newBuilder() .setNextPageToken("") @@ -858,7 +858,7 @@ public void testListMetricsWithOptionsAsync() throws ExecutionException, Interru ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder() .setPageToken(cursor) .setPageSize(42) - .setProjectName(PROJECT_PB) + .setParent(PROJECT_PB) .build(); List sinkList = ImmutableList.of( new Metric(logging, new MetricInfo.BuilderImpl(METRIC_INFO)), diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java index 7d8eb0f15e79..199280657158 100644 --- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java +++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java @@ -11,31 +11,12 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.PageAccessor; import com.google.api.gax.grpc.ApiCallable; import com.google.api.gax.protobuf.PathTemplate; +import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.pubsub.v1.DeleteTopicRequest; import com.google.pubsub.v1.GetTopicRequest; @@ -54,9 +35,7 @@ import java.util.List; import java.util.concurrent.ScheduledExecutorService; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND SERVICE /** * Service Description: The service that an application uses to manipulate topics, and to send * messages to a topic. @@ -66,7 +45,7 @@ * *
  * 
- * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+ * try (PublisherApi publisherApi = PublisherApi.create()) {
  *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
  *   Topic response = publisherApi.createTopic(formattedName);
  * }
@@ -108,9 +87,6 @@
  * PublisherApi publisherApi = PublisherApi.create(publisherSettings);
  * 
  * 
- * - * - * */ @javax.annotation.Generated("by GAPIC") public class PublisherApi implements AutoCloseable { @@ -143,9 +119,6 @@ public final PublisherSettings getSettings() { /** * Formats a string containing the fully-qualified path to represent * a project resource. - * - * - * */ public static final String formatProjectName(String project) { return PROJECT_PATH_TEMPLATE.instantiate("project", project); @@ -154,20 +127,16 @@ public static final String formatProjectName(String project) { /** * Formats a string containing the fully-qualified path to represent * a topic resource. - * - * - * */ public static final String formatTopicName(String project, String topic) { - return TOPIC_PATH_TEMPLATE.instantiate("project", project, "topic", topic); + return TOPIC_PATH_TEMPLATE.instantiate( + "project", project, + "topic", topic); } /** * Parses the project from the given fully-qualified path which * represents a project resource. - * - * - * */ public static final String parseProjectFromProjectName(String projectName) { return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); @@ -176,9 +145,6 @@ public static final String parseProjectFromProjectName(String projectName) { /** * Parses the project from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseProjectFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("project"); @@ -187,9 +153,6 @@ public static final String parseProjectFromTopicName(String topicName) { /** * Parses the topic from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseTopicFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("topic"); @@ -197,11 +160,8 @@ public static final String parseTopicFromTopicName(String topicName) { /** * Constructs an instance of PublisherApi with default settings. - * - * - * */ - public static final PublisherApi createWithDefaults() throws IOException { + public static final PublisherApi create() throws IOException { return create(PublisherSettings.defaultBuilder().build()); } @@ -209,9 +169,6 @@ public static final PublisherApi createWithDefaults() throws IOException { * Constructs an instance of PublisherApi, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final PublisherApi create(PublisherSettings settings) throws IOException { return new PublisherApi(settings); @@ -221,9 +178,6 @@ public static final PublisherApi create(PublisherSettings settings) throws IOExc * Constructs an instance of PublisherApi, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected PublisherApi(PublisherSettings settings) throws IOException { this.settings = settings; @@ -271,23 +225,18 @@ public void close() throws IOException { } } - // ----- createTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = publisherApi.createTopic(formattedName);
    * }
    * 
* - * - * - * * @param name The name of the topic. It must have the format * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), @@ -297,18 +246,18 @@ public void close() throws IOException { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Topic createTopic(String name) { - TOPIC_PATH_TEMPLATE.validate(name); + TOPIC_PATH_TEMPLATE.validate(name, "createTopic"); Topic request = Topic.newBuilder().setName(name).build(); return createTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   Topic request = Topic.newBuilder()
    *     .setName(formattedName)
@@ -317,23 +266,20 @@ public final Topic createTopic(String name) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Topic createTopic(Topic request) { + private final Topic createTopic(Topic request) { return createTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   Topic request = Topic.newBuilder()
    *     .setName(formattedName)
@@ -343,57 +289,56 @@ private Topic createTopic(Topic request) {
    *   Topic response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable createTopicCallable() { return createTopicCallable; } - // ----- publish ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
-   *   List<PubsubMessage> messages = new ArrayList<>();
+   *   ByteString data = ByteString.copyFromUtf8("");
+   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
+   *     .setData(data)
+   *     .build();
+   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
    *   PublishResponse response = publisherApi.publish(formattedTopic, messages);
    * }
    * 
* - * - * - * * @param topic The messages in the request will be published on this topic. * @param messages The messages to publish. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PublishResponse publish(String topic, List messages) { - TOPIC_PATH_TEMPLATE.validate(topic); - + TOPIC_PATH_TEMPLATE.validate(topic, "publish"); PublishRequest request = PublishRequest.newBuilder().setTopic(topic).addAllMessages(messages).build(); return publish(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
-   *   List<PubsubMessage> messages = new ArrayList<>();
+   *   ByteString data = ByteString.copyFromUtf8("");
+   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
+   *     .setData(data)
+   *     .build();
+   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
    *   PublishRequest request = PublishRequest.newBuilder()
    *     .setTopic(formattedTopic)
    *     .addAllMessages(messages)
@@ -402,27 +347,28 @@ public final PublishResponse publish(String topic, List messages)
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public PublishResponse publish(PublishRequest request) { + public final PublishResponse publish(PublishRequest request) { return publishCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
-   *   List<PubsubMessage> messages = new ArrayList<>();
+   *   ByteString data = ByteString.copyFromUtf8("");
+   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
+   *     .setData(data)
+   *     .build();
+   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
    *   PublishRequest request = PublishRequest.newBuilder()
    *     .setTopic(formattedTopic)
    *     .addAllMessages(messages)
@@ -432,47 +378,39 @@ public PublishResponse publish(PublishRequest request) {
    *   PublishResponse response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable publishCallable() { return publishCallable; } - // ----- getTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = publisherApi.getTopic(formattedTopic);
    * }
    * 
* - * - * - * * @param topic The name of the topic to get. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Topic getTopic(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "getTopic"); GetTopicRequest request = GetTopicRequest.newBuilder().setTopic(topic).build(); return getTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   GetTopicRequest request = GetTopicRequest.newBuilder()
    *     .setTopic(formattedTopic)
@@ -481,23 +419,20 @@ public final Topic getTopic(String topic) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Topic getTopic(GetTopicRequest request) { + private final Topic getTopic(GetTopicRequest request) { return getTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   GetTopicRequest request = GetTopicRequest.newBuilder()
    *     .setTopic(formattedTopic)
@@ -507,62 +442,51 @@ private Topic getTopic(GetTopicRequest request) {
    *   Topic response = future.get();
    * }
    * 
- * - * - * */ public final ApiCallable getTopicCallable() { return getTopicCallable; } - // ----- listTopics ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
-   *   for (Topic elements : publisherApi.listTopics(formattedProject)) {
-   *     // doThingsWith(elements);
+   *   for (Topic element : publisherApi.listTopics(formattedProject)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param project The name of the cloud project that topics belong to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listTopics(String project) { - PROJECT_PATH_TEMPLATE.validate(project); + PROJECT_PATH_TEMPLATE.validate(project, "listTopics"); ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build(); return listTopics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
    *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
    *     .setProject(formattedProject)
    *     .build();
-   *   for (Topic elements : publisherApi.listTopics(request)) {
-   *     // doThingsWith(elements);
+   *   for (Topic element : publisherApi.listTopics(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -570,47 +494,44 @@ public final PageAccessor listTopics(ListTopicsRequest request) { return listTopicsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
    *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
    *     .setProject(formattedProject)
    *     .build();
    *   ListenableFuture<PageAccessor<Topic>> future = publisherApi.listTopicsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (Topic elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (Topic element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listTopicsPagedCallable() { return listTopicsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
    *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
    *     .setProject(formattedProject)
    *     .build();
    *   while (true) {
    *     ListTopicsResponse response = publisherApi.listTopicsCallable().call(request);
-   *     for (Topic elements : response.getTopicsList()) {
-   *       // doThingsWith(elements);
+   *     for (Topic element : response.getTopicsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -621,63 +542,52 @@ public final ApiCallable> listTopicsPaged
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listTopicsCallable() { return listTopicsCallable; } - // ----- listTopicSubscriptions ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
-   *   for (String elements : publisherApi.listTopicSubscriptions(formattedTopic)) {
-   *     // doThingsWith(elements);
+   *   for (String element : publisherApi.listTopicSubscriptions(formattedTopic)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param topic The name of the topic that subscriptions are attached to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listTopicSubscriptions(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "listTopicSubscriptions"); ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder().setTopic(topic).build(); return listTopicSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
    *     .setTopic(formattedTopic)
    *     .build();
-   *   for (String elements : publisherApi.listTopicSubscriptions(request)) {
-   *     // doThingsWith(elements);
+   *   for (String element : publisherApi.listTopicSubscriptions(request)) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -685,48 +595,45 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR return listTopicSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
    *     .setTopic(formattedTopic)
    *     .build();
    *   ListenableFuture<PageAccessor<String>> future = publisherApi.listTopicSubscriptionsPagedCallable().futureCall(request);
    *   // Do something
-   *   for (String elements : future.get()) {
-   *     // doThingsWith(elements);
+   *   for (String element : future.get()) {
+   *     // doThingsWith(element);
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable> listTopicSubscriptionsPagedCallable() { return listTopicSubscriptionsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
    *     .setTopic(formattedTopic)
    *     .build();
    *   while (true) {
    *     ListTopicSubscriptionsResponse response = publisherApi.listTopicSubscriptionsCallable().call(request);
-   *     for (String elements : response.getSubscriptionsList()) {
-   *       // doThingsWith(elements);
+   *     for (String element : response.getSubscriptionsList()) {
+   *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
@@ -737,20 +644,15 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR
    *   }
    * }
    * 
- * - * - * */ public final ApiCallable listTopicSubscriptionsCallable() { return listTopicSubscriptionsCallable; } - // ----- deleteTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -758,27 +660,24 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   publisherApi.deleteTopic(formattedTopic);
    * }
    * 
* - * - * - * * @param topic Name of the topic to delete. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteTopic(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "deleteTopic"); DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build(); deleteTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -786,7 +685,7 @@ public final void deleteTopic(String topic) { * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
    *     .setTopic(formattedTopic)
@@ -795,19 +694,16 @@ public final void deleteTopic(String topic) {
    * }
    * 
* - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteTopic(DeleteTopicRequest request) { + private final void deleteTopic(DeleteTopicRequest request) { deleteTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -815,7 +711,7 @@ private void deleteTopic(DeleteTopicRequest request) { * * Sample code: *

-   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
+   * try (PublisherApi publisherApi = PublisherApi.create()) {
    *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
    *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
    *     .setTopic(formattedTopic)
@@ -825,9 +721,6 @@ private void deleteTopic(DeleteTopicRequest request) {
    *   future.get();
    * }
    * 
- * - * - * */ public final ApiCallable deleteTopicCallable() { return deleteTopicCallable; @@ -836,9 +729,6 @@ public final ApiCallable deleteTopicCallable() { /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -846,9 +736,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java index 9e2b9941d741..f91bc59e9658 100644 --- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java +++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.ConnectionSettings; @@ -71,16 +51,14 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link PublisherApi}. * *

The default instance has everything set to sensible defaults: * *

    - *
  • The default service address (pubsub-experimental.googleapis.com) and default port (443) + *
  • The default service address (pubsub.googleapis.com) and default port (443) * are used. *
  • Credentials are acquired automatically through Application Default Credentials. *
  • Retries are configured for idempotent methods but not for non-idempotent methods. @@ -88,13 +66,13 @@ * *

    The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of CreateTopic to 30 seconds: + * object. For example, to set the total timeout of createTopic to 30 seconds: * *

      * 
      * PublisherSettings.Builder publisherSettingsBuilder =
      *     PublisherSettings.defaultBuilder();
    - * publisherSettingsBuilder.CreateTopicSettings().getRetrySettingsBuilder()
    + * publisherSettingsBuilder.createTopicSettings().getRetrySettingsBuilder()
      *     .setTotalTimeout(Duration.standardSeconds(30));
      * PublisherSettings publisherSettings = publisherSettingsBuilder.build();
      * 
    @@ -102,30 +80,23 @@
      */
     @javax.annotation.Generated("by GAPIC")
     public class PublisherSettings extends ServiceApiSettings {
    -
       /**
        * The default address of the service.
    -   *
    -   * 
    -   * 
        */
    -  public static final String DEFAULT_SERVICE_ADDRESS = "pubsub-experimental.googleapis.com";
    +  private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com";
     
       /**
        * The default port of the service.
    -   *
    -   * 
    -   * 
        */
    -  public static final int DEFAULT_SERVICE_PORT = 443;
    +  private static final int DEFAULT_SERVICE_PORT = 443;
     
       /**
        * The default scopes of the service.
        */
    -  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
    +  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
           ImmutableList.builder()
    -          .add("https://www.googleapis.com/auth/pubsub")
               .add("https://www.googleapis.com/auth/cloud-platform")
    +          .add("https://www.googleapis.com/auth/pubsub")
               .build();
     
       /**
    @@ -143,11 +114,9 @@ public class PublisherSettings extends ServiceApiSettings {
       private final SimpleCallSettings getTopicSettings;
       private final PageStreamingCallSettings
           listTopicsSettings;
    -
       private final PageStreamingCallSettings<
               ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
           listTopicSubscriptionsSettings;
    -
       private final SimpleCallSettings deleteTopicSettings;
     
       /**
    @@ -195,6 +164,27 @@ public SimpleCallSettings deleteTopicSettings() {
         return deleteTopicSettings;
       }
     
    +  /**
    +   * 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 scopes.
    +   */
    +  public static ImmutableList getDefaultServiceScopes() {
    +    return DEFAULT_SERVICE_SCOPES;
    +  }
    +
       /**
        * Returns a builder for this class with recommended defaults.
        */
    @@ -290,7 +280,7 @@ public Iterable extractResources(ListTopicSubscriptionsResponse payload)
           new BundlingDescriptor() {
             @Override
             public String getBundlePartitionKey(PublishRequest request) {
    -          return request.getTopic();
    +          return request.getTopic() + "|";
             }
     
             @Override
    @@ -373,6 +363,11 @@ public static class Builder extends ServiceApiSettings.Builder {
               Sets.immutableEnumSet(
                   Lists.newArrayList(
                       Status.Code.DEADLINE_EXCEEDED, Status.Code.UNAVAILABLE)));
    +      definitions.put(
    +          "one_plus_delivery",
    +          Sets.immutableEnumSet(
    +              Lists.newArrayList(
    +                  Status.Code.DEADLINE_EXCEEDED, Status.Code.UNAVAILABLE)));
           definitions.put("non_idempotent", Sets.immutableEnumSet(Lists.newArrayList()));
           RETRYABLE_CODE_DEFINITIONS = definitions.build();
         }
    @@ -385,13 +380,23 @@ public static class Builder extends ServiceApiSettings.Builder {
           settingsBuilder =
               RetrySettings.newBuilder()
                   .setInitialRetryDelay(Duration.millis(100L))
    -              .setRetryDelayMultiplier(1.2)
    -              .setMaxRetryDelay(Duration.millis(1000L))
    -              .setInitialRpcTimeout(Duration.millis(2000L))
    -              .setRpcTimeoutMultiplier(1.5)
    -              .setMaxRpcTimeout(Duration.millis(30000L))
    -              .setTotalTimeout(Duration.millis(45000L));
    +              .setRetryDelayMultiplier(1.3)
    +              .setMaxRetryDelay(Duration.millis(60000L))
    +              .setInitialRpcTimeout(Duration.millis(60000L))
    +              .setRpcTimeoutMultiplier(1.0)
    +              .setMaxRpcTimeout(Duration.millis(60000L))
    +              .setTotalTimeout(Duration.millis(600000L));
           definitions.put("default", settingsBuilder);
    +      settingsBuilder =
    +          RetrySettings.newBuilder()
    +              .setInitialRetryDelay(Duration.millis(100L))
    +              .setRetryDelayMultiplier(1.3)
    +              .setMaxRetryDelay(Duration.millis(60000L))
    +              .setInitialRpcTimeout(Duration.millis(12000L))
    +              .setRpcTimeoutMultiplier(1.0)
    +              .setMaxRpcTimeout(Duration.millis(12000L))
    +              .setTotalTimeout(Duration.millis(600000L));
    +      definitions.put("messaging", settingsBuilder);
           RETRY_PARAM_DEFINITIONS = definitions.build();
         }
     
    @@ -429,6 +434,7 @@ private Builder() {
     
         private static Builder createDefault() {
           Builder builder = new Builder();
    +
           builder
               .createTopicSettings()
               .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
    @@ -437,16 +443,16 @@ private static Builder createDefault() {
           builder
               .publishSettings()
               .getBundlingSettingsBuilder()
    -          .setElementCountThreshold(800)
    +          .setElementCountThreshold(10)
               .setElementCountLimit(1000)
    -          .setRequestByteThreshold(8388608)
    +          .setRequestByteThreshold(1024)
               .setRequestByteLimit(10485760)
    -          .setDelayThreshold(Duration.millis(100))
    +          .setDelayThreshold(Duration.millis(10))
               .setBlockingCallCountThreshold(1);
           builder
               .publishSettings()
    -          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
    -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
    +          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("one_plus_delivery"))
    +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
     
           builder
               .getTopicSettings()
    diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
    index bbb1bf629f8f..3952b74a3b73 100644
    --- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
    +++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
    @@ -11,26 +11,6 @@
      * or implied. See the License for the specific language governing permissions and limitations under
      * the License.
      */
    -
    -/*
    - * EDITING INSTRUCTIONS
    - * This file was generated from the file
    - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto
    - * and updates to that file get reflected here through a refresh process.
    - * For the short term, the refresh process will only be runnable by Google engineers.
    - * Manual additions are allowed because the refresh process performs
    - * a 3-way merge in order to preserve those manual additions. In order to not
    - * break the refresh process, only certain types of modifications are
    - * allowed.
    - *
    - * Allowed modifications - currently these are the only types allowed:
    - * 1. New methods (these should be added to the end of the class)
    - * 2. New imports
    - * 3. Additional documentation between "manual edit" demarcations
    - *
    - * Happy editing!
    - */
    -
     package com.google.cloud.pubsub.spi.v1;
     
     import com.google.api.gax.core.PageAccessor;
    @@ -55,9 +35,7 @@
     import java.util.List;
     import java.util.concurrent.ScheduledExecutorService;
     
    -// Manually-added imports: add custom (non-generated) imports after this point.
    -
    -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
    +// AUTO-GENERATED DOCUMENTATION AND SERVICE
     /**
      * Service Description: The service that an application uses to manipulate subscriptions and to
      * consume messages from a subscription via the `Pull` method.
    @@ -67,7 +45,7 @@
      *
      * 
      * 
    - * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    + * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
      *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
      *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
      *   PushConfig pushConfig = PushConfig.newBuilder().build();
    @@ -112,9 +90,6 @@
      * SubscriberApi subscriberApi = SubscriberApi.create(subscriberSettings);
      * 
      * 
    - * - * - * */ @javax.annotation.Generated("by GAPIC") public class SubscriberApi implements AutoCloseable { @@ -151,9 +126,6 @@ public final SubscriberSettings getSettings() { /** * Formats a string containing the fully-qualified path to represent * a project resource. - * - * - * */ public static final String formatProjectName(String project) { return PROJECT_PATH_TEMPLATE.instantiate("project", project); @@ -162,31 +134,26 @@ public static final String formatProjectName(String project) { /** * Formats a string containing the fully-qualified path to represent * a subscription resource. - * - * - * */ public static final String formatSubscriptionName(String project, String subscription) { - return SUBSCRIPTION_PATH_TEMPLATE.instantiate("project", project, "subscription", subscription); + return SUBSCRIPTION_PATH_TEMPLATE.instantiate( + "project", project, + "subscription", subscription); } /** * Formats a string containing the fully-qualified path to represent * a topic resource. - * - * - * */ public static final String formatTopicName(String project, String topic) { - return TOPIC_PATH_TEMPLATE.instantiate("project", project, "topic", topic); + return TOPIC_PATH_TEMPLATE.instantiate( + "project", project, + "topic", topic); } /** * Parses the project from the given fully-qualified path which * represents a project resource. - * - * - * */ public static final String parseProjectFromProjectName(String projectName) { return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); @@ -195,9 +162,6 @@ public static final String parseProjectFromProjectName(String projectName) { /** * Parses the project from the given fully-qualified path which * represents a subscription resource. - * - * - * */ public static final String parseProjectFromSubscriptionName(String subscriptionName) { return SUBSCRIPTION_PATH_TEMPLATE.parse(subscriptionName).get("project"); @@ -206,9 +170,6 @@ public static final String parseProjectFromSubscriptionName(String subscriptionN /** * Parses the subscription from the given fully-qualified path which * represents a subscription resource. - * - * - * */ public static final String parseSubscriptionFromSubscriptionName(String subscriptionName) { return SUBSCRIPTION_PATH_TEMPLATE.parse(subscriptionName).get("subscription"); @@ -217,9 +178,6 @@ public static final String parseSubscriptionFromSubscriptionName(String subscrip /** * Parses the project from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseProjectFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("project"); @@ -228,9 +186,6 @@ public static final String parseProjectFromTopicName(String topicName) { /** * Parses the topic from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseTopicFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("topic"); @@ -238,11 +193,8 @@ public static final String parseTopicFromTopicName(String topicName) { /** * Constructs an instance of SubscriberApi with default settings. - * - * - * */ - public static final SubscriberApi createWithDefaults() throws IOException { + public static final SubscriberApi create() throws IOException { return create(SubscriberSettings.defaultBuilder().build()); } @@ -250,9 +202,6 @@ public static final SubscriberApi createWithDefaults() throws IOException { * Constructs an instance of SubscriberApi, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final SubscriberApi create(SubscriberSettings settings) throws IOException { return new SubscriberApi(settings); @@ -262,9 +211,6 @@ public static final SubscriberApi create(SubscriberSettings settings) throws IOE * Constructs an instance of SubscriberApi, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected SubscriberApi(SubscriberSettings settings) throws IOException { this.settings = settings; @@ -310,20 +256,18 @@ public void close() throws IOException { } } - // ----- createSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
        *   PushConfig pushConfig = PushConfig.newBuilder().build();
    @@ -332,9 +276,6 @@ public void close() throws IOException {
        * }
        * 
    * - * - * - * * @param name The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must * start with a letter, and contain only letters (`[A-Za-z]`), numbers @@ -342,6 +283,8 @@ public void close() throws IOException { * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters * in length, and it must not start with `"goog"`. * @param topic The name of the topic from which this subscription is receiving messages. + * The value of this field will be `_deleted-topic_` if the topic has been + * deleted. * @param pushConfig If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. @@ -367,9 +310,8 @@ public void close() throws IOException { */ public final Subscription createSubscription( String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(name); - TOPIC_PATH_TEMPLATE.validate(topic); - + SUBSCRIPTION_PATH_TEMPLATE.validate(name, "createSubscription"); + TOPIC_PATH_TEMPLATE.validate(topic, "createSubscription"); Subscription request = Subscription.newBuilder() .setName(name) @@ -380,18 +322,18 @@ public final Subscription createSubscription( return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
        *   Subscription request = Subscription.newBuilder()
    @@ -402,28 +344,25 @@ public final Subscription createSubscription(
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public Subscription createSubscription(Subscription request) { + public final Subscription createSubscription(Subscription request) { return createSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
        *   Subscription request = Subscription.newBuilder()
    @@ -435,54 +374,40 @@ public Subscription createSubscription(Subscription request) {
        *   Subscription response = future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable createSubscriptionCallable() { return createSubscriptionCallable; } - // ----- getSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   Subscription response = subscriberApi.getSubscription(formattedSubscription);
        * }
        * 
    * - * - * - * * @param subscription The name of the subscription to get. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Subscription getSubscription(String subscription) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "getSubscription"); GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder().setSubscription(subscription).build(); return getSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
        *     .setSubscription(formattedSubscription)
    @@ -491,26 +416,20 @@ public final Subscription getSubscription(String subscription) {
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Subscription getSubscription(GetSubscriptionRequest request) { + private final Subscription getSubscription(GetSubscriptionRequest request) { return getSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
        *     .setSubscription(formattedSubscription)
    @@ -520,69 +439,52 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
        *   Subscription response = future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable getSubscriptionCallable() { return getSubscriptionCallable; } - // ----- listSubscriptions ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
    -   *   for (Subscription elements : subscriberApi.listSubscriptions(formattedProject)) {
    -   *     // doThingsWith(elements);
    +   *   for (Subscription element : subscriberApi.listSubscriptions(formattedProject)) {
    +   *     // doThingsWith(element);
        *   }
        * }
        * 
    * - * - * - * * @param project The name of the cloud project that subscriptions belong to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listSubscriptions(String project) { - PROJECT_PATH_TEMPLATE.validate(project); + PROJECT_PATH_TEMPLATE.validate(project, "listSubscriptions"); ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder().setProject(project).build(); return listSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
        *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
        *     .setProject(formattedProject)
        *     .build();
    -   *   for (Subscription elements : subscriberApi.listSubscriptions(request)) {
    -   *     // doThingsWith(elements);
    +   *   for (Subscription element : subscriberApi.listSubscriptions(request)) {
    +   *     // doThingsWith(element);
        *   }
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -590,54 +492,45 @@ public final PageAccessor listSubscriptions(ListSubscriptionsReque return listSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
        *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
        *     .setProject(formattedProject)
        *     .build();
        *   ListenableFuture<PageAccessor<Subscription>> future = subscriberApi.listSubscriptionsPagedCallable().futureCall(request);
        *   // Do something
    -   *   for (Subscription elements : future.get()) {
    -   *     // doThingsWith(elements);
    +   *   for (Subscription element : future.get()) {
    +   *     // doThingsWith(element);
        *   }
        * }
        * 
    - * - * - * */ public final ApiCallable> listSubscriptionsPagedCallable() { return listSubscriptionsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
        *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
        *     .setProject(formattedProject)
        *     .build();
        *   while (true) {
        *     ListSubscriptionsResponse response = subscriberApi.listSubscriptionsCallable().call(request);
    -   *     for (Subscription elements : response.getSubscriptionsList()) {
    -   *       // doThingsWith(elements);
    +   *     for (Subscription element : response.getSubscriptionsList()) {
    +   *       // doThingsWith(element);
        *     }
        *     String nextPageToken = response.getNextPageToken();
        *     if (!Strings.isNullOrEmpty(nextPageToken)) {
    @@ -648,57 +541,49 @@ public final PageAccessor listSubscriptions(ListSubscriptionsReque
        *   }
        * }
        * 
    - * - * - * */ public final ApiCallable listSubscriptionsCallable() { return listSubscriptionsCallable; } - // ----- deleteSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   subscriberApi.deleteSubscription(formattedSubscription);
        * }
        * 
    * - * - * - * * @param subscription The subscription to delete. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteSubscription(String subscription) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "deleteSubscription"); DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder().setSubscription(subscription).build(); deleteSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
        *     .setSubscription(formattedSubscription)
    @@ -707,27 +592,24 @@ public final void deleteSubscription(String subscription) {
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteSubscription(DeleteSubscriptionRequest request) { + private final void deleteSubscription(DeleteSubscriptionRequest request) { deleteSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
        *     .setSubscription(formattedSubscription)
    @@ -737,17 +619,12 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
        *   future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable deleteSubscriptionCallable() { return deleteSubscriptionCallable; } - // ----- modifyAckDeadline ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -756,7 +633,7 @@ public final ApiCallable deleteSubscriptionCal * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   int ackDeadlineSeconds = 0;
    @@ -764,9 +641,6 @@ public final ApiCallable deleteSubscriptionCal
        * }
        * 
    * - * - * - * * @param subscription The name of the subscription. * @param ackIds List of acknowledgment IDs. * @param ackDeadlineSeconds The new ack deadline with respect to the time this request was sent to @@ -778,8 +652,7 @@ public final ApiCallable deleteSubscriptionCal */ public final void modifyAckDeadline( String subscription, List ackIds, int ackDeadlineSeconds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "modifyAckDeadline"); ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder() .setSubscription(subscription) @@ -789,7 +662,7 @@ public final void modifyAckDeadline( modifyAckDeadline(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -798,7 +671,7 @@ public final void modifyAckDeadline( * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   int ackDeadlineSeconds = 0;
    @@ -811,17 +684,14 @@ public final void modifyAckDeadline(
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void modifyAckDeadline(ModifyAckDeadlineRequest request) { + public final void modifyAckDeadline(ModifyAckDeadlineRequest request) { modifyAckDeadlineCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -830,7 +700,7 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   int ackDeadlineSeconds = 0;
    @@ -844,17 +714,12 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
        *   future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable modifyAckDeadlineCallable() { return modifyAckDeadlineCallable; } - // ----- acknowledge ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -866,30 +731,26 @@ public final ApiCallable modifyAckDeadlineCalla * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   subscriberApi.acknowledge(formattedSubscription, ackIds);
        * }
        * 
    * - * - * - * * @param subscription The subscription whose message is being acknowledged. * @param ackIds The acknowledgment ID for the messages being acknowledged that was returned * by the Pub/Sub system in the `Pull` response. Must not be empty. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void acknowledge(String subscription, List ackIds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "acknowledge"); AcknowledgeRequest request = AcknowledgeRequest.newBuilder().setSubscription(subscription).addAllAckIds(ackIds).build(); acknowledge(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -901,7 +762,7 @@ public final void acknowledge(String subscription, List ackIds) { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
    @@ -912,17 +773,14 @@ public final void acknowledge(String subscription, List ackIds) {
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void acknowledge(AcknowledgeRequest request) { + public final void acknowledge(AcknowledgeRequest request) { acknowledgeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -934,7 +792,7 @@ public void acknowledge(AcknowledgeRequest request) { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   List<String> ackIds = new ArrayList<>();
        *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
    @@ -946,26 +804,21 @@ public void acknowledge(AcknowledgeRequest request) {
        *   future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable acknowledgeCallable() { return acknowledgeCallable; } - // ----- pull ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   boolean returnImmediately = false;
        *   int maxMessages = 0;
    @@ -973,21 +826,18 @@ public final ApiCallable acknowledgeCallable() {
        * }
        * 
    * - * - * - * * @param subscription The subscription from which messages should be pulled. * @param returnImmediately If this is specified as true the system will respond immediately even if * it is not able to return a message in the `Pull` response. Otherwise the * system is allowed to wait until at least one message is available rather - * than returning no messages. + * than returning no messages. The client may cancel the request if it does + * not wish to wait any longer for the response. * @param maxMessages The maximum number of messages returned for this request. The Pub/Sub * system may return fewer than the number specified. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "pull"); PullRequest request = PullRequest.newBuilder() .setSubscription(subscription) @@ -997,16 +847,16 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i return pull(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   int maxMessages = 0;
        *   PullRequest request = PullRequest.newBuilder()
    @@ -1017,26 +867,23 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public PullResponse pull(PullRequest request) { + public final PullResponse pull(PullRequest request) { return pullCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   int maxMessages = 0;
        *   PullRequest request = PullRequest.newBuilder()
    @@ -1048,17 +895,12 @@ public PullResponse pull(PullRequest request) {
        *   PullResponse response = future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable pullCallable() { return pullCallable; } - // ----- modifyPushConfig ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1069,16 +911,13 @@ public final ApiCallable pullCallable() { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   PushConfig pushConfig = PushConfig.newBuilder().build();
        *   subscriberApi.modifyPushConfig(formattedSubscription, pushConfig);
        * }
        * 
    * - * - * - * * @param subscription The name of the subscription. * @param pushConfig The push configuration for future deliveries. * @@ -1089,8 +928,7 @@ public final ApiCallable pullCallable() { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "modifyPushConfig"); ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder() .setSubscription(subscription) @@ -1099,7 +937,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { modifyPushConfig(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1110,7 +948,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   PushConfig pushConfig = PushConfig.newBuilder().build();
        *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
    @@ -1121,17 +959,14 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
        * }
        * 
    * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void modifyPushConfig(ModifyPushConfigRequest request) { + public final void modifyPushConfig(ModifyPushConfigRequest request) { modifyPushConfigCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1142,7 +977,7 @@ public void modifyPushConfig(ModifyPushConfigRequest request) { * * Sample code: *
    
    -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
    +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
        *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
        *   PushConfig pushConfig = PushConfig.newBuilder().build();
        *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
    @@ -1154,9 +989,6 @@ public void modifyPushConfig(ModifyPushConfigRequest request) {
        *   future.get();
        * }
        * 
    - * - * - * */ public final ApiCallable modifyPushConfigCallable() { return modifyPushConfigCallable; @@ -1165,9 +997,6 @@ public final ApiCallable modifyPushConfigCallabl /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -1175,9 +1004,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java index b7a34d966b26..1804008a6474 100644 --- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java +++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.ConnectionSettings; @@ -65,16 +45,14 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link SubscriberApi}. * *

    The default instance has everything set to sensible defaults: * *

      - *
    • The default service address (pubsub-experimental.googleapis.com) and default port (443) + *
    • The default service address (pubsub.googleapis.com) and default port (443) * are used. *
    • Credentials are acquired automatically through Application Default Credentials. *
    • Retries are configured for idempotent methods but not for non-idempotent methods. @@ -82,13 +60,13 @@ * *

      The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of CreateSubscription to 30 seconds: + * object. For example, to set the total timeout of createSubscription to 30 seconds: * *

        * 
        * SubscriberSettings.Builder subscriberSettingsBuilder =
        *     SubscriberSettings.defaultBuilder();
      - * subscriberSettingsBuilder.CreateSubscriptionSettings().getRetrySettingsBuilder()
      + * subscriberSettingsBuilder.createSubscriptionSettings().getRetrySettingsBuilder()
        *     .setTotalTimeout(Duration.standardSeconds(30));
        * SubscriberSettings subscriberSettings = subscriberSettingsBuilder.build();
        * 
      @@ -96,30 +74,23 @@
        */
       @javax.annotation.Generated("by GAPIC")
       public class SubscriberSettings extends ServiceApiSettings {
      -
         /**
          * The default address of the service.
      -   *
      -   * 
      -   * 
          */
      -  public static final String DEFAULT_SERVICE_ADDRESS = "pubsub-experimental.googleapis.com";
      +  private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com";
       
         /**
          * The default port of the service.
      -   *
      -   * 
      -   * 
          */
      -  public static final int DEFAULT_SERVICE_PORT = 443;
      +  private static final int DEFAULT_SERVICE_PORT = 443;
       
         /**
          * The default scopes of the service.
          */
      -  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
      +  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
             ImmutableList.builder()
      -          .add("https://www.googleapis.com/auth/pubsub")
                 .add("https://www.googleapis.com/auth/cloud-platform")
      +          .add("https://www.googleapis.com/auth/pubsub")
                 .build();
       
         /**
      @@ -137,7 +108,6 @@ public class SubscriberSettings extends ServiceApiSettings {
         private final PageStreamingCallSettings<
                 ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
             listSubscriptionsSettings;
      -
         private final SimpleCallSettings deleteSubscriptionSettings;
         private final SimpleCallSettings modifyAckDeadlineSettings;
         private final SimpleCallSettings acknowledgeSettings;
      @@ -202,6 +172,27 @@ public SimpleCallSettings modifyPushConfigSettin
           return modifyPushConfigSettings;
         }
       
      +  /**
      +   * 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 scopes.
      +   */
      +  public static ImmutableList getDefaultServiceScopes() {
      +    return DEFAULT_SERVICE_SCOPES;
      +  }
      +
         /**
          * Returns a builder for this class with recommended defaults.
          */
      @@ -310,13 +301,23 @@ public static class Builder extends ServiceApiSettings.Builder {
             settingsBuilder =
                 RetrySettings.newBuilder()
                     .setInitialRetryDelay(Duration.millis(100L))
      -              .setRetryDelayMultiplier(1.2)
      -              .setMaxRetryDelay(Duration.millis(1000L))
      -              .setInitialRpcTimeout(Duration.millis(2000L))
      -              .setRpcTimeoutMultiplier(1.5)
      -              .setMaxRpcTimeout(Duration.millis(30000L))
      -              .setTotalTimeout(Duration.millis(45000L));
      +              .setRetryDelayMultiplier(1.3)
      +              .setMaxRetryDelay(Duration.millis(60000L))
      +              .setInitialRpcTimeout(Duration.millis(60000L))
      +              .setRpcTimeoutMultiplier(1.0)
      +              .setMaxRpcTimeout(Duration.millis(60000L))
      +              .setTotalTimeout(Duration.millis(600000L));
             definitions.put("default", settingsBuilder);
      +      settingsBuilder =
      +          RetrySettings.newBuilder()
      +              .setInitialRetryDelay(Duration.millis(100L))
      +              .setRetryDelayMultiplier(1.3)
      +              .setMaxRetryDelay(Duration.millis(60000L))
      +              .setInitialRpcTimeout(Duration.millis(12000L))
      +              .setRpcTimeoutMultiplier(1.0)
      +              .setMaxRpcTimeout(Duration.millis(12000L))
      +              .setTotalTimeout(Duration.millis(600000L));
      +      definitions.put("messaging", settingsBuilder);
             RETRY_PARAM_DEFINITIONS = definitions.build();
           }
       
      @@ -360,9 +361,10 @@ private Builder() {
       
           private static Builder createDefault() {
             Builder builder = new Builder();
      +
             builder
                 .createSubscriptionSettings()
      -          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
      +          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
                 .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
       
             builder
      @@ -388,12 +390,12 @@ private static Builder createDefault() {
             builder
                 .acknowledgeSettings()
                 .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
      -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
      +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
       
             builder
                 .pullSettings()
                 .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
      -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
      +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
       
             builder
                 .modifyPushConfigSettings()
      diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java
      new file mode 100644
      index 000000000000..66324daa0162
      --- /dev/null
      +++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java
      @@ -0,0 +1,58 @@
      +/*
      + * Copyright 2016 Google Inc. All Rights Reserved.
      + *
      + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
      + * in compliance with the License. You may obtain a copy of the License at
      + *
      + * http://www.apache.org/licenses/LICENSE-2.0
      + *
      + * Unless required by applicable law or agreed to in writing, software distributed under the License
      + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
      + * or implied. See the License for the specific language governing permissions and limitations under
      + * the License.
      + */
      +
      +/**
      + * A client to Google Cloud Pub/Sub API.
      + *
      + * The interfaces provided are listed below, along with a usage sample
      + *
      + * =============
      + * SubscriberApi
      + * =============
      + *
      + * Service Description: The service that an application uses to manipulate subscriptions and to
      + * consume messages from a subscription via the `Pull` method.
      + *
      + * Sample for SubscriberApi:
      + * 
      + * 
      + * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
      + *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
      + *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
      + *   PushConfig pushConfig = PushConfig.newBuilder().build();
      + *   int ackDeadlineSeconds = 0;
      + *   Subscription response = subscriberApi.createSubscription(formattedName, formattedTopic, pushConfig, ackDeadlineSeconds);
      + * }
      + * 
      + * 
      + * + * ============ + * PublisherApi + * ============ + * + * Service Description: The service that an application uses to manipulate topics, and to send + * messages to a topic. + * + * Sample for PublisherApi: + *
      + * 
      + * try (PublisherApi publisherApi = PublisherApi.create()) {
      + *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
      + *   Topic response = publisherApi.createTopic(formattedName);
      + * }
      + * 
      + * 
      + * + */ +package com.google.cloud.pubsub.spi.v1; diff --git a/gcloud-java-pubsub/pom.xml b/gcloud-java-pubsub/pom.xml index 6d51a6444f66..e9657e41ee95 100644 --- a/gcloud-java-pubsub/pom.xml +++ b/gcloud-java-pubsub/pom.xml @@ -29,13 +29,13 @@ com.google.api.grpc - grpc-pubsub-v1 - 0.0.2 + grpc-google-pubsub-v1 + 0.0.7 io.grpc grpc-all - 0.14.1 + 0.15.0 com.google.auto.value diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java index cf10260ddeec..441264140327 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java @@ -20,6 +20,7 @@ import com.google.cloud.pubsub.spi.DefaultPubSubRpc; import com.google.cloud.pubsub.spi.PubSubRpc; import com.google.cloud.pubsub.spi.PubSubRpcFactory; +import com.google.cloud.pubsub.spi.v1.PublisherSettings; import com.google.common.collect.ImmutableSet; import java.io.IOException; @@ -31,7 +32,7 @@ public class PubSubOptions extends GrpcServiceOptions SCOPES = ImmutableSet.of(PUBSUB_SCOPE); - private static final String DEFAULT_HOST = "pubsub.googleapis.com"; + private static final String DEFAULT_HOST = PublisherSettings.getDefaultServiceAddress(); public static class DefaultPubSubFactory implements PubSubFactory { private static final PubSubFactory INSTANCE = new DefaultPubSubFactory(); diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java index 3ec3b284242c..0ae9c39b9c3c 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java @@ -142,15 +142,15 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException { GoogleCredentials credentials = options.authCredentials().credentials(); ConnectionSettings pubConnectionSettings = ConnectionSettings.newBuilder() .setServiceAddress(options.host()) - .setPort(PublisherSettings.DEFAULT_SERVICE_PORT) + .setPort(PublisherSettings.getDefaultServicePort()) .provideCredentialsWith( - credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES)) + credentials.createScoped(PublisherSettings.getDefaultServiceScopes())) .build(); ConnectionSettings subConnectionSettings = ConnectionSettings.newBuilder() .setServiceAddress(options.host()) - .setPort(SubscriberSettings.DEFAULT_SERVICE_PORT) + .setPort(SubscriberSettings.getDefaultServicePort()) .provideCredentialsWith( - credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES)) + credentials.createScoped(SubscriberSettings.getDefaultServiceScopes())) .build(); pubBuilder.provideChannelWith(pubConnectionSettings); subBuilder.provideChannelWith(subConnectionSettings); diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java index 7d8eb0f15e79..199280657158 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java @@ -11,31 +11,12 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.PageAccessor; import com.google.api.gax.grpc.ApiCallable; import com.google.api.gax.protobuf.PathTemplate; +import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.pubsub.v1.DeleteTopicRequest; import com.google.pubsub.v1.GetTopicRequest; @@ -54,9 +35,7 @@ import java.util.List; import java.util.concurrent.ScheduledExecutorService; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND SERVICE /** * Service Description: The service that an application uses to manipulate topics, and to send * messages to a topic. @@ -66,7 +45,7 @@ * *
        * 
      - * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      + * try (PublisherApi publisherApi = PublisherApi.create()) {
        *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
        *   Topic response = publisherApi.createTopic(formattedName);
        * }
      @@ -108,9 +87,6 @@
        * PublisherApi publisherApi = PublisherApi.create(publisherSettings);
        * 
        * 
      - * - * - * */ @javax.annotation.Generated("by GAPIC") public class PublisherApi implements AutoCloseable { @@ -143,9 +119,6 @@ public final PublisherSettings getSettings() { /** * Formats a string containing the fully-qualified path to represent * a project resource. - * - * - * */ public static final String formatProjectName(String project) { return PROJECT_PATH_TEMPLATE.instantiate("project", project); @@ -154,20 +127,16 @@ public static final String formatProjectName(String project) { /** * Formats a string containing the fully-qualified path to represent * a topic resource. - * - * - * */ public static final String formatTopicName(String project, String topic) { - return TOPIC_PATH_TEMPLATE.instantiate("project", project, "topic", topic); + return TOPIC_PATH_TEMPLATE.instantiate( + "project", project, + "topic", topic); } /** * Parses the project from the given fully-qualified path which * represents a project resource. - * - * - * */ public static final String parseProjectFromProjectName(String projectName) { return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); @@ -176,9 +145,6 @@ public static final String parseProjectFromProjectName(String projectName) { /** * Parses the project from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseProjectFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("project"); @@ -187,9 +153,6 @@ public static final String parseProjectFromTopicName(String topicName) { /** * Parses the topic from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseTopicFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("topic"); @@ -197,11 +160,8 @@ public static final String parseTopicFromTopicName(String topicName) { /** * Constructs an instance of PublisherApi with default settings. - * - * - * */ - public static final PublisherApi createWithDefaults() throws IOException { + public static final PublisherApi create() throws IOException { return create(PublisherSettings.defaultBuilder().build()); } @@ -209,9 +169,6 @@ public static final PublisherApi createWithDefaults() throws IOException { * Constructs an instance of PublisherApi, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final PublisherApi create(PublisherSettings settings) throws IOException { return new PublisherApi(settings); @@ -221,9 +178,6 @@ public static final PublisherApi create(PublisherSettings settings) throws IOExc * Constructs an instance of PublisherApi, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected PublisherApi(PublisherSettings settings) throws IOException { this.settings = settings; @@ -271,23 +225,18 @@ public void close() throws IOException { } } - // ----- createTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   Topic response = publisherApi.createTopic(formattedName);
          * }
          * 
      * - * - * - * * @param name The name of the topic. It must have the format * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), @@ -297,18 +246,18 @@ public void close() throws IOException { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Topic createTopic(String name) { - TOPIC_PATH_TEMPLATE.validate(name); + TOPIC_PATH_TEMPLATE.validate(name, "createTopic"); Topic request = Topic.newBuilder().setName(name).build(); return createTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   Topic request = Topic.newBuilder()
          *     .setName(formattedName)
      @@ -317,23 +266,20 @@ public final Topic createTopic(String name) {
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Topic createTopic(Topic request) { + private final Topic createTopic(Topic request) { return createTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates the given topic with the given name. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   Topic request = Topic.newBuilder()
          *     .setName(formattedName)
      @@ -343,57 +289,56 @@ private Topic createTopic(Topic request) {
          *   Topic response = future.get();
          * }
          * 
      - * - * - * */ public final ApiCallable createTopicCallable() { return createTopicCallable; } - // ----- publish ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
      -   *   List<PubsubMessage> messages = new ArrayList<>();
      +   *   ByteString data = ByteString.copyFromUtf8("");
      +   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
      +   *     .setData(data)
      +   *     .build();
      +   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
          *   PublishResponse response = publisherApi.publish(formattedTopic, messages);
          * }
          * 
      * - * - * - * * @param topic The messages in the request will be published on this topic. * @param messages The messages to publish. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PublishResponse publish(String topic, List messages) { - TOPIC_PATH_TEMPLATE.validate(topic); - + TOPIC_PATH_TEMPLATE.validate(topic, "publish"); PublishRequest request = PublishRequest.newBuilder().setTopic(topic).addAllMessages(messages).build(); return publish(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
      -   *   List<PubsubMessage> messages = new ArrayList<>();
      +   *   ByteString data = ByteString.copyFromUtf8("");
      +   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
      +   *     .setData(data)
      +   *     .build();
      +   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
          *   PublishRequest request = PublishRequest.newBuilder()
          *     .setTopic(formattedTopic)
          *     .addAllMessages(messages)
      @@ -402,27 +347,28 @@ public final PublishResponse publish(String topic, List messages)
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public PublishResponse publish(PublishRequest request) { + public final PublishResponse publish(PublishRequest request) { return publishCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic * does not exist. The message payload must not be empty; it must contain * either a non-empty data field, or at least one attribute. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
      -   *   List<PubsubMessage> messages = new ArrayList<>();
      +   *   ByteString data = ByteString.copyFromUtf8("");
      +   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
      +   *     .setData(data)
      +   *     .build();
      +   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
          *   PublishRequest request = PublishRequest.newBuilder()
          *     .setTopic(formattedTopic)
          *     .addAllMessages(messages)
      @@ -432,47 +378,39 @@ public PublishResponse publish(PublishRequest request) {
          *   PublishResponse response = future.get();
          * }
          * 
      - * - * - * */ public final ApiCallable publishCallable() { return publishCallable; } - // ----- getTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   Topic response = publisherApi.getTopic(formattedTopic);
          * }
          * 
      * - * - * - * * @param topic The name of the topic to get. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Topic getTopic(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "getTopic"); GetTopicRequest request = GetTopicRequest.newBuilder().setTopic(topic).build(); return getTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   GetTopicRequest request = GetTopicRequest.newBuilder()
          *     .setTopic(formattedTopic)
      @@ -481,23 +419,20 @@ public final Topic getTopic(String topic) {
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Topic getTopic(GetTopicRequest request) { + private final Topic getTopic(GetTopicRequest request) { return getTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration of a topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   GetTopicRequest request = GetTopicRequest.newBuilder()
          *     .setTopic(formattedTopic)
      @@ -507,62 +442,51 @@ private Topic getTopic(GetTopicRequest request) {
          *   Topic response = future.get();
          * }
          * 
      - * - * - * */ public final ApiCallable getTopicCallable() { return getTopicCallable; } - // ----- listTopics ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
      -   *   for (Topic elements : publisherApi.listTopics(formattedProject)) {
      -   *     // doThingsWith(elements);
      +   *   for (Topic element : publisherApi.listTopics(formattedProject)) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      * - * - * - * * @param project The name of the cloud project that topics belong to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listTopics(String project) { - PROJECT_PATH_TEMPLATE.validate(project); + PROJECT_PATH_TEMPLATE.validate(project, "listTopics"); ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build(); return listTopics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
          *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
          *     .setProject(formattedProject)
          *     .build();
      -   *   for (Topic elements : publisherApi.listTopics(request)) {
      -   *     // doThingsWith(elements);
      +   *   for (Topic element : publisherApi.listTopics(request)) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -570,47 +494,44 @@ public final PageAccessor listTopics(ListTopicsRequest request) { return listTopicsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
          *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
          *     .setProject(formattedProject)
          *     .build();
          *   ListenableFuture<PageAccessor<Topic>> future = publisherApi.listTopicsPagedCallable().futureCall(request);
          *   // Do something
      -   *   for (Topic elements : future.get()) {
      -   *     // doThingsWith(elements);
      +   *   for (Topic element : future.get()) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      - * - * - * */ public final ApiCallable> listTopicsPagedCallable() { return listTopicsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching topics. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedProject = PublisherApi.formatProjectName("[PROJECT]");
          *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
          *     .setProject(formattedProject)
          *     .build();
          *   while (true) {
          *     ListTopicsResponse response = publisherApi.listTopicsCallable().call(request);
      -   *     for (Topic elements : response.getTopicsList()) {
      -   *       // doThingsWith(elements);
      +   *     for (Topic element : response.getTopicsList()) {
      +   *       // doThingsWith(element);
          *     }
          *     String nextPageToken = response.getNextPageToken();
          *     if (!Strings.isNullOrEmpty(nextPageToken)) {
      @@ -621,63 +542,52 @@ public final ApiCallable> listTopicsPaged
          *   }
          * }
          * 
      - * - * - * */ public final ApiCallable listTopicsCallable() { return listTopicsCallable; } - // ----- listTopicSubscriptions ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
      -   *   for (String elements : publisherApi.listTopicSubscriptions(formattedTopic)) {
      -   *     // doThingsWith(elements);
      +   *   for (String element : publisherApi.listTopicSubscriptions(formattedTopic)) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      * - * - * - * * @param topic The name of the topic that subscriptions are attached to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listTopicSubscriptions(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "listTopicSubscriptions"); ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder().setTopic(topic).build(); return listTopicSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
          *     .setTopic(formattedTopic)
          *     .build();
      -   *   for (String elements : publisherApi.listTopicSubscriptions(request)) {
      -   *     // doThingsWith(elements);
      +   *   for (String element : publisherApi.listTopicSubscriptions(request)) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -685,48 +595,45 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR return listTopicSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
          *     .setTopic(formattedTopic)
          *     .build();
          *   ListenableFuture<PageAccessor<String>> future = publisherApi.listTopicSubscriptionsPagedCallable().futureCall(request);
          *   // Do something
      -   *   for (String elements : future.get()) {
      -   *     // doThingsWith(elements);
      +   *   for (String element : future.get()) {
      +   *     // doThingsWith(element);
          *   }
          * }
          * 
      - * - * - * */ public final ApiCallable> listTopicSubscriptionsPagedCallable() { return listTopicSubscriptionsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists the name of the subscriptions for this topic. * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
          *     .setTopic(formattedTopic)
          *     .build();
          *   while (true) {
          *     ListTopicSubscriptionsResponse response = publisherApi.listTopicSubscriptionsCallable().call(request);
      -   *     for (String elements : response.getSubscriptionsList()) {
      -   *       // doThingsWith(elements);
      +   *     for (String element : response.getSubscriptionsList()) {
      +   *       // doThingsWith(element);
          *     }
          *     String nextPageToken = response.getNextPageToken();
          *     if (!Strings.isNullOrEmpty(nextPageToken)) {
      @@ -737,20 +644,15 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR
          *   }
          * }
          * 
      - * - * - * */ public final ApiCallable listTopicSubscriptionsCallable() { return listTopicSubscriptionsCallable; } - // ----- deleteTopic ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -758,27 +660,24 @@ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsR * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   publisherApi.deleteTopic(formattedTopic);
          * }
          * 
      * - * - * - * * @param topic Name of the topic to delete. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteTopic(String topic) { - TOPIC_PATH_TEMPLATE.validate(topic); + TOPIC_PATH_TEMPLATE.validate(topic, "deleteTopic"); DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build(); deleteTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -786,7 +685,7 @@ public final void deleteTopic(String topic) { * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
          *     .setTopic(formattedTopic)
      @@ -795,19 +694,16 @@ public final void deleteTopic(String topic) {
          * }
          * 
      * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteTopic(DeleteTopicRequest request) { + private final void deleteTopic(DeleteTopicRequest request) { deleteTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes the topic with the given name. Generates `NOT_FOUND` if the topic + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic * does not exist. After a topic is deleted, a new topic may be created with * the same name; this is an entirely new topic with none of the old * configuration or subscriptions. Existing subscriptions to this topic are @@ -815,7 +711,7 @@ private void deleteTopic(DeleteTopicRequest request) { * * Sample code: *
      
      -   * try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
      +   * try (PublisherApi publisherApi = PublisherApi.create()) {
          *   String formattedTopic = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
          *     .setTopic(formattedTopic)
      @@ -825,9 +721,6 @@ private void deleteTopic(DeleteTopicRequest request) {
          *   future.get();
          * }
          * 
      - * - * - * */ public final ApiCallable deleteTopicCallable() { return deleteTopicCallable; @@ -836,9 +729,6 @@ public final ApiCallable deleteTopicCallable() { /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -846,9 +736,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java index 9e2b9941d741..f91bc59e9658 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.ConnectionSettings; @@ -71,16 +51,14 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link PublisherApi}. * *

      The default instance has everything set to sensible defaults: * *

        - *
      • The default service address (pubsub-experimental.googleapis.com) and default port (443) + *
      • The default service address (pubsub.googleapis.com) and default port (443) * are used. *
      • Credentials are acquired automatically through Application Default Credentials. *
      • Retries are configured for idempotent methods but not for non-idempotent methods. @@ -88,13 +66,13 @@ * *

        The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of CreateTopic to 30 seconds: + * object. For example, to set the total timeout of createTopic to 30 seconds: * *

          * 
          * PublisherSettings.Builder publisherSettingsBuilder =
          *     PublisherSettings.defaultBuilder();
        - * publisherSettingsBuilder.CreateTopicSettings().getRetrySettingsBuilder()
        + * publisherSettingsBuilder.createTopicSettings().getRetrySettingsBuilder()
          *     .setTotalTimeout(Duration.standardSeconds(30));
          * PublisherSettings publisherSettings = publisherSettingsBuilder.build();
          * 
        @@ -102,30 +80,23 @@
          */
         @javax.annotation.Generated("by GAPIC")
         public class PublisherSettings extends ServiceApiSettings {
        -
           /**
            * The default address of the service.
        -   *
        -   * 
        -   * 
            */
        -  public static final String DEFAULT_SERVICE_ADDRESS = "pubsub-experimental.googleapis.com";
        +  private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com";
         
           /**
            * The default port of the service.
        -   *
        -   * 
        -   * 
            */
        -  public static final int DEFAULT_SERVICE_PORT = 443;
        +  private static final int DEFAULT_SERVICE_PORT = 443;
         
           /**
            * The default scopes of the service.
            */
        -  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
        +  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
               ImmutableList.builder()
        -          .add("https://www.googleapis.com/auth/pubsub")
                   .add("https://www.googleapis.com/auth/cloud-platform")
        +          .add("https://www.googleapis.com/auth/pubsub")
                   .build();
         
           /**
        @@ -143,11 +114,9 @@ public class PublisherSettings extends ServiceApiSettings {
           private final SimpleCallSettings getTopicSettings;
           private final PageStreamingCallSettings
               listTopicsSettings;
        -
           private final PageStreamingCallSettings<
                   ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
               listTopicSubscriptionsSettings;
        -
           private final SimpleCallSettings deleteTopicSettings;
         
           /**
        @@ -195,6 +164,27 @@ public SimpleCallSettings deleteTopicSettings() {
             return deleteTopicSettings;
           }
         
        +  /**
        +   * 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 scopes.
        +   */
        +  public static ImmutableList getDefaultServiceScopes() {
        +    return DEFAULT_SERVICE_SCOPES;
        +  }
        +
           /**
            * Returns a builder for this class with recommended defaults.
            */
        @@ -290,7 +280,7 @@ public Iterable extractResources(ListTopicSubscriptionsResponse payload)
               new BundlingDescriptor() {
                 @Override
                 public String getBundlePartitionKey(PublishRequest request) {
        -          return request.getTopic();
        +          return request.getTopic() + "|";
                 }
         
                 @Override
        @@ -373,6 +363,11 @@ public static class Builder extends ServiceApiSettings.Builder {
                   Sets.immutableEnumSet(
                       Lists.newArrayList(
                           Status.Code.DEADLINE_EXCEEDED, Status.Code.UNAVAILABLE)));
        +      definitions.put(
        +          "one_plus_delivery",
        +          Sets.immutableEnumSet(
        +              Lists.newArrayList(
        +                  Status.Code.DEADLINE_EXCEEDED, Status.Code.UNAVAILABLE)));
               definitions.put("non_idempotent", Sets.immutableEnumSet(Lists.newArrayList()));
               RETRYABLE_CODE_DEFINITIONS = definitions.build();
             }
        @@ -385,13 +380,23 @@ public static class Builder extends ServiceApiSettings.Builder {
               settingsBuilder =
                   RetrySettings.newBuilder()
                       .setInitialRetryDelay(Duration.millis(100L))
        -              .setRetryDelayMultiplier(1.2)
        -              .setMaxRetryDelay(Duration.millis(1000L))
        -              .setInitialRpcTimeout(Duration.millis(2000L))
        -              .setRpcTimeoutMultiplier(1.5)
        -              .setMaxRpcTimeout(Duration.millis(30000L))
        -              .setTotalTimeout(Duration.millis(45000L));
        +              .setRetryDelayMultiplier(1.3)
        +              .setMaxRetryDelay(Duration.millis(60000L))
        +              .setInitialRpcTimeout(Duration.millis(60000L))
        +              .setRpcTimeoutMultiplier(1.0)
        +              .setMaxRpcTimeout(Duration.millis(60000L))
        +              .setTotalTimeout(Duration.millis(600000L));
               definitions.put("default", settingsBuilder);
        +      settingsBuilder =
        +          RetrySettings.newBuilder()
        +              .setInitialRetryDelay(Duration.millis(100L))
        +              .setRetryDelayMultiplier(1.3)
        +              .setMaxRetryDelay(Duration.millis(60000L))
        +              .setInitialRpcTimeout(Duration.millis(12000L))
        +              .setRpcTimeoutMultiplier(1.0)
        +              .setMaxRpcTimeout(Duration.millis(12000L))
        +              .setTotalTimeout(Duration.millis(600000L));
        +      definitions.put("messaging", settingsBuilder);
               RETRY_PARAM_DEFINITIONS = definitions.build();
             }
         
        @@ -429,6 +434,7 @@ private Builder() {
         
             private static Builder createDefault() {
               Builder builder = new Builder();
        +
               builder
                   .createTopicSettings()
                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
        @@ -437,16 +443,16 @@ private static Builder createDefault() {
               builder
                   .publishSettings()
                   .getBundlingSettingsBuilder()
        -          .setElementCountThreshold(800)
        +          .setElementCountThreshold(10)
                   .setElementCountLimit(1000)
        -          .setRequestByteThreshold(8388608)
        +          .setRequestByteThreshold(1024)
                   .setRequestByteLimit(10485760)
        -          .setDelayThreshold(Duration.millis(100))
        +          .setDelayThreshold(Duration.millis(10))
                   .setBlockingCallCountThreshold(1);
               builder
                   .publishSettings()
        -          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
        -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
        +          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("one_plus_delivery"))
        +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
         
               builder
                   .getTopicSettings()
        diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
        index bbb1bf629f8f..3952b74a3b73 100644
        --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
        +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
        @@ -11,26 +11,6 @@
          * or implied. See the License for the specific language governing permissions and limitations under
          * the License.
          */
        -
        -/*
        - * EDITING INSTRUCTIONS
        - * This file was generated from the file
        - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto
        - * and updates to that file get reflected here through a refresh process.
        - * For the short term, the refresh process will only be runnable by Google engineers.
        - * Manual additions are allowed because the refresh process performs
        - * a 3-way merge in order to preserve those manual additions. In order to not
        - * break the refresh process, only certain types of modifications are
        - * allowed.
        - *
        - * Allowed modifications - currently these are the only types allowed:
        - * 1. New methods (these should be added to the end of the class)
        - * 2. New imports
        - * 3. Additional documentation between "manual edit" demarcations
        - *
        - * Happy editing!
        - */
        -
         package com.google.cloud.pubsub.spi.v1;
         
         import com.google.api.gax.core.PageAccessor;
        @@ -55,9 +35,7 @@
         import java.util.List;
         import java.util.concurrent.ScheduledExecutorService;
         
        -// Manually-added imports: add custom (non-generated) imports after this point.
        -
        -// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
        +// AUTO-GENERATED DOCUMENTATION AND SERVICE
         /**
          * Service Description: The service that an application uses to manipulate subscriptions and to
          * consume messages from a subscription via the `Pull` method.
        @@ -67,7 +45,7 @@
          *
          * 
          * 
        - * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        + * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
          *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
          *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
          *   PushConfig pushConfig = PushConfig.newBuilder().build();
        @@ -112,9 +90,6 @@
          * SubscriberApi subscriberApi = SubscriberApi.create(subscriberSettings);
          * 
          * 
        - * - * - * */ @javax.annotation.Generated("by GAPIC") public class SubscriberApi implements AutoCloseable { @@ -151,9 +126,6 @@ public final SubscriberSettings getSettings() { /** * Formats a string containing the fully-qualified path to represent * a project resource. - * - * - * */ public static final String formatProjectName(String project) { return PROJECT_PATH_TEMPLATE.instantiate("project", project); @@ -162,31 +134,26 @@ public static final String formatProjectName(String project) { /** * Formats a string containing the fully-qualified path to represent * a subscription resource. - * - * - * */ public static final String formatSubscriptionName(String project, String subscription) { - return SUBSCRIPTION_PATH_TEMPLATE.instantiate("project", project, "subscription", subscription); + return SUBSCRIPTION_PATH_TEMPLATE.instantiate( + "project", project, + "subscription", subscription); } /** * Formats a string containing the fully-qualified path to represent * a topic resource. - * - * - * */ public static final String formatTopicName(String project, String topic) { - return TOPIC_PATH_TEMPLATE.instantiate("project", project, "topic", topic); + return TOPIC_PATH_TEMPLATE.instantiate( + "project", project, + "topic", topic); } /** * Parses the project from the given fully-qualified path which * represents a project resource. - * - * - * */ public static final String parseProjectFromProjectName(String projectName) { return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); @@ -195,9 +162,6 @@ public static final String parseProjectFromProjectName(String projectName) { /** * Parses the project from the given fully-qualified path which * represents a subscription resource. - * - * - * */ public static final String parseProjectFromSubscriptionName(String subscriptionName) { return SUBSCRIPTION_PATH_TEMPLATE.parse(subscriptionName).get("project"); @@ -206,9 +170,6 @@ public static final String parseProjectFromSubscriptionName(String subscriptionN /** * Parses the subscription from the given fully-qualified path which * represents a subscription resource. - * - * - * */ public static final String parseSubscriptionFromSubscriptionName(String subscriptionName) { return SUBSCRIPTION_PATH_TEMPLATE.parse(subscriptionName).get("subscription"); @@ -217,9 +178,6 @@ public static final String parseSubscriptionFromSubscriptionName(String subscrip /** * Parses the project from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseProjectFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("project"); @@ -228,9 +186,6 @@ public static final String parseProjectFromTopicName(String topicName) { /** * Parses the topic from the given fully-qualified path which * represents a topic resource. - * - * - * */ public static final String parseTopicFromTopicName(String topicName) { return TOPIC_PATH_TEMPLATE.parse(topicName).get("topic"); @@ -238,11 +193,8 @@ public static final String parseTopicFromTopicName(String topicName) { /** * Constructs an instance of SubscriberApi with default settings. - * - * - * */ - public static final SubscriberApi createWithDefaults() throws IOException { + public static final SubscriberApi create() throws IOException { return create(SubscriberSettings.defaultBuilder().build()); } @@ -250,9 +202,6 @@ public static final SubscriberApi createWithDefaults() throws IOException { * Constructs an instance of SubscriberApi, using the given settings. * The channels are created based on the settings passed in, or defaults for any * settings that are not set. - * - * - * */ public static final SubscriberApi create(SubscriberSettings settings) throws IOException { return new SubscriberApi(settings); @@ -262,9 +211,6 @@ public static final SubscriberApi create(SubscriberSettings settings) throws IOE * Constructs an instance of SubscriberApi, using the given settings. * This is protected so that it easy to make a subclass, but otherwise, the static * factory methods should be preferred. - * - * - * */ protected SubscriberApi(SubscriberSettings settings) throws IOException { this.settings = settings; @@ -310,20 +256,18 @@ public void close() throws IOException { } } - // ----- createSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
            *   PushConfig pushConfig = PushConfig.newBuilder().build();
        @@ -332,9 +276,6 @@ public void close() throws IOException {
            * }
            * 
        * - * - * - * * @param name The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must * start with a letter, and contain only letters (`[A-Za-z]`), numbers @@ -342,6 +283,8 @@ public void close() throws IOException { * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters * in length, and it must not start with `"goog"`. * @param topic The name of the topic from which this subscription is receiving messages. + * The value of this field will be `_deleted-topic_` if the topic has been + * deleted. * @param pushConfig If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. @@ -367,9 +310,8 @@ public void close() throws IOException { */ public final Subscription createSubscription( String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(name); - TOPIC_PATH_TEMPLATE.validate(topic); - + SUBSCRIPTION_PATH_TEMPLATE.validate(name, "createSubscription"); + TOPIC_PATH_TEMPLATE.validate(topic, "createSubscription"); Subscription request = Subscription.newBuilder() .setName(name) @@ -380,18 +322,18 @@ public final Subscription createSubscription( return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
            *   Subscription request = Subscription.newBuilder()
        @@ -402,28 +344,25 @@ public final Subscription createSubscription(
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public Subscription createSubscription(Subscription request) { + public final Subscription createSubscription(Subscription request) { return createSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a subscription to a given topic for a given subscriber. - * If the subscription already exists, generates `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, generates `NOT_FOUND`. + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. * * If the name is not provided in the request, the server will assign a random * name for this subscription on the same project as the topic. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
            *   Subscription request = Subscription.newBuilder()
        @@ -435,54 +374,40 @@ public Subscription createSubscription(Subscription request) {
            *   Subscription response = future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable createSubscriptionCallable() { return createSubscriptionCallable; } - // ----- getSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   Subscription response = subscriberApi.getSubscription(formattedSubscription);
            * }
            * 
        * - * - * - * * @param subscription The name of the subscription to get. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final Subscription getSubscription(String subscription) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "getSubscription"); GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder().setSubscription(subscription).build(); return getSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
            *     .setSubscription(formattedSubscription)
        @@ -491,26 +416,20 @@ public final Subscription getSubscription(String subscription) {
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private Subscription getSubscription(GetSubscriptionRequest request) { + private final Subscription getSubscription(GetSubscriptionRequest request) { return getSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Gets the configuration details of a subscription. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
            *     .setSubscription(formattedSubscription)
        @@ -520,69 +439,52 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
            *   Subscription response = future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable getSubscriptionCallable() { return getSubscriptionCallable; } - // ----- listSubscriptions ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
        -   *   for (Subscription elements : subscriberApi.listSubscriptions(formattedProject)) {
        -   *     // doThingsWith(elements);
        +   *   for (Subscription element : subscriberApi.listSubscriptions(formattedProject)) {
        +   *     // doThingsWith(element);
            *   }
            * }
            * 
        * - * - * - * * @param project The name of the cloud project that subscriptions belong to. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PageAccessor listSubscriptions(String project) { - PROJECT_PATH_TEMPLATE.validate(project); + PROJECT_PATH_TEMPLATE.validate(project, "listSubscriptions"); ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder().setProject(project).build(); return listSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
            *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
            *     .setProject(formattedProject)
            *     .build();
        -   *   for (Subscription elements : subscriberApi.listSubscriptions(request)) {
        -   *     // doThingsWith(elements);
        +   *   for (Subscription element : subscriberApi.listSubscriptions(request)) {
        +   *     // doThingsWith(element);
            *   }
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ @@ -590,54 +492,45 @@ public final PageAccessor listSubscriptions(ListSubscriptionsReque return listSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
            *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
            *     .setProject(formattedProject)
            *     .build();
            *   ListenableFuture<PageAccessor<Subscription>> future = subscriberApi.listSubscriptionsPagedCallable().futureCall(request);
            *   // Do something
        -   *   for (Subscription elements : future.get()) {
        -   *     // doThingsWith(elements);
        +   *   for (Subscription element : future.get()) {
        +   *     // doThingsWith(element);
            *   }
            * }
            * 
        - * - * - * */ public final ApiCallable> listSubscriptionsPagedCallable() { return listSubscriptionsPagedCallable; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Lists matching subscriptions. * - * If the topic of a subscription has been deleted, the subscription itself is - * not deleted, but the value of the `topic` field is set to `_deleted-topic_`. - * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedProject = SubscriberApi.formatProjectName("[PROJECT]");
            *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
            *     .setProject(formattedProject)
            *     .build();
            *   while (true) {
            *     ListSubscriptionsResponse response = subscriberApi.listSubscriptionsCallable().call(request);
        -   *     for (Subscription elements : response.getSubscriptionsList()) {
        -   *       // doThingsWith(elements);
        +   *     for (Subscription element : response.getSubscriptionsList()) {
        +   *       // doThingsWith(element);
            *     }
            *     String nextPageToken = response.getNextPageToken();
            *     if (!Strings.isNullOrEmpty(nextPageToken)) {
        @@ -648,57 +541,49 @@ public final PageAccessor listSubscriptions(ListSubscriptionsReque
            *   }
            * }
            * 
        - * - * - * */ public final ApiCallable listSubscriptionsCallable() { return listSubscriptionsCallable; } - // ----- deleteSubscription ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   subscriberApi.deleteSubscription(formattedSubscription);
            * }
            * 
        * - * - * - * * @param subscription The subscription to delete. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void deleteSubscription(String subscription) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "deleteSubscription"); DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder().setSubscription(subscription).build(); deleteSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
            *     .setSubscription(formattedSubscription)
        @@ -707,27 +592,24 @@ public final void deleteSubscription(String subscription) {
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - private void deleteSubscription(DeleteSubscriptionRequest request) { + private final void deleteSubscription(DeleteSubscriptionRequest request) { deleteSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Deletes an existing subscription. All pending messages in the subscription - * are immediately dropped. Calls to `Pull` after deletion will generate + * are immediately dropped. Calls to `Pull` after deletion will return * `NOT_FOUND`. After a subscription is deleted, a new one may be created with * the same name, but the new one has no association with the old * subscription, or its topic unless the same topic is specified. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
            *     .setSubscription(formattedSubscription)
        @@ -737,17 +619,12 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
            *   future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable deleteSubscriptionCallable() { return deleteSubscriptionCallable; } - // ----- modifyAckDeadline ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -756,7 +633,7 @@ public final ApiCallable deleteSubscriptionCal * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   int ackDeadlineSeconds = 0;
        @@ -764,9 +641,6 @@ public final ApiCallable deleteSubscriptionCal
            * }
            * 
        * - * - * - * * @param subscription The name of the subscription. * @param ackIds List of acknowledgment IDs. * @param ackDeadlineSeconds The new ack deadline with respect to the time this request was sent to @@ -778,8 +652,7 @@ public final ApiCallable deleteSubscriptionCal */ public final void modifyAckDeadline( String subscription, List ackIds, int ackDeadlineSeconds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "modifyAckDeadline"); ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder() .setSubscription(subscription) @@ -789,7 +662,7 @@ public final void modifyAckDeadline( modifyAckDeadline(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -798,7 +671,7 @@ public final void modifyAckDeadline( * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   int ackDeadlineSeconds = 0;
        @@ -811,17 +684,14 @@ public final void modifyAckDeadline(
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void modifyAckDeadline(ModifyAckDeadlineRequest request) { + public final void modifyAckDeadline(ModifyAckDeadlineRequest request) { modifyAckDeadlineCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the ack deadline for a specific message. This method is useful * to indicate that more time is needed to process a message by the @@ -830,7 +700,7 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   int ackDeadlineSeconds = 0;
        @@ -844,17 +714,12 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
            *   future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable modifyAckDeadlineCallable() { return modifyAckDeadlineCallable; } - // ----- acknowledge ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -866,30 +731,26 @@ public final ApiCallable modifyAckDeadlineCalla * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   subscriberApi.acknowledge(formattedSubscription, ackIds);
            * }
            * 
        * - * - * - * * @param subscription The subscription whose message is being acknowledged. * @param ackIds The acknowledgment ID for the messages being acknowledged that was returned * by the Pub/Sub system in the `Pull` response. Must not be empty. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void acknowledge(String subscription, List ackIds) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "acknowledge"); AcknowledgeRequest request = AcknowledgeRequest.newBuilder().setSubscription(subscription).addAllAckIds(ackIds).build(); acknowledge(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -901,7 +762,7 @@ public final void acknowledge(String subscription, List ackIds) { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
        @@ -912,17 +773,14 @@ public final void acknowledge(String subscription, List ackIds) {
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void acknowledge(AcknowledgeRequest request) { + public final void acknowledge(AcknowledgeRequest request) { acknowledgeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Acknowledges the messages associated with the `ack_ids` in the * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages @@ -934,7 +792,7 @@ public void acknowledge(AcknowledgeRequest request) { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   List<String> ackIds = new ArrayList<>();
            *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
        @@ -946,26 +804,21 @@ public void acknowledge(AcknowledgeRequest request) {
            *   future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable acknowledgeCallable() { return acknowledgeCallable; } - // ----- pull ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   boolean returnImmediately = false;
            *   int maxMessages = 0;
        @@ -973,21 +826,18 @@ public final ApiCallable acknowledgeCallable() {
            * }
            * 
        * - * - * - * * @param subscription The subscription from which messages should be pulled. * @param returnImmediately If this is specified as true the system will respond immediately even if * it is not able to return a message in the `Pull` response. Otherwise the * system is allowed to wait until at least one message is available rather - * than returning no messages. + * than returning no messages. The client may cancel the request if it does + * not wish to wait any longer for the response. * @param maxMessages The maximum number of messages returned for this request. The Pub/Sub * system may return fewer than the number specified. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "pull"); PullRequest request = PullRequest.newBuilder() .setSubscription(subscription) @@ -997,16 +847,16 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i return pull(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   int maxMessages = 0;
            *   PullRequest request = PullRequest.newBuilder()
        @@ -1017,26 +867,23 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public PullResponse pull(PullRequest request) { + public final PullResponse pull(PullRequest request) { return pullCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Pulls messages from the server. Returns an empty list if there are no - * messages available in the backlog. The server may generate `UNAVAILABLE` if + * messages available in the backlog. The server may return `UNAVAILABLE` if * there are too many concurrent pull requests pending for the given * subscription. * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   int maxMessages = 0;
            *   PullRequest request = PullRequest.newBuilder()
        @@ -1048,17 +895,12 @@ public PullResponse pull(PullRequest request) {
            *   PullResponse response = future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable pullCallable() { return pullCallable; } - // ----- modifyPushConfig ----- - - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1069,16 +911,13 @@ public final ApiCallable pullCallable() { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   PushConfig pushConfig = PushConfig.newBuilder().build();
            *   subscriberApi.modifyPushConfig(formattedSubscription, pushConfig);
            * }
            * 
        * - * - * - * * @param subscription The name of the subscription. * @param pushConfig The push configuration for future deliveries. * @@ -1089,8 +928,7 @@ public final ApiCallable pullCallable() { * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { - SUBSCRIPTION_PATH_TEMPLATE.validate(subscription); - + SUBSCRIPTION_PATH_TEMPLATE.validate(subscription, "modifyPushConfig"); ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder() .setSubscription(subscription) @@ -1099,7 +937,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { modifyPushConfig(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1110,7 +948,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   PushConfig pushConfig = PushConfig.newBuilder().build();
            *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
        @@ -1121,17 +959,14 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
            * }
            * 
        * - * - * - * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.grpc.ApiException if the remote call fails */ - public void modifyPushConfig(ModifyPushConfigRequest request) { + public final void modifyPushConfig(ModifyPushConfigRequest request) { modifyPushConfigCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing. + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Modifies the `PushConfig` for a specified subscription. * @@ -1142,7 +977,7 @@ public void modifyPushConfig(ModifyPushConfigRequest request) { * * Sample code: *
        
        -   * try (SubscriberApi subscriberApi = SubscriberApi.createWithDefaults()) {
        +   * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
            *   String formattedSubscription = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
            *   PushConfig pushConfig = PushConfig.newBuilder().build();
            *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
        @@ -1154,9 +989,6 @@ public void modifyPushConfig(ModifyPushConfigRequest request) {
            *   future.get();
            * }
            * 
        - * - * - * */ public final ApiCallable modifyPushConfigCallable() { return modifyPushConfigCallable; @@ -1165,9 +997,6 @@ public final ApiCallable modifyPushConfigCallabl /** * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately * cancelled. - * - * - * */ @Override public final void close() throws Exception { @@ -1175,9 +1004,4 @@ public final void close() throws Exception { closeable.close(); } } - - // ======== - // Manually-added methods: add custom (non-generated) methods after this point. - // ======== - } diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java index b7a34d966b26..1804008a6474 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java @@ -11,26 +11,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - -/* - * EDITING INSTRUCTIONS - * This file was generated from the file - * https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto - * and updates to that file get reflected here through a refresh process. - * For the short term, the refresh process will only be runnable by Google engineers. - * Manual additions are allowed because the refresh process performs - * a 3-way merge in order to preserve those manual additions. In order to not - * break the refresh process, only certain types of modifications are - * allowed. - * - * Allowed modifications - currently these are the only types allowed: - * 1. New methods (these should be added to the end of the class) - * 2. New imports - * 3. Additional documentation between "manual edit" demarcations - * - * Happy editing! - */ - package com.google.cloud.pubsub.spi.v1; import com.google.api.gax.core.ConnectionSettings; @@ -65,16 +45,14 @@ import java.util.concurrent.ScheduledExecutorService; import org.joda.time.Duration; -// Manually-added imports: add custom (non-generated) imports after this point. - -// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing. +// AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link SubscriberApi}. * *

        The default instance has everything set to sensible defaults: * *

          - *
        • The default service address (pubsub-experimental.googleapis.com) and default port (443) + *
        • The default service address (pubsub.googleapis.com) and default port (443) * are used. *
        • Credentials are acquired automatically through Application Default Credentials. *
        • Retries are configured for idempotent methods but not for non-idempotent methods. @@ -82,13 +60,13 @@ * *

          The builder of this class is recursive, so contained classes are themselves builders. * When build() is called, the tree of builders is called to create the complete settings - * object. For example, to set the total timeout of CreateSubscription to 30 seconds: + * object. For example, to set the total timeout of createSubscription to 30 seconds: * *

            * 
            * SubscriberSettings.Builder subscriberSettingsBuilder =
            *     SubscriberSettings.defaultBuilder();
          - * subscriberSettingsBuilder.CreateSubscriptionSettings().getRetrySettingsBuilder()
          + * subscriberSettingsBuilder.createSubscriptionSettings().getRetrySettingsBuilder()
            *     .setTotalTimeout(Duration.standardSeconds(30));
            * SubscriberSettings subscriberSettings = subscriberSettingsBuilder.build();
            * 
          @@ -96,30 +74,23 @@
            */
           @javax.annotation.Generated("by GAPIC")
           public class SubscriberSettings extends ServiceApiSettings {
          -
             /**
              * The default address of the service.
          -   *
          -   * 
          -   * 
              */
          -  public static final String DEFAULT_SERVICE_ADDRESS = "pubsub-experimental.googleapis.com";
          +  private static final String DEFAULT_SERVICE_ADDRESS = "pubsub.googleapis.com";
           
             /**
              * The default port of the service.
          -   *
          -   * 
          -   * 
              */
          -  public static final int DEFAULT_SERVICE_PORT = 443;
          +  private static final int DEFAULT_SERVICE_PORT = 443;
           
             /**
              * The default scopes of the service.
              */
          -  public static final ImmutableList DEFAULT_SERVICE_SCOPES =
          +  private static final ImmutableList DEFAULT_SERVICE_SCOPES =
                 ImmutableList.builder()
          -          .add("https://www.googleapis.com/auth/pubsub")
                     .add("https://www.googleapis.com/auth/cloud-platform")
          +          .add("https://www.googleapis.com/auth/pubsub")
                     .build();
           
             /**
          @@ -137,7 +108,6 @@ public class SubscriberSettings extends ServiceApiSettings {
             private final PageStreamingCallSettings<
                     ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
                 listSubscriptionsSettings;
          -
             private final SimpleCallSettings deleteSubscriptionSettings;
             private final SimpleCallSettings modifyAckDeadlineSettings;
             private final SimpleCallSettings acknowledgeSettings;
          @@ -202,6 +172,27 @@ public SimpleCallSettings modifyPushConfigSettin
               return modifyPushConfigSettings;
             }
           
          +  /**
          +   * 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 scopes.
          +   */
          +  public static ImmutableList getDefaultServiceScopes() {
          +    return DEFAULT_SERVICE_SCOPES;
          +  }
          +
             /**
              * Returns a builder for this class with recommended defaults.
              */
          @@ -310,13 +301,23 @@ public static class Builder extends ServiceApiSettings.Builder {
                 settingsBuilder =
                     RetrySettings.newBuilder()
                         .setInitialRetryDelay(Duration.millis(100L))
          -              .setRetryDelayMultiplier(1.2)
          -              .setMaxRetryDelay(Duration.millis(1000L))
          -              .setInitialRpcTimeout(Duration.millis(2000L))
          -              .setRpcTimeoutMultiplier(1.5)
          -              .setMaxRpcTimeout(Duration.millis(30000L))
          -              .setTotalTimeout(Duration.millis(45000L));
          +              .setRetryDelayMultiplier(1.3)
          +              .setMaxRetryDelay(Duration.millis(60000L))
          +              .setInitialRpcTimeout(Duration.millis(60000L))
          +              .setRpcTimeoutMultiplier(1.0)
          +              .setMaxRpcTimeout(Duration.millis(60000L))
          +              .setTotalTimeout(Duration.millis(600000L));
                 definitions.put("default", settingsBuilder);
          +      settingsBuilder =
          +          RetrySettings.newBuilder()
          +              .setInitialRetryDelay(Duration.millis(100L))
          +              .setRetryDelayMultiplier(1.3)
          +              .setMaxRetryDelay(Duration.millis(60000L))
          +              .setInitialRpcTimeout(Duration.millis(12000L))
          +              .setRpcTimeoutMultiplier(1.0)
          +              .setMaxRpcTimeout(Duration.millis(12000L))
          +              .setTotalTimeout(Duration.millis(600000L));
          +      definitions.put("messaging", settingsBuilder);
                 RETRY_PARAM_DEFINITIONS = definitions.build();
               }
           
          @@ -360,9 +361,10 @@ private Builder() {
           
               private static Builder createDefault() {
                 Builder builder = new Builder();
          +
                 builder
                     .createSubscriptionSettings()
          -          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
          +          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
                     .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
           
                 builder
          @@ -388,12 +390,12 @@ private static Builder createDefault() {
                 builder
                     .acknowledgeSettings()
                     .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
          -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
          +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
           
                 builder
                     .pullSettings()
                     .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
          -          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("default"));
          +          .setRetrySettingsBuilder(RETRY_PARAM_DEFINITIONS.get("messaging"));
           
                 builder
                     .modifyPushConfigSettings()
          diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java
          new file mode 100644
          index 000000000000..66324daa0162
          --- /dev/null
          +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/package-info.java
          @@ -0,0 +1,58 @@
          +/*
          + * Copyright 2016 Google Inc. All Rights Reserved.
          + *
          + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
          + * in compliance with the License. You may obtain a copy of the License at
          + *
          + * http://www.apache.org/licenses/LICENSE-2.0
          + *
          + * Unless required by applicable law or agreed to in writing, software distributed under the License
          + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
          + * or implied. See the License for the specific language governing permissions and limitations under
          + * the License.
          + */
          +
          +/**
          + * A client to Google Cloud Pub/Sub API.
          + *
          + * The interfaces provided are listed below, along with a usage sample
          + *
          + * =============
          + * SubscriberApi
          + * =============
          + *
          + * Service Description: The service that an application uses to manipulate subscriptions and to
          + * consume messages from a subscription via the `Pull` method.
          + *
          + * Sample for SubscriberApi:
          + * 
          + * 
          + * try (SubscriberApi subscriberApi = SubscriberApi.create()) {
          + *   String formattedName = SubscriberApi.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
          + *   String formattedTopic = SubscriberApi.formatTopicName("[PROJECT]", "[TOPIC]");
          + *   PushConfig pushConfig = PushConfig.newBuilder().build();
          + *   int ackDeadlineSeconds = 0;
          + *   Subscription response = subscriberApi.createSubscription(formattedName, formattedTopic, pushConfig, ackDeadlineSeconds);
          + * }
          + * 
          + * 
          + * + * ============ + * PublisherApi + * ============ + * + * Service Description: The service that an application uses to manipulate topics, and to send + * messages to a topic. + * + * Sample for PublisherApi: + *
          + * 
          + * try (PublisherApi publisherApi = PublisherApi.create()) {
          + *   String formattedName = PublisherApi.formatTopicName("[PROJECT]", "[TOPIC]");
          + *   Topic response = publisherApi.createTopic(formattedName);
          + * }
          + * 
          + * 
          + * + */ +package com.google.cloud.pubsub.spi.v1;