From 1d78fbc0ed8b93d745a27327e0c15383f9115a7f Mon Sep 17 00:00:00 2001 From: summerji Date: Thu, 21 Jan 2021 16:22:55 -0800 Subject: [PATCH 1/4] Refactor settings sample code and add unit test --- .../executionHistory/executionHistory.lock | Bin 0 -> 17 bytes .gradle/6.5/fileChanges/last-build.bin | Bin 0 -> 1 bytes .gradle/6.5/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes .gradle/6.5/gc.properties | 0 .../buildOutputCleanup.lock | Bin 0 -> 17 bytes .gradle/buildOutputCleanup/cache.properties | 2 + .gradle/checksums/checksums.lock | Bin 0 -> 17 bytes .gradle/vcs-1/gc.properties | 0 allclasses-frame.html | 22 + allclasses-noframe.html | 22 + ...ent.ListLogMetricsFixedSizeCollection.html | 246 ++++ .../v2/MetricsClient.ListLogMetricsPage.html | 261 ++++ ...icsClient.ListLogMetricsPagedResponse.html | 246 ++++ .../cloud/logging/v2/MetricsClient.html | 1169 +++++++++++++++++ .../cloud/logging/v2/package-frame.html | 23 + .../cloud/logging/v2/package-summary.html | 154 +++ com/google/cloud/logging/v2/package-tree.html | 138 ++ constant-values.html | 122 ++ deprecated-list.html | 122 ++ help-doc.html | 223 ++++ index-all.html | 303 +++++ index.html | 72 + overview-summary.html | 133 ++ overview-tree.html | 142 ++ package-list | 1 + script.js | 30 + .../ServiceSettingsClassComposer.java | 3 +- .../ServiceStubSettingsClassComposer.java | 3 +- .../SettingsSampleCodeComposer.java | 99 +- .../gapic/composer/samplecode/BUILD.bazel | 1 + .../SettingsSampleCodeComposerTest.java | 66 + stylesheet.css | 574 ++++++++ .../logging/ConfigServiceV2StubSettings.java | 8 +- .../logging/LoggingServiceV2StubSettings.java | 8 +- .../logging/MetricsServiceV2StubSettings.java | 8 +- 35 files changed, 4128 insertions(+), 73 deletions(-) create mode 100644 .gradle/6.5/executionHistory/executionHistory.lock create mode 100644 .gradle/6.5/fileChanges/last-build.bin create mode 100644 .gradle/6.5/fileHashes/fileHashes.lock create mode 100644 .gradle/6.5/gc.properties create mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 .gradle/buildOutputCleanup/cache.properties create mode 100644 .gradle/checksums/checksums.lock create mode 100644 .gradle/vcs-1/gc.properties create mode 100644 allclasses-frame.html create mode 100644 allclasses-noframe.html create mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html create mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html create mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html create mode 100644 com/google/cloud/logging/v2/MetricsClient.html create mode 100644 com/google/cloud/logging/v2/package-frame.html create mode 100644 com/google/cloud/logging/v2/package-summary.html create mode 100644 com/google/cloud/logging/v2/package-tree.html create mode 100644 constant-values.html create mode 100644 deprecated-list.html create mode 100644 help-doc.html create mode 100644 index-all.html create mode 100644 index.html create mode 100644 overview-summary.html create mode 100644 overview-tree.html create mode 100644 package-list create mode 100644 script.js create mode 100644 src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java create mode 100644 stylesheet.css diff --git a/.gradle/6.5/executionHistory/executionHistory.lock b/.gradle/6.5/executionHistory/executionHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..be1e8cf4e62f8074f26026fbcdb7600eac63fcea GIT binary patch literal 17 TcmZSXop&TsaeE{a0~7!NE{Fqv literal 0 HcmV?d00001 diff --git a/.gradle/6.5/fileChanges/last-build.bin b/.gradle/6.5/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/.gradle/6.5/fileHashes/fileHashes.lock b/.gradle/6.5/fileHashes/fileHashes.lock new file mode 100644 index 0000000000000000000000000000000000000000..87998231ec91a8a9cdc1e74e537eb30cabc5bb69 GIT binary patch literal 17 TcmZRU;XA%uRjlYN0~7!NB#HwT literal 0 HcmV?d00001 diff --git a/.gradle/6.5/gc.properties b/.gradle/6.5/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000000000000000000000000000000000000..b15489d40950c8bd4529b68ef86b1ef8f91a5948 GIT binary patch literal 17 TcmZR!=W;FIZ6Kt~00E2u8(#t{ literal 0 HcmV?d00001 diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000000..85c996f8fa --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Wed Jan 20 10:48:40 PST 2021 +gradle.version=6.5 diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..2ab0a3a62baa7c604f72c568e4cdb62d8c7f99cb GIT binary patch literal 17 ScmZR!&AOY&ka}H~0SW*q4+BB~ literal 0 HcmV?d00001 diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/allclasses-frame.html b/allclasses-frame.html new file mode 100644 index 0000000000..62c8dfd7db --- /dev/null +++ b/allclasses-frame.html @@ -0,0 +1,22 @@ + + + + + +All Classes + + + + + +

All Classes

+
+ +
+ + diff --git a/allclasses-noframe.html b/allclasses-noframe.html new file mode 100644 index 0000000000..7bdc7c7220 --- /dev/null +++ b/allclasses-noframe.html @@ -0,0 +1,22 @@ + + + + + +All Classes + + + + + +

All Classes

+
+ +
+ + diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html new file mode 100644 index 0000000000..8d06b985c2 --- /dev/null +++ b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html @@ -0,0 +1,246 @@ + + + + + +MetricsClient.ListLogMetricsFixedSizeCollection + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.google.cloud.logging.v2
+

Class MetricsClient.ListLogMetricsFixedSizeCollection

+
+
+ +
+
    +
  • +
    +
    Enclosing class:
    +
    MetricsClient
    +
    +
    +
    +
    public static class MetricsClient.ListLogMetricsFixedSizeCollection
    +extends <any>
    +
  • +
+
+
+ +
+
+ +
+
+ + +
+ + + + + + + +
+ + + + diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html new file mode 100644 index 0000000000..85bea71ee0 --- /dev/null +++ b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html @@ -0,0 +1,261 @@ + + + + + +MetricsClient.ListLogMetricsPage + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.google.cloud.logging.v2
+

Class MetricsClient.ListLogMetricsPage

+
+
+ +
+
    +
  • +
    +
    Enclosing class:
    +
    MetricsClient
    +
    +
    +
    +
    public static class MetricsClient.ListLogMetricsPage
    +extends <any>
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        createPageAsync

        +
        public <any> createPageAsync(<any> context,
        +                             <any> futureResponse)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html new file mode 100644 index 0000000000..12c1783572 --- /dev/null +++ b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html @@ -0,0 +1,246 @@ + + + + + +MetricsClient.ListLogMetricsPagedResponse + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.google.cloud.logging.v2
+

Class MetricsClient.ListLogMetricsPagedResponse

+
+
+ +
+
    +
  • +
    +
    Enclosing class:
    +
    MetricsClient
    +
    +
    +
    +
    public static class MetricsClient.ListLogMetricsPagedResponse
    +extends <any>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <any>createAsync(<any> context, + <any> futureResponse) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createAsync

        +
        public static <any> createAsync(<any> context,
        +                                <any> futureResponse)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/com/google/cloud/logging/v2/MetricsClient.html b/com/google/cloud/logging/v2/MetricsClient.html new file mode 100644 index 0000000000..336ed07cc5 --- /dev/null +++ b/com/google/cloud/logging/v2/MetricsClient.html @@ -0,0 +1,1169 @@ + + + + + +MetricsClient + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.google.cloud.logging.v2
+

Class MetricsClient

+
+
+ +
+
    +
  • +
    +
    +
    @Generated(value="by gapic-generator-java")
    +public class MetricsClient
    +extends java.lang.Object
    +
    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 (MetricsClient metricsClient = MetricsClient.create()) {
    +   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
    +   LogMetric response = metricsClient.getLogMetric(metricName);
    + }
    + 
    + +

    Note: close() needs to be called on the MetricsClient object to clean up resources such as + threads. In the example above, try-with-resources is used, which automatically calls close(). + +

    The surface of this class includes several types of Java methods for each of the API's + methods: + +

      +
    1. A "flattened" method. With this type of method, the fields of the request type have been + converted into function parameters. It may be the case that not all fields are available as + parameters, and not every API method will have a flattened method entry point. +
    2. A "request object" method. This type of method only takes one parameter, a request object, + which must be constructed before the call. Not every API method will have a request object + method. +
    3. A "callable" method. This type of method takes no parameters and returns an immutable API + callable object, which can be used to initiate calls to the service. +
    + +

    See the individual methods for example code. + +

    Many parameters require resource names to be formatted in a particular way. To assist with + these names, this class includes a format method for each type of name, and additionally a parse + method to extract the individual identifiers contained within names that are returned. + +

    This class can be customized by passing in a custom instance of MetricsSettings to create(). + For example: + +

    To customize credentials: + +

    
    + MetricsSettings metricsSettings =
    +     MetricsSettings.newBuilder()
    +         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
    +         .build();
    + MetricsClient metricsClient = MetricsClient.create(metricsSettings);
    + 
    + +

    To customize the endpoint: + +

    
    + MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
    + MetricsClient metricsClient = MetricsClient.create(metricsSettings);
    + 
    + +

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MetricsClient

        +
        protected MetricsClient(MetricsSettings settings)
        +                 throws java.io.IOException
        +
        Constructs an instance of MetricsClient, using the given settings. This is protected so that it + is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      + + + +
        +
      • +

        MetricsClient

        +
        protected MetricsClient(MetricsServiceV2Stub stub)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        create

        +
        public static final MetricsClient create()
        +                                  throws java.io.IOException
        +
        Constructs an instance of MetricsClient with default settings.
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      + + + +
        +
      • +

        create

        +
        public static final MetricsClient create(MetricsSettings settings)
        +                                  throws java.io.IOException
        +
        Constructs an instance of MetricsClient, using the given settings. The channels are created + based on the settings passed in, or defaults for any settings that are not set.
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      + + + +
        +
      • +

        create

        +
        public static final MetricsClient create(MetricsServiceV2Stub stub)
        +
        Constructs an instance of MetricsClient, using the given stub for making calls. This is for + advanced usage - prefer using create(MetricsSettings).
        +
      • +
      + + + +
        +
      • +

        getSettings

        +
        public final MetricsSettings getSettings()
        +
      • +
      + + + +
        +
      • +

        getStub

        +
        public MetricsServiceV2Stub getStub()
        +
      • +
      + + + +
        +
      • +

        listLogMetrics

        +
        public final MetricsClient.ListLogMetricsPagedResponse listLogMetrics(ProjectName parent)
        +
        Lists logs-based metrics. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   ProjectName parent = ProjectName.of("[PROJECT]");
        +   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
        +     // doThingsWith(element);
        +   }
        + }
        + 
        +
        +
        Parameters:
        +
        parent - Required. The name of the project containing the metrics: +

        "projects/[PROJECT_ID]"

        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        listLogMetrics

        +
        public final MetricsClient.ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest request)
        +
        Lists logs-based metrics. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   ListLogMetricsRequest request =
        +       ListLogMetricsRequest.newBuilder()
        +           .setParent(ProjectName.of("[PROJECT]").toString())
        +           .setPageToken("pageToken873572522")
        +           .setPageSize(883849137)
        +           .build();
        +   for (LogMetric element : metricsClient.listLogMetrics(request).iterateAll()) {
        +     // doThingsWith(element);
        +   }
        + }
        + 
        +
        +
        Parameters:
        +
        request - The request object containing all of the parameters for the API call.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        listLogMetricsPagedCallable

        +
        public final <any> listLogMetricsPagedCallable()
        +
        Lists logs-based metrics. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   ListLogMetricsRequest request =
        +       ListLogMetricsRequest.newBuilder()
        +           .setParent(ProjectName.of("[PROJECT]").toString())
        +           .setPageToken("pageToken873572522")
        +           .setPageSize(883849137)
        +           .build();
        +   ApiFuture<LogMetric> future = metricsClient.listLogMetricsPagedCallable().futureCall(request);
        +   // Do something.
        +   for (LogMetric element : future.get().iterateAll()) {
        +     // doThingsWith(element);
        +   }
        + }
        + 
        +
      • +
      + + + +
        +
      • +

        listLogMetricsCallable

        +
        public final <any> listLogMetricsCallable()
        +
        Lists logs-based metrics. + +

        Sample code:

        +
      • +
      + + + +
        +
      • +

        getLogMetric

        +
        public final LogMetric getLogMetric(LogMetricName metricName)
        +
        Gets a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        +   LogMetric response = metricsClient.getLogMetric(metricName);
        + }
        + 
        +
        +
        Parameters:
        +
        metricName - Required. The resource name of the desired metric: +

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        getLogMetric

        +
        public final LogMetric getLogMetric(java.lang.String metricName)
        +
        Gets a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        +   LogMetric response = metricsClient.getLogMetric(metricName);
        + }
        + 
        +
        +
        Parameters:
        +
        metricName - Required. The resource name of the desired metric: +

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        getLogMetric

        +
        public final LogMetric getLogMetric(GetLogMetricRequest request)
        +
        Gets a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   GetLogMetricRequest request =
        +       GetLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .build();
        +   LogMetric response = metricsClient.getLogMetric(request);
        + }
        + 
        +
        +
        Parameters:
        +
        request - The request object containing all of the parameters for the API call.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        getLogMetricCallable

        +
        public final <any> getLogMetricCallable()
        +
        Gets a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   GetLogMetricRequest request =
        +       GetLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .build();
        +   ApiFuture<LogMetric> future = metricsClient.getLogMetricCallable().futureCall(request);
        +   // Do something.
        +   LogMetric response = future.get();
        + }
        + 
        +
      • +
      + + + +
        +
      • +

        createLogMetric

        +
        public final LogMetric createLogMetric(ProjectName parent,
        +                                       LogMetric metric)
        +
        Creates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   ProjectName parent = ProjectName.of("[PROJECT]");
        +   LogMetric metric = LogMetric.newBuilder().build();
        +   LogMetric response = metricsClient.createLogMetric(parent, metric);
        + }
        + 
        +
        +
        Parameters:
        +
        parent - Required. The resource name of the project in which to create the metric: +

        "projects/[PROJECT_ID]" +

        The new metric must be provided in the request.

        +
        metric - Required. The new logs-based metric, which must not have an identifier that + already exists.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        createLogMetric

        +
        public final LogMetric createLogMetric(java.lang.String parent,
        +                                       LogMetric metric)
        +
        Creates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   String parent = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        +   LogMetric metric = LogMetric.newBuilder().build();
        +   LogMetric response = metricsClient.createLogMetric(parent, metric);
        + }
        + 
        +
        +
        Parameters:
        +
        parent - Required. The resource name of the project in which to create the metric: +

        "projects/[PROJECT_ID]" +

        The new metric must be provided in the request.

        +
        metric - Required. The new logs-based metric, which must not have an identifier that + already exists.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        createLogMetric

        +
        public final LogMetric createLogMetric(CreateLogMetricRequest request)
        +
        Creates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   CreateLogMetricRequest request =
        +       CreateLogMetricRequest.newBuilder()
        +           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .setMetric(LogMetric.newBuilder().build())
        +           .build();
        +   LogMetric response = metricsClient.createLogMetric(request);
        + }
        + 
        +
        +
        Parameters:
        +
        request - The request object containing all of the parameters for the API call.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        createLogMetricCallable

        +
        public final <any> createLogMetricCallable()
        +
        Creates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   CreateLogMetricRequest request =
        +       CreateLogMetricRequest.newBuilder()
        +           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .setMetric(LogMetric.newBuilder().build())
        +           .build();
        +   ApiFuture<LogMetric> future = metricsClient.createLogMetricCallable().futureCall(request);
        +   // Do something.
        +   LogMetric response = future.get();
        + }
        + 
        +
      • +
      + + + +
        +
      • +

        updateLogMetric

        +
        public final LogMetric updateLogMetric(LogMetricName metricName,
        +                                       LogMetric metric)
        +
        Creates or updates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        +   LogMetric metric = LogMetric.newBuilder().build();
        +   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
        + }
        + 
        +
        +
        Parameters:
        +
        metricName - Required. The resource name of the metric to update: +

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]" +

        The updated metric must be provided in the request and it's `name` field must be the + same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is + created.

        +
        metric - Required. The updated metric.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        updateLogMetric

        +
        public final LogMetric updateLogMetric(java.lang.String metricName,
        +                                       LogMetric metric)
        +
        Creates or updates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        +   LogMetric metric = LogMetric.newBuilder().build();
        +   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
        + }
        + 
        +
        +
        Parameters:
        +
        metricName - Required. The resource name of the metric to update: +

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]" +

        The updated metric must be provided in the request and it's `name` field must be the + same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is + created.

        +
        metric - Required. The updated metric.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        updateLogMetric

        +
        public final LogMetric updateLogMetric(UpdateLogMetricRequest request)
        +
        Creates or updates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   UpdateLogMetricRequest request =
        +       UpdateLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .setMetric(LogMetric.newBuilder().build())
        +           .build();
        +   LogMetric response = metricsClient.updateLogMetric(request);
        + }
        + 
        +
        +
        Parameters:
        +
        request - The request object containing all of the parameters for the API call.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        updateLogMetricCallable

        +
        public final <any> updateLogMetricCallable()
        +
        Creates or updates a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   UpdateLogMetricRequest request =
        +       UpdateLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .setMetric(LogMetric.newBuilder().build())
        +           .build();
        +   ApiFuture<LogMetric> future = metricsClient.updateLogMetricCallable().futureCall(request);
        +   // Do something.
        +   LogMetric response = future.get();
        + }
        + 
        +
      • +
      + + + +
        +
      • +

        deleteLogMetric

        +
        public final void deleteLogMetric(LogMetricName metricName)
        +
        Deletes a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        +   metricsClient.deleteLogMetric(metricName);
        + }
        + 
        +
        +
        Parameters:
        +
        metricName - Required. The resource name of the metric to delete: +

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        deleteLogMetric

        +
        public final void deleteLogMetric(DeleteLogMetricRequest request)
        +
        Deletes a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   DeleteLogMetricRequest request =
        +       DeleteLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .build();
        +   metricsClient.deleteLogMetric(request);
        + }
        + 
        +
        +
        Parameters:
        +
        request - The request object containing all of the parameters for the API call.
        +
        Throws:
        +
        com.google.api.gax.rpc.ApiException - if the remote call fails
        +
        +
      • +
      + + + +
        +
      • +

        deleteLogMetricCallable

        +
        public final <any> deleteLogMetricCallable()
        +
        Deletes a logs-based metric. + +

        Sample code: + +

        
        + try (MetricsClient metricsClient = MetricsClient.create()) {
        +   DeleteLogMetricRequest request =
        +       DeleteLogMetricRequest.newBuilder()
        +           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        +           .build();
        +   ApiFuture<Empty> future = metricsClient.deleteLogMetricCallable().futureCall(request);
        +   // Do something.
        +   future.get();
        + }
        + 
        +
      • +
      + + + +
        +
      • +

        close

        +
        public final void close()
        +
      • +
      + + + +
        +
      • +

        shutdown

        +
        public void shutdown()
        +
      • +
      + + + +
        +
      • +

        isShutdown

        +
        public boolean isShutdown()
        +
      • +
      + + + +
        +
      • +

        isTerminated

        +
        public boolean isTerminated()
        +
      • +
      + + + +
        +
      • +

        shutdownNow

        +
        public void shutdownNow()
        +
      • +
      + + + +
        +
      • +

        awaitTermination

        +
        public boolean awaitTermination(long duration,
        +                                java.util.concurrent.TimeUnit unit)
        +                         throws java.lang.InterruptedException
        +
        +
        Throws:
        +
        java.lang.InterruptedException
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/com/google/cloud/logging/v2/package-frame.html b/com/google/cloud/logging/v2/package-frame.html new file mode 100644 index 0000000000..63ae3a6a82 --- /dev/null +++ b/com/google/cloud/logging/v2/package-frame.html @@ -0,0 +1,23 @@ + + + + + +com.google.cloud.logging.v2 + + + + + +

com.google.cloud.logging.v2

+
+

Classes

+ +
+ + diff --git a/com/google/cloud/logging/v2/package-summary.html b/com/google/cloud/logging/v2/package-summary.html new file mode 100644 index 0000000000..a216249114 --- /dev/null +++ b/com/google/cloud/logging/v2/package-summary.html @@ -0,0 +1,154 @@ + + + + + +com.google.cloud.logging.v2 + + + + + + + + +
+ + + + + + + +
+ + +
+

Package com.google.cloud.logging.v2

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/com/google/cloud/logging/v2/package-tree.html b/com/google/cloud/logging/v2/package-tree.html new file mode 100644 index 0000000000..cd4ce04959 --- /dev/null +++ b/com/google/cloud/logging/v2/package-tree.html @@ -0,0 +1,138 @@ + + + + + +com.google.cloud.logging.v2 Class Hierarchy + + + + + + + + +
+ + + + + + + +
+ + +
+

Hierarchy For Package com.google.cloud.logging.v2

+
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/constant-values.html b/constant-values.html new file mode 100644 index 0000000000..2026ef44ea --- /dev/null +++ b/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
+ + +
+

Constant Field Values

+

Contents

+
+ +
+ + + + + + + +
+ + + + diff --git a/deprecated-list.html b/deprecated-list.html new file mode 100644 index 0000000000..a01204e286 --- /dev/null +++ b/deprecated-list.html @@ -0,0 +1,122 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
+ + + + diff --git a/help-doc.html b/help-doc.html new file mode 100644 index 0000000000..cf15b9f272 --- /dev/null +++ b/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+ +This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
+ + + + diff --git a/index-all.html b/index-all.html new file mode 100644 index 0000000000..a0e7569df5 --- /dev/null +++ b/index-all.html @@ -0,0 +1,303 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I L M S U  + + +

A

+
+
awaitTermination(long, TimeUnit) - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
+ + + +

C

+
+
close() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
com.google.cloud.logging.v2 - package com.google.cloud.logging.v2
+
 
+
create() - Static method in class com.google.cloud.logging.v2.MetricsClient
+
+
Constructs an instance of MetricsClient with default settings.
+
+
create(MetricsSettings) - Static method in class com.google.cloud.logging.v2.MetricsClient
+
+
Constructs an instance of MetricsClient, using the given settings.
+
+
create(MetricsServiceV2Stub) - Static method in class com.google.cloud.logging.v2.MetricsClient
+
+
Constructs an instance of MetricsClient, using the given stub for making calls.
+
+
createAsync(<any>, <any>) - Static method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPagedResponse
+
 
+
createCollection(List<MetricsClient.ListLogMetricsPage>, int) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsFixedSizeCollection
+
 
+
createLogMetric(ProjectName, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates a logs-based metric.
+
+
createLogMetric(String, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates a logs-based metric.
+
+
createLogMetric(CreateLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates a logs-based metric.
+
+
createLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates a logs-based metric.
+
+
createPage(<any>, ListLogMetricsResponse) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPage
+
 
+
createPageAsync(<any>, <any>) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPage
+
 
+
+ + + +

D

+
+
deleteLogMetric(LogMetricName) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Deletes a logs-based metric.
+
+
deleteLogMetric(DeleteLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Deletes a logs-based metric.
+
+
deleteLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Deletes a logs-based metric.
+
+
+ + + +

G

+
+
getLogMetric(LogMetricName) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Gets a logs-based metric.
+
+
getLogMetric(String) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Gets a logs-based metric.
+
+
getLogMetric(GetLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Gets a logs-based metric.
+
+
getLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Gets a logs-based metric.
+
+
getSettings() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
getStub() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
+ + + +

I

+
+
isShutdown() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
isTerminated() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
+ + + +

L

+
+
listLogMetrics(ProjectName) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Lists logs-based metrics.
+
+
listLogMetrics(ListLogMetricsRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Lists logs-based metrics.
+
+
listLogMetricsCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Lists logs-based metrics.
+
+
listLogMetricsPagedCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Lists logs-based metrics.
+
+
+ + + +

M

+
+
MetricsClient - Class in com.google.cloud.logging.v2
+
+
Service Description: Service for configuring logs-based metrics.
+
+
MetricsClient(MetricsSettings) - Constructor for class com.google.cloud.logging.v2.MetricsClient
+
+
Constructs an instance of MetricsClient, using the given settings.
+
+
MetricsClient(MetricsServiceV2Stub) - Constructor for class com.google.cloud.logging.v2.MetricsClient
+
 
+
MetricsClient.ListLogMetricsFixedSizeCollection - Class in com.google.cloud.logging.v2
+
 
+
MetricsClient.ListLogMetricsPage - Class in com.google.cloud.logging.v2
+
 
+
MetricsClient.ListLogMetricsPagedResponse - Class in com.google.cloud.logging.v2
+
 
+
+ + + +

S

+
+
shutdown() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
shutdownNow() - Method in class com.google.cloud.logging.v2.MetricsClient
+
 
+
+ + + +

U

+
+
updateLogMetric(LogMetricName, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates or updates a logs-based metric.
+
+
updateLogMetric(String, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates or updates a logs-based metric.
+
+
updateLogMetric(UpdateLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates or updates a logs-based metric.
+
+
updateLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
+
+
Creates or updates a logs-based metric.
+
+
+A C D G I L M S U 
+ +
+ + + + + + + +
+ + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000000..ea3f876b47 --- /dev/null +++ b/index.html @@ -0,0 +1,72 @@ + + + + + +Generated Documentation (Untitled) + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/overview-summary.html b/overview-summary.html new file mode 100644 index 0000000000..9744188eeb --- /dev/null +++ b/overview-summary.html @@ -0,0 +1,133 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + + + + + + + +
Packages 
PackageDescription
com.google.cloud.logging.v2 
+
+ +
+ + + + + + + +
+ + + + diff --git a/overview-tree.html b/overview-tree.html new file mode 100644 index 0000000000..0a20f6171d --- /dev/null +++ b/overview-tree.html @@ -0,0 +1,142 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/package-list b/package-list new file mode 100644 index 0000000000..006e1bf1ff --- /dev/null +++ b/package-list @@ -0,0 +1 @@ +com.google.cloud.logging.v2 diff --git a/script.js b/script.js new file mode 100644 index 0000000000..b346356931 --- /dev/null +++ b/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/src/main/java/com/google/api/generator/gapic/composer/ServiceSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/ServiceSettingsClassComposer.java index 37758868e0..229485efe6 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/ServiceSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/ServiceSettingsClassComposer.java @@ -139,7 +139,8 @@ private static List createClassHeaderComments( Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode(methodOpt, classType); + SettingsSampleCodeComposer.composeSampleCode( + methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceClientClassName(service), service.defaultHost(), diff --git a/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java index 2753fb6faf..45317be985 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java @@ -218,7 +218,8 @@ private static List createClassHeaderComments( Optional methodNameOpt = methodOpt.isPresent() ? Optional.of(methodOpt.get().name()) : Optional.empty(); Optional sampleCodeOpt = - SettingsSampleCodeComposer.composeSampleCode(methodOpt, classType); + SettingsSampleCodeComposer.composeSampleCode( + methodNameOpt, ClassNames.getServiceSettingsClassName(service), classType); return SettingsCommentComposer.createClassHeaderComments( ClassNames.getServiceStubClassName(service), diff --git a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java index b4ca4d73a7..9c554b0be0 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposer.java @@ -16,7 +16,6 @@ import com.google.api.generator.engine.ast.AssignmentExpr; import com.google.api.generator.engine.ast.ConcreteReference; -import com.google.api.generator.engine.ast.Expr; import com.google.api.generator.engine.ast.ExprStatement; import com.google.api.generator.engine.ast.MethodInvocationExpr; import com.google.api.generator.engine.ast.PrimitiveValue; @@ -26,8 +25,6 @@ import com.google.api.generator.engine.ast.VaporReference; import com.google.api.generator.engine.ast.Variable; import com.google.api.generator.engine.ast.VariableExpr; -import com.google.api.generator.engine.writer.JavaWriterVisitor; -import com.google.api.generator.gapic.model.Method; import com.google.api.generator.gapic.utils.JavaStyle; import java.time.Duration; import java.util.Arrays; @@ -36,21 +33,15 @@ import java.util.stream.Collectors; public final class SettingsSampleCodeComposer { - // TODO(summerji): Add unit tests - private static final String BUILDER_NAME_PATTERN = "%sBuilder"; - private static final String STUB = "Stub"; - private static final String EMPTY_STRING = ""; - - public static Optional composeSampleCode(Optional methodOpt, TypeNode classType) { - if (!methodOpt.isPresent()) { + public static Optional composeSampleCode( + Optional methodNameOpt, String settingsClassName, TypeNode classType) { + if (!methodNameOpt.isPresent()) { return Optional.empty(); } - Method method = methodOpt.get(); // Initialize services settingsBuilder with newBuilder() // e.g. FoobarSettings.Builder foobarSettingsBuilder = FoobarSettings.newBuilder(); - String className = classType.reference().name(); TypeNode builderType = TypeNode.withReference( VaporReference.builder() @@ -58,34 +49,44 @@ public static Optional composeSampleCode(Optional methodOpt, Typ .setName("Builder") .setPakkage(classType.reference().pakkage()) .build()); - Variable builderVar = - Variable.builder() - .setName(getClassSettingsBuilderName(className)) - .setType(builderType) - .build(); - VariableExpr localSettingsVarExpr = VariableExpr.withVariable(builderVar); - Expr settingsBuilderExpr = + VariableExpr localSettingsVarExpr = + VariableExpr.withVariable( + Variable.builder() + .setName(JavaStyle.toLowerCamelCase(String.format("%sBuilder", settingsClassName))) + .setType(builderType) + .build()); + MethodInvocationExpr settingsBuilderMethodInvocationExpr = MethodInvocationExpr.builder() .setStaticReferenceType(classType) .setMethodName("newBuilder") .setReturnType(builderType) .build(); - Expr initLocalSettingsExpr = + AssignmentExpr initLocalSettingsExpr = AssignmentExpr.builder() .setVariableExpr(localSettingsVarExpr.toBuilder().setIsDecl(true).build()) - .setValueExpr(settingsBuilderExpr) + .setValueExpr(settingsBuilderMethodInvocationExpr) .build(); // Builder with set value method // e.g foobarSettingBuilder.fooSetting().setRetrySettings( // echoSettingsBuilder.echoSettings().getRetrySettings().toBuilder().setTotalTimeout(Duration.ofSeconds(30)).build()); - MethodInvocationExpr retrySettingsMethodExpr = + MethodInvocationExpr settingBuilderMethodInvocationExpr = MethodInvocationExpr.builder() .setExprReferenceExpr(localSettingsVarExpr) - .setMethodName(JavaStyle.toLowerCamelCase(String.format("%sSettings", method.name()))) - .setReturnType(method.outputType()) + .setMethodName( + JavaStyle.toLowerCamelCase(String.format("%sSettings", methodNameOpt.get()))) + .build(); + MethodInvocationExpr retrySettingsArgExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(settingBuilderMethodInvocationExpr) + .setMethodName("getRetrySettings") + .build(); + retrySettingsArgExpr = + MethodInvocationExpr.builder() + .setExprReferenceExpr(retrySettingsArgExpr) + .setMethodName("toBuilder") .build(); - MethodInvocationExpr timeoutArExpr = + MethodInvocationExpr ofSecondMethodInvocationExpr = MethodInvocationExpr.builder() .setStaticReferenceType( TypeNode.withReference(ConcreteReference.withClazz(Duration.class))) @@ -94,30 +95,22 @@ public static Optional composeSampleCode(Optional methodOpt, Typ ValueExpr.withValue( PrimitiveValue.builder().setType(TypeNode.INT).setValue("30").build())) .build(); - MethodInvocationExpr timeoutBuilderMethodExpr = + retrySettingsArgExpr = MethodInvocationExpr.builder() - .setExprReferenceExpr( - MethodInvocationExpr.builder() - .setExprReferenceExpr( - MethodInvocationExpr.builder() - .setExprReferenceExpr(retrySettingsMethodExpr) - .setMethodName("getRetrySettings") - .build()) - .setMethodName("toBuilder") - .build()) + .setExprReferenceExpr(retrySettingsArgExpr) .setMethodName("setTotalTimeout") - .setArguments(Arrays.asList(timeoutArExpr)) + .setArguments(ofSecondMethodInvocationExpr) .build(); - MethodInvocationExpr retrySettingsArgExpr = + retrySettingsArgExpr = MethodInvocationExpr.builder() - .setExprReferenceExpr(timeoutBuilderMethodExpr) + .setExprReferenceExpr(retrySettingsArgExpr) .setMethodName("build") .build(); - MethodInvocationExpr settingBuilderMethodExpr = + settingBuilderMethodInvocationExpr = MethodInvocationExpr.builder() - .setExprReferenceExpr(retrySettingsMethodExpr) + .setExprReferenceExpr(settingBuilderMethodInvocationExpr) .setMethodName("setRetrySettings") - .setArguments(Arrays.asList(retrySettingsArgExpr)) + .setArguments(retrySettingsArgExpr) .build(); // Initialize clientSetting with builder() method. @@ -126,7 +119,7 @@ public static Optional composeSampleCode(Optional methodOpt, Typ VariableExpr.withVariable( Variable.builder() .setType(classType) - .setName(JavaStyle.toLowerCamelCase(className).replace("Stub", "")) + .setName(JavaStyle.toLowerCamelCase(settingsClassName)) .build()); AssignmentExpr settingBuildAssignmentExpr = AssignmentExpr.builder() @@ -140,25 +133,13 @@ public static Optional composeSampleCode(Optional methodOpt, Typ .build(); List statements = - Arrays.asList(initLocalSettingsExpr, settingBuilderMethodExpr, settingBuildAssignmentExpr) + Arrays.asList( + initLocalSettingsExpr, + settingBuilderMethodInvocationExpr, + settingBuildAssignmentExpr) .stream() .map(e -> ExprStatement.withExpr(e)) .collect(Collectors.toList()); - return Optional.of(SampleCodeJavaFormatter.format(writeStatements(statements))); - } - - private static String getClassSettingsBuilderName(String className) { - return JavaStyle.toLowerCamelCase( - String.format(BUILDER_NAME_PATTERN, JavaStyle.toLowerCamelCase(className))) - .replace(STUB, EMPTY_STRING); - } - - // TODO(summerji): Refactor to use writeSampleCode method after PR#499 merged. - private static String writeStatements(List statements) { - JavaWriterVisitor visitor = new JavaWriterVisitor(); - for (Statement statement : statements) { - statement.accept(visitor); - } - return visitor.write(); + return Optional.of(SampleCodeWriter.write(statements)); } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel b/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel index f5135007ec..7a1cdbb61c 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/BUILD.bazel @@ -6,6 +6,7 @@ TESTS = [ "SampleCodeJavaFormatterTest", "SampleCodeWriterTest", "ServiceClientSampleCodeComposerTest", + "SettingsSampleCodeComposerTest", ] filegroup( diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java new file mode 100644 index 0000000000..af0b2aa48a --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java @@ -0,0 +1,66 @@ +package com.google.api.generator.gapic.composer.samplecode; + +import static junit.framework.Assert.assertEquals; + +import com.google.api.generator.engine.ast.TypeNode; +import com.google.api.generator.engine.ast.VaporReference; +import com.google.api.generator.testutils.LineFormatter; +import java.util.Optional; +import org.junit.Test; + +public class SettingsSampleCodeComposerTest { + @Test + public void composeSettingsSampleCode_noMethods() { + TypeNode classType = TypeNode.withReference(VaporReference.builder() + .setName("EchoSettings") + .setPakkage("com.google.showcase.v1beta1") + .build()); + Optional results = SettingsSampleCodeComposer.composeSampleCode(Optional.empty(), "EchoSettings", classType); + assertEquals(results, Optional.empty()); + } + + @Test + public void composeSettingsSampleCode_serviceSettingsClass() { + TypeNode classType = TypeNode.withReference(VaporReference.builder() + .setName("EchoSettings") + .setPakkage("com.google.showcase.v1beta1") + .build()); + Optional results = SettingsSampleCodeComposer.composeSampleCode(Optional.of("Echo"), "EchoSettings", classType); + String expected = LineFormatter.lines( + "EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder();\n", + "echoSettingsBuilder\n", + " .echoSettings()\n", + " .setRetrySettings(\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .getRetrySettings()\n", + " .toBuilder()\n", + " .setTotalTimeout(Duration.ofSeconds(30))\n", + " .build());\n", + "EchoSettings echoSettings = echoSettingsBuilder.build();"); + assertEquals(results.get(), expected); + } + + @Test + public void composeSettingsSampleCode_serviceStubClass() { + TypeNode classType = TypeNode.withReference(VaporReference.builder() + .setName("EchoStubSettings") + .setPakkage("com.google.showcase.v1beta1") + .build()); + Optional results = SettingsSampleCodeComposer.composeSampleCode(Optional.of("Echo"), "EchoSettings", classType); + String expected = LineFormatter.lines( + "EchoStubSettings.Builder echoSettingsBuilder = EchoStubSettings.newBuilder();\n", + "echoSettingsBuilder\n", + " .echoSettings()\n", + " .setRetrySettings(\n", + " echoSettingsBuilder\n", + " .echoSettings()\n", + " .getRetrySettings()\n", + " .toBuilder()\n", + " .setTotalTimeout(Duration.ofSeconds(30))\n", + " .build());\n", + "EchoStubSettings echoSettings = echoSettingsBuilder.build();"); + assertEquals(results.get(), expected); + } + +} diff --git a/stylesheet.css b/stylesheet.css new file mode 100644 index 0000000000..98055b22d6 --- /dev/null +++ b/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/test/integration/goldens/logging/ConfigServiceV2StubSettings.java b/test/integration/goldens/logging/ConfigServiceV2StubSettings.java index 9665b4956b..353b972407 100644 --- a/test/integration/goldens/logging/ConfigServiceV2StubSettings.java +++ b/test/integration/goldens/logging/ConfigServiceV2StubSettings.java @@ -92,18 +92,18 @@ *

For example, to set the total timeout of getBucket to 30 seconds: * *

{@code
- * ConfigServiceV2StubSettings.Builder configServiceV2SettingsBuilder =
+ * ConfigServiceV2StubSettings.Builder configSettingsBuilder =
  *     ConfigServiceV2StubSettings.newBuilder();
- * configServiceV2SettingsBuilder
+ * configSettingsBuilder
  *     .getBucketSettings()
  *     .setRetrySettings(
- *         configServiceV2SettingsBuilder
+ *         configSettingsBuilder
  *             .getBucketSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * ConfigServiceV2StubSettings configServiceV2Settings = configServiceV2SettingsBuilder.build();
+ * ConfigServiceV2StubSettings configSettings = configSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/LoggingServiceV2StubSettings.java b/test/integration/goldens/logging/LoggingServiceV2StubSettings.java index e62a198503..c956de3687 100644 --- a/test/integration/goldens/logging/LoggingServiceV2StubSettings.java +++ b/test/integration/goldens/logging/LoggingServiceV2StubSettings.java @@ -90,18 +90,18 @@ *

For example, to set the total timeout of deleteLog to 30 seconds: * *

{@code
- * LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
+ * LoggingServiceV2StubSettings.Builder loggingSettingsBuilder =
  *     LoggingServiceV2StubSettings.newBuilder();
- * loggingServiceV2SettingsBuilder
+ * loggingSettingsBuilder
  *     .deleteLogSettings()
  *     .setRetrySettings(
- *         loggingServiceV2SettingsBuilder
+ *         loggingSettingsBuilder
  *             .deleteLogSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * LoggingServiceV2StubSettings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+ * LoggingServiceV2StubSettings loggingSettings = loggingSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") diff --git a/test/integration/goldens/logging/MetricsServiceV2StubSettings.java b/test/integration/goldens/logging/MetricsServiceV2StubSettings.java index c3b691f2c6..b8f5293bea 100644 --- a/test/integration/goldens/logging/MetricsServiceV2StubSettings.java +++ b/test/integration/goldens/logging/MetricsServiceV2StubSettings.java @@ -75,18 +75,18 @@ *

For example, to set the total timeout of getLogMetric to 30 seconds: * *

{@code
- * MetricsServiceV2StubSettings.Builder metricsServiceV2SettingsBuilder =
+ * MetricsServiceV2StubSettings.Builder metricsSettingsBuilder =
  *     MetricsServiceV2StubSettings.newBuilder();
- * metricsServiceV2SettingsBuilder
+ * metricsSettingsBuilder
  *     .getLogMetricSettings()
  *     .setRetrySettings(
- *         metricsServiceV2SettingsBuilder
+ *         metricsSettingsBuilder
  *             .getLogMetricSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * MetricsServiceV2StubSettings metricsServiceV2Settings = metricsServiceV2SettingsBuilder.build();
+ * MetricsServiceV2StubSettings metricsSettings = metricsSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") From 9138b382f6531232b8288d643f2f5b45bc100d79 Mon Sep 17 00:00:00 2001 From: summerji Date: Thu, 21 Jan 2021 16:24:28 -0800 Subject: [PATCH 2/4] Add license --- .../samplecode/SettingsSampleCodeComposerTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java index af0b2aa48a..b7438e4732 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/samplecode/SettingsSampleCodeComposerTest.java @@ -1,3 +1,17 @@ +// Copyright 2020 Google LLC +// +// 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. + package com.google.api.generator.gapic.composer.samplecode; import static junit.framework.Assert.assertEquals; From 5cc633271a05795d06772370a26c3632f823d83d Mon Sep 17 00:00:00 2001 From: summerji Date: Thu, 21 Jan 2021 16:31:37 -0800 Subject: [PATCH 3/4] deleted accident files --- .../executionHistory/executionHistory.lock | Bin 17 -> 0 bytes .gradle/6.5/fileChanges/last-build.bin | Bin 1 -> 0 bytes .gradle/6.5/fileHashes/fileHashes.lock | Bin 17 -> 0 bytes .gradle/6.5/gc.properties | 0 .../buildOutputCleanup.lock | Bin 17 -> 0 bytes .gradle/buildOutputCleanup/cache.properties | 2 - .gradle/checksums/checksums.lock | Bin 17 -> 0 bytes .gradle/vcs-1/gc.properties | 0 allclasses-frame.html | 22 - allclasses-noframe.html | 22 - ...ent.ListLogMetricsFixedSizeCollection.html | 246 ---- .../v2/MetricsClient.ListLogMetricsPage.html | 261 ---- ...icsClient.ListLogMetricsPagedResponse.html | 246 ---- .../cloud/logging/v2/MetricsClient.html | 1169 ----------------- .../cloud/logging/v2/package-frame.html | 23 - .../cloud/logging/v2/package-summary.html | 154 --- com/google/cloud/logging/v2/package-tree.html | 138 -- constant-values.html | 122 -- deprecated-list.html | 122 -- help-doc.html | 223 ---- index-all.html | 303 ----- index.html | 72 - overview-summary.html | 133 -- overview-tree.html | 142 -- package-list | 1 - script.js | 30 - stylesheet.css | 574 -------- 27 files changed, 4005 deletions(-) delete mode 100644 .gradle/6.5/executionHistory/executionHistory.lock delete mode 100644 .gradle/6.5/fileChanges/last-build.bin delete mode 100644 .gradle/6.5/fileHashes/fileHashes.lock delete mode 100644 .gradle/6.5/gc.properties delete mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock delete mode 100644 .gradle/buildOutputCleanup/cache.properties delete mode 100644 .gradle/checksums/checksums.lock delete mode 100644 .gradle/vcs-1/gc.properties delete mode 100644 allclasses-frame.html delete mode 100644 allclasses-noframe.html delete mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html delete mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html delete mode 100644 com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html delete mode 100644 com/google/cloud/logging/v2/MetricsClient.html delete mode 100644 com/google/cloud/logging/v2/package-frame.html delete mode 100644 com/google/cloud/logging/v2/package-summary.html delete mode 100644 com/google/cloud/logging/v2/package-tree.html delete mode 100644 constant-values.html delete mode 100644 deprecated-list.html delete mode 100644 help-doc.html delete mode 100644 index-all.html delete mode 100644 index.html delete mode 100644 overview-summary.html delete mode 100644 overview-tree.html delete mode 100644 package-list delete mode 100644 script.js delete mode 100644 stylesheet.css diff --git a/.gradle/6.5/executionHistory/executionHistory.lock b/.gradle/6.5/executionHistory/executionHistory.lock deleted file mode 100644 index be1e8cf4e62f8074f26026fbcdb7600eac63fcea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17 TcmZSXop&TsaeE{a0~7!NE{Fqv diff --git a/.gradle/6.5/fileChanges/last-build.bin b/.gradle/6.5/fileChanges/last-build.bin deleted file mode 100644 index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1 IcmZPo000310RR91 diff --git a/.gradle/6.5/fileHashes/fileHashes.lock b/.gradle/6.5/fileHashes/fileHashes.lock deleted file mode 100644 index 87998231ec91a8a9cdc1e74e537eb30cabc5bb69..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17 TcmZRU;XA%uRjlYN0~7!NB#HwT diff --git a/.gradle/6.5/gc.properties b/.gradle/6.5/gc.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock deleted file mode 100644 index b15489d40950c8bd4529b68ef86b1ef8f91a5948..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17 TcmZR!=W;FIZ6Kt~00E2u8(#t{ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties deleted file mode 100644 index 85c996f8fa..0000000000 --- a/.gradle/buildOutputCleanup/cache.properties +++ /dev/null @@ -1,2 +0,0 @@ -#Wed Jan 20 10:48:40 PST 2021 -gradle.version=6.5 diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock deleted file mode 100644 index 2ab0a3a62baa7c604f72c568e4cdb62d8c7f99cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17 ScmZR!&AOY&ka}H~0SW*q4+BB~ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/allclasses-frame.html b/allclasses-frame.html deleted file mode 100644 index 62c8dfd7db..0000000000 --- a/allclasses-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -All Classes - - - - - -

All Classes

- - - diff --git a/allclasses-noframe.html b/allclasses-noframe.html deleted file mode 100644 index 7bdc7c7220..0000000000 --- a/allclasses-noframe.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -All Classes - - - - - -

All Classes

- - - diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html deleted file mode 100644 index 8d06b985c2..0000000000 --- a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsFixedSizeCollection.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - -MetricsClient.ListLogMetricsFixedSizeCollection - - - - - - - - - - - - -
-
com.google.cloud.logging.v2
-

Class MetricsClient.ListLogMetricsFixedSizeCollection

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • <any>
    • -
    • -
        -
      • com.google.cloud.logging.v2.MetricsClient.ListLogMetricsFixedSizeCollection
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    MetricsClient
    -
    -
    -
    -
    public static class MetricsClient.ListLogMetricsFixedSizeCollection
    -extends <any>
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html deleted file mode 100644 index 85bea71ee0..0000000000 --- a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPage.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - -MetricsClient.ListLogMetricsPage - - - - - - - - - - - - -
-
com.google.cloud.logging.v2
-

Class MetricsClient.ListLogMetricsPage

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • <any>
    • -
    • -
        -
      • com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPage
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    MetricsClient
    -
    -
    -
    -
    public static class MetricsClient.ListLogMetricsPage
    -extends <any>
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        createPageAsync

        -
        public <any> createPageAsync(<any> context,
        -                             <any> futureResponse)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html b/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html deleted file mode 100644 index 12c1783572..0000000000 --- a/com/google/cloud/logging/v2/MetricsClient.ListLogMetricsPagedResponse.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - -MetricsClient.ListLogMetricsPagedResponse - - - - - - - - - - - - -
-
com.google.cloud.logging.v2
-

Class MetricsClient.ListLogMetricsPagedResponse

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • <any>
    • -
    • -
        -
      • com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPagedResponse
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    MetricsClient
    -
    -
    -
    -
    public static class MetricsClient.ListLogMetricsPagedResponse
    -extends <any>
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <any>createAsync(<any> context, - <any> futureResponse) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createAsync

        -
        public static <any> createAsync(<any> context,
        -                                <any> futureResponse)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/com/google/cloud/logging/v2/MetricsClient.html b/com/google/cloud/logging/v2/MetricsClient.html deleted file mode 100644 index 336ed07cc5..0000000000 --- a/com/google/cloud/logging/v2/MetricsClient.html +++ /dev/null @@ -1,1169 +0,0 @@ - - - - - -MetricsClient - - - - - - - - - - - - -
-
com.google.cloud.logging.v2
-

Class MetricsClient

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.google.cloud.logging.v2.MetricsClient
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    @Generated(value="by gapic-generator-java")
    -public class MetricsClient
    -extends java.lang.Object
    -
    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 (MetricsClient metricsClient = MetricsClient.create()) {
    -   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
    -   LogMetric response = metricsClient.getLogMetric(metricName);
    - }
    - 
    - -

    Note: close() needs to be called on the MetricsClient object to clean up resources such as - threads. In the example above, try-with-resources is used, which automatically calls close(). - -

    The surface of this class includes several types of Java methods for each of the API's - methods: - -

      -
    1. A "flattened" method. With this type of method, the fields of the request type have been - converted into function parameters. It may be the case that not all fields are available as - parameters, and not every API method will have a flattened method entry point. -
    2. A "request object" method. This type of method only takes one parameter, a request object, - which must be constructed before the call. Not every API method will have a request object - method. -
    3. A "callable" method. This type of method takes no parameters and returns an immutable API - callable object, which can be used to initiate calls to the service. -
    - -

    See the individual methods for example code. - -

    Many parameters require resource names to be formatted in a particular way. To assist with - these names, this class includes a format method for each type of name, and additionally a parse - method to extract the individual identifiers contained within names that are returned. - -

    This class can be customized by passing in a custom instance of MetricsSettings to create(). - For example: - -

    To customize credentials: - -

    
    - MetricsSettings metricsSettings =
    -     MetricsSettings.newBuilder()
    -         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
    -         .build();
    - MetricsClient metricsClient = MetricsClient.create(metricsSettings);
    - 
    - -

    To customize the endpoint: - -

    
    - MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
    - MetricsClient metricsClient = MetricsClient.create(metricsSettings);
    - 
    - -

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MetricsClient

        -
        protected MetricsClient(MetricsSettings settings)
        -                 throws java.io.IOException
        -
        Constructs an instance of MetricsClient, using the given settings. This is protected so that it - is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        MetricsClient

        -
        protected MetricsClient(MetricsServiceV2Stub stub)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        create

        -
        public static final MetricsClient create()
        -                                  throws java.io.IOException
        -
        Constructs an instance of MetricsClient with default settings.
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        create

        -
        public static final MetricsClient create(MetricsSettings settings)
        -                                  throws java.io.IOException
        -
        Constructs an instance of MetricsClient, using the given settings. The channels are created - based on the settings passed in, or defaults for any settings that are not set.
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        create

        -
        public static final MetricsClient create(MetricsServiceV2Stub stub)
        -
        Constructs an instance of MetricsClient, using the given stub for making calls. This is for - advanced usage - prefer using create(MetricsSettings).
        -
      • -
      - - - -
        -
      • -

        getSettings

        -
        public final MetricsSettings getSettings()
        -
      • -
      - - - -
        -
      • -

        getStub

        -
        public MetricsServiceV2Stub getStub()
        -
      • -
      - - - -
        -
      • -

        listLogMetrics

        -
        public final MetricsClient.ListLogMetricsPagedResponse listLogMetrics(ProjectName parent)
        -
        Lists logs-based metrics. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   ProjectName parent = ProjectName.of("[PROJECT]");
        -   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
        -     // doThingsWith(element);
        -   }
        - }
        - 
        -
        -
        Parameters:
        -
        parent - Required. The name of the project containing the metrics: -

        "projects/[PROJECT_ID]"

        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        listLogMetrics

        -
        public final MetricsClient.ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest request)
        -
        Lists logs-based metrics. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   ListLogMetricsRequest request =
        -       ListLogMetricsRequest.newBuilder()
        -           .setParent(ProjectName.of("[PROJECT]").toString())
        -           .setPageToken("pageToken873572522")
        -           .setPageSize(883849137)
        -           .build();
        -   for (LogMetric element : metricsClient.listLogMetrics(request).iterateAll()) {
        -     // doThingsWith(element);
        -   }
        - }
        - 
        -
        -
        Parameters:
        -
        request - The request object containing all of the parameters for the API call.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        listLogMetricsPagedCallable

        -
        public final <any> listLogMetricsPagedCallable()
        -
        Lists logs-based metrics. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   ListLogMetricsRequest request =
        -       ListLogMetricsRequest.newBuilder()
        -           .setParent(ProjectName.of("[PROJECT]").toString())
        -           .setPageToken("pageToken873572522")
        -           .setPageSize(883849137)
        -           .build();
        -   ApiFuture<LogMetric> future = metricsClient.listLogMetricsPagedCallable().futureCall(request);
        -   // Do something.
        -   for (LogMetric element : future.get().iterateAll()) {
        -     // doThingsWith(element);
        -   }
        - }
        - 
        -
      • -
      - - - -
        -
      • -

        listLogMetricsCallable

        -
        public final <any> listLogMetricsCallable()
        -
        Lists logs-based metrics. - -

        Sample code:

        -
      • -
      - - - -
        -
      • -

        getLogMetric

        -
        public final LogMetric getLogMetric(LogMetricName metricName)
        -
        Gets a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        -   LogMetric response = metricsClient.getLogMetric(metricName);
        - }
        - 
        -
        -
        Parameters:
        -
        metricName - Required. The resource name of the desired metric: -

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        getLogMetric

        -
        public final LogMetric getLogMetric(java.lang.String metricName)
        -
        Gets a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        -   LogMetric response = metricsClient.getLogMetric(metricName);
        - }
        - 
        -
        -
        Parameters:
        -
        metricName - Required. The resource name of the desired metric: -

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        getLogMetric

        -
        public final LogMetric getLogMetric(GetLogMetricRequest request)
        -
        Gets a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   GetLogMetricRequest request =
        -       GetLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .build();
        -   LogMetric response = metricsClient.getLogMetric(request);
        - }
        - 
        -
        -
        Parameters:
        -
        request - The request object containing all of the parameters for the API call.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        getLogMetricCallable

        -
        public final <any> getLogMetricCallable()
        -
        Gets a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   GetLogMetricRequest request =
        -       GetLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .build();
        -   ApiFuture<LogMetric> future = metricsClient.getLogMetricCallable().futureCall(request);
        -   // Do something.
        -   LogMetric response = future.get();
        - }
        - 
        -
      • -
      - - - -
        -
      • -

        createLogMetric

        -
        public final LogMetric createLogMetric(ProjectName parent,
        -                                       LogMetric metric)
        -
        Creates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   ProjectName parent = ProjectName.of("[PROJECT]");
        -   LogMetric metric = LogMetric.newBuilder().build();
        -   LogMetric response = metricsClient.createLogMetric(parent, metric);
        - }
        - 
        -
        -
        Parameters:
        -
        parent - Required. The resource name of the project in which to create the metric: -

        "projects/[PROJECT_ID]" -

        The new metric must be provided in the request.

        -
        metric - Required. The new logs-based metric, which must not have an identifier that - already exists.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        createLogMetric

        -
        public final LogMetric createLogMetric(java.lang.String parent,
        -                                       LogMetric metric)
        -
        Creates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   String parent = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        -   LogMetric metric = LogMetric.newBuilder().build();
        -   LogMetric response = metricsClient.createLogMetric(parent, metric);
        - }
        - 
        -
        -
        Parameters:
        -
        parent - Required. The resource name of the project in which to create the metric: -

        "projects/[PROJECT_ID]" -

        The new metric must be provided in the request.

        -
        metric - Required. The new logs-based metric, which must not have an identifier that - already exists.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        createLogMetric

        -
        public final LogMetric createLogMetric(CreateLogMetricRequest request)
        -
        Creates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   CreateLogMetricRequest request =
        -       CreateLogMetricRequest.newBuilder()
        -           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .setMetric(LogMetric.newBuilder().build())
        -           .build();
        -   LogMetric response = metricsClient.createLogMetric(request);
        - }
        - 
        -
        -
        Parameters:
        -
        request - The request object containing all of the parameters for the API call.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        createLogMetricCallable

        -
        public final <any> createLogMetricCallable()
        -
        Creates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   CreateLogMetricRequest request =
        -       CreateLogMetricRequest.newBuilder()
        -           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .setMetric(LogMetric.newBuilder().build())
        -           .build();
        -   ApiFuture<LogMetric> future = metricsClient.createLogMetricCallable().futureCall(request);
        -   // Do something.
        -   LogMetric response = future.get();
        - }
        - 
        -
      • -
      - - - -
        -
      • -

        updateLogMetric

        -
        public final LogMetric updateLogMetric(LogMetricName metricName,
        -                                       LogMetric metric)
        -
        Creates or updates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        -   LogMetric metric = LogMetric.newBuilder().build();
        -   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
        - }
        - 
        -
        -
        Parameters:
        -
        metricName - Required. The resource name of the metric to update: -

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]" -

        The updated metric must be provided in the request and it's `name` field must be the - same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is - created.

        -
        metric - Required. The updated metric.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        updateLogMetric

        -
        public final LogMetric updateLogMetric(java.lang.String metricName,
        -                                       LogMetric metric)
        -
        Creates or updates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
        -   LogMetric metric = LogMetric.newBuilder().build();
        -   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
        - }
        - 
        -
        -
        Parameters:
        -
        metricName - Required. The resource name of the metric to update: -

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]" -

        The updated metric must be provided in the request and it's `name` field must be the - same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is - created.

        -
        metric - Required. The updated metric.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        updateLogMetric

        -
        public final LogMetric updateLogMetric(UpdateLogMetricRequest request)
        -
        Creates or updates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   UpdateLogMetricRequest request =
        -       UpdateLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .setMetric(LogMetric.newBuilder().build())
        -           .build();
        -   LogMetric response = metricsClient.updateLogMetric(request);
        - }
        - 
        -
        -
        Parameters:
        -
        request - The request object containing all of the parameters for the API call.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        updateLogMetricCallable

        -
        public final <any> updateLogMetricCallable()
        -
        Creates or updates a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   UpdateLogMetricRequest request =
        -       UpdateLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .setMetric(LogMetric.newBuilder().build())
        -           .build();
        -   ApiFuture<LogMetric> future = metricsClient.updateLogMetricCallable().futureCall(request);
        -   // Do something.
        -   LogMetric response = future.get();
        - }
        - 
        -
      • -
      - - - -
        -
      • -

        deleteLogMetric

        -
        public final void deleteLogMetric(LogMetricName metricName)
        -
        Deletes a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        -   metricsClient.deleteLogMetric(metricName);
        - }
        - 
        -
        -
        Parameters:
        -
        metricName - Required. The resource name of the metric to delete: -

        "projects/[PROJECT_ID]/metrics/[METRIC_ID]"

        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        deleteLogMetric

        -
        public final void deleteLogMetric(DeleteLogMetricRequest request)
        -
        Deletes a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   DeleteLogMetricRequest request =
        -       DeleteLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .build();
        -   metricsClient.deleteLogMetric(request);
        - }
        - 
        -
        -
        Parameters:
        -
        request - The request object containing all of the parameters for the API call.
        -
        Throws:
        -
        com.google.api.gax.rpc.ApiException - if the remote call fails
        -
        -
      • -
      - - - -
        -
      • -

        deleteLogMetricCallable

        -
        public final <any> deleteLogMetricCallable()
        -
        Deletes a logs-based metric. - -

        Sample code: - -

        
        - try (MetricsClient metricsClient = MetricsClient.create()) {
        -   DeleteLogMetricRequest request =
        -       DeleteLogMetricRequest.newBuilder()
        -           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
        -           .build();
        -   ApiFuture<Empty> future = metricsClient.deleteLogMetricCallable().futureCall(request);
        -   // Do something.
        -   future.get();
        - }
        - 
        -
      • -
      - - - -
        -
      • -

        close

        -
        public final void close()
        -
      • -
      - - - -
        -
      • -

        shutdown

        -
        public void shutdown()
        -
      • -
      - - - -
        -
      • -

        isShutdown

        -
        public boolean isShutdown()
        -
      • -
      - - - -
        -
      • -

        isTerminated

        -
        public boolean isTerminated()
        -
      • -
      - - - -
        -
      • -

        shutdownNow

        -
        public void shutdownNow()
        -
      • -
      - - - -
        -
      • -

        awaitTermination

        -
        public boolean awaitTermination(long duration,
        -                                java.util.concurrent.TimeUnit unit)
        -                         throws java.lang.InterruptedException
        -
        -
        Throws:
        -
        java.lang.InterruptedException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/com/google/cloud/logging/v2/package-frame.html b/com/google/cloud/logging/v2/package-frame.html deleted file mode 100644 index 63ae3a6a82..0000000000 --- a/com/google/cloud/logging/v2/package-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -com.google.cloud.logging.v2 - - - - - -

com.google.cloud.logging.v2

- - - diff --git a/com/google/cloud/logging/v2/package-summary.html b/com/google/cloud/logging/v2/package-summary.html deleted file mode 100644 index a216249114..0000000000 --- a/com/google/cloud/logging/v2/package-summary.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - -com.google.cloud.logging.v2 - - - - - - - - - - - -
-

Package com.google.cloud.logging.v2

-
-
- -
- - - - - - diff --git a/com/google/cloud/logging/v2/package-tree.html b/com/google/cloud/logging/v2/package-tree.html deleted file mode 100644 index cd4ce04959..0000000000 --- a/com/google/cloud/logging/v2/package-tree.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - -com.google.cloud.logging.v2 Class Hierarchy - - - - - - - - - - - -
-

Hierarchy For Package com.google.cloud.logging.v2

-
-
-

Class Hierarchy

- -
- - - - - - diff --git a/constant-values.html b/constant-values.html deleted file mode 100644 index 2026ef44ea..0000000000 --- a/constant-values.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -Constant Field Values - - - - - - - - - - - -
-

Constant Field Values

-

Contents

-
- - - - - - diff --git a/deprecated-list.html b/deprecated-list.html deleted file mode 100644 index a01204e286..0000000000 --- a/deprecated-list.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -Deprecated List - - - - - - - - -
- - - - - - - -
- - -
-

Deprecated API

-

Contents

-
- -
- - - - - - - -
- - - - diff --git a/help-doc.html b/help-doc.html deleted file mode 100644 index cf15b9f272..0000000000 --- a/help-doc.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - -API Help - - - - - - - - - - - -
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
    -
  • -

    Overview

    -

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    -
  • -
  • -

    Package

    -

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    -
      -
    • Interfaces (italic)
    • -
    • Classes
    • -
    • Enums
    • -
    • Exceptions
    • -
    • Errors
    • -
    • Annotation Types
    • -
    -
  • -
  • -

    Class/Interface

    -

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    -
      -
    • Class inheritance diagram
    • -
    • Direct Subclasses
    • -
    • All Known Subinterfaces
    • -
    • All Known Implementing Classes
    • -
    • Class/interface declaration
    • -
    • Class/interface description
    • -
    -
      -
    • Nested Class Summary
    • -
    • Field Summary
    • -
    • Constructor Summary
    • -
    • Method Summary
    • -
    -
      -
    • Field Detail
    • -
    • Constructor Detail
    • -
    • Method Detail
    • -
    -

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    -
  • -
  • -

    Annotation Type

    -

    Each annotation type has its own separate page with the following sections:

    -
      -
    • Annotation Type declaration
    • -
    • Annotation Type description
    • -
    • Required Element Summary
    • -
    • Optional Element Summary
    • -
    • Element Detail
    • -
    -
  • -
  • -

    Enum

    -

    Each enum has its own separate page with the following sections:

    -
      -
    • Enum declaration
    • -
    • Enum description
    • -
    • Enum Constant Summary
    • -
    • Enum Constant Detail
    • -
    -
  • -
  • -

    Tree (Class Hierarchy)

    -

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    -
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • -
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • -
    -
  • -
  • -

    Deprecated API

    -

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    -
  • -
  • -

    Index

    -

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    -
  • -
  • -

    Prev/Next

    -

    These links take you to the next or previous class, interface, package, or related page.

    -
  • -
  • -

    Frames/No Frames

    -

    These links show and hide the HTML frames. All pages are available with or without frames.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    Serialized Form

    -

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    -
  • -
  • -

    Constant Field Values

    -

    The Constant Field Values page lists the static final fields and their values.

    -
  • -
-This help file applies to API documentation generated using the standard doclet.
- - - - - - diff --git a/index-all.html b/index-all.html deleted file mode 100644 index a0e7569df5..0000000000 --- a/index-all.html +++ /dev/null @@ -1,303 +0,0 @@ - - - - - -Index - - - - - - - - - - - -
A C D G I L M S U  - - -

A

-
-
awaitTermination(long, TimeUnit) - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
- - - -

C

-
-
close() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
com.google.cloud.logging.v2 - package com.google.cloud.logging.v2
-
 
-
create() - Static method in class com.google.cloud.logging.v2.MetricsClient
-
-
Constructs an instance of MetricsClient with default settings.
-
-
create(MetricsSettings) - Static method in class com.google.cloud.logging.v2.MetricsClient
-
-
Constructs an instance of MetricsClient, using the given settings.
-
-
create(MetricsServiceV2Stub) - Static method in class com.google.cloud.logging.v2.MetricsClient
-
-
Constructs an instance of MetricsClient, using the given stub for making calls.
-
-
createAsync(<any>, <any>) - Static method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPagedResponse
-
 
-
createCollection(List<MetricsClient.ListLogMetricsPage>, int) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsFixedSizeCollection
-
 
-
createLogMetric(ProjectName, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates a logs-based metric.
-
-
createLogMetric(String, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates a logs-based metric.
-
-
createLogMetric(CreateLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates a logs-based metric.
-
-
createLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates a logs-based metric.
-
-
createPage(<any>, ListLogMetricsResponse) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPage
-
 
-
createPageAsync(<any>, <any>) - Method in class com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPage
-
 
-
- - - -

D

-
-
deleteLogMetric(LogMetricName) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Deletes a logs-based metric.
-
-
deleteLogMetric(DeleteLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Deletes a logs-based metric.
-
-
deleteLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Deletes a logs-based metric.
-
-
- - - -

G

-
-
getLogMetric(LogMetricName) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Gets a logs-based metric.
-
-
getLogMetric(String) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Gets a logs-based metric.
-
-
getLogMetric(GetLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Gets a logs-based metric.
-
-
getLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Gets a logs-based metric.
-
-
getSettings() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
getStub() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
- - - -

I

-
-
isShutdown() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
isTerminated() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
- - - -

L

-
-
listLogMetrics(ProjectName) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Lists logs-based metrics.
-
-
listLogMetrics(ListLogMetricsRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Lists logs-based metrics.
-
-
listLogMetricsCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Lists logs-based metrics.
-
-
listLogMetricsPagedCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Lists logs-based metrics.
-
-
- - - -

M

-
-
MetricsClient - Class in com.google.cloud.logging.v2
-
-
Service Description: Service for configuring logs-based metrics.
-
-
MetricsClient(MetricsSettings) - Constructor for class com.google.cloud.logging.v2.MetricsClient
-
-
Constructs an instance of MetricsClient, using the given settings.
-
-
MetricsClient(MetricsServiceV2Stub) - Constructor for class com.google.cloud.logging.v2.MetricsClient
-
 
-
MetricsClient.ListLogMetricsFixedSizeCollection - Class in com.google.cloud.logging.v2
-
 
-
MetricsClient.ListLogMetricsPage - Class in com.google.cloud.logging.v2
-
 
-
MetricsClient.ListLogMetricsPagedResponse - Class in com.google.cloud.logging.v2
-
 
-
- - - -

S

-
-
shutdown() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
shutdownNow() - Method in class com.google.cloud.logging.v2.MetricsClient
-
 
-
- - - -

U

-
-
updateLogMetric(LogMetricName, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates or updates a logs-based metric.
-
-
updateLogMetric(String, LogMetric) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates or updates a logs-based metric.
-
-
updateLogMetric(UpdateLogMetricRequest) - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates or updates a logs-based metric.
-
-
updateLogMetricCallable() - Method in class com.google.cloud.logging.v2.MetricsClient
-
-
Creates or updates a logs-based metric.
-
-
-A C D G I L M S U 
- - - - - - diff --git a/index.html b/index.html deleted file mode 100644 index ea3f876b47..0000000000 --- a/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -Generated Documentation (Untitled) - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<h2>Frame Alert</h2> -<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> - - - diff --git a/overview-summary.html b/overview-summary.html deleted file mode 100644 index 9744188eeb..0000000000 --- a/overview-summary.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - -Overview - - - - - - - - - - - -
- - - - - - - - - - - - -
Packages 
PackageDescription
com.google.cloud.logging.v2 
-
- - - - - - diff --git a/overview-tree.html b/overview-tree.html deleted file mode 100644 index 0a20f6171d..0000000000 --- a/overview-tree.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - -Class Hierarchy - - - - - - - - - - - -
-

Hierarchy For All Packages

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - - - diff --git a/package-list b/package-list deleted file mode 100644 index 006e1bf1ff..0000000000 --- a/package-list +++ /dev/null @@ -1 +0,0 @@ -com.google.cloud.logging.v2 diff --git a/script.js b/script.js deleted file mode 100644 index b346356931..0000000000 --- a/script.js +++ /dev/null @@ -1,30 +0,0 @@ -function show(type) -{ - count = 0; - for (var key in methods) { - var row = document.getElementById(key); - if ((methods[key] & type) != 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) -{ - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} diff --git a/stylesheet.css b/stylesheet.css deleted file mode 100644 index 98055b22d6..0000000000 --- a/stylesheet.css +++ /dev/null @@ -1,574 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:20px; -} -h2 { - font-size:18px; -} -h3 { - font-size:16px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.useSummary td.colFirst, .useSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} From f208209266f8763f7e38d395642665069b20996d Mon Sep 17 00:00:00 2001 From: summerji Date: Thu, 21 Jan 2021 17:27:53 -0800 Subject: [PATCH 4/4] Refactor callable method sample code --- .../composer/ServiceClientClassComposer.java | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/google/api/generator/gapic/composer/ServiceClientClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/ServiceClientClassComposer.java index 272aeb6fb1..6c658a0a2e 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/ServiceClientClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/ServiceClientClassComposer.java @@ -792,8 +792,6 @@ private static MethodDefinition createCallableMethod( .build(); Optional sampleCodeOpt = Optional.empty(); - // TODO (summerji): Refactor the condition logic order after complete the callable sample code - // implementation. if (callableMethodKind.equals(CallableMethodKind.LRO)) { sampleCodeOpt = Optional.of( @@ -802,8 +800,7 @@ private static MethodDefinition createCallableMethod( typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); - } - if (callableMethodKind.equals(CallableMethodKind.PAGED)) { + } else if (callableMethodKind.equals(CallableMethodKind.PAGED)) { sampleCodeOpt = Optional.of( ServiceClientSampleCodeComposer.composePagedCallableMethodHeaderSampleCode( @@ -811,27 +808,24 @@ private static MethodDefinition createCallableMethod( typeStore.get(ClassNames.getServiceClientClassName(service)), resourceNames, messageTypes)); - } - - if (!method.stream().equals(Stream.NONE)) { - sampleCodeOpt = - Optional.of( - ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( - method, - typeStore.get(ClassNames.getServiceClientClassName(service)), - resourceNames, - messageTypes)); - } - - if (callableMethodKind.equals(CallableMethodKind.REGULAR) - && method.stream().equals(Stream.NONE)) { - sampleCodeOpt = - Optional.of( - ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( - method, - typeStore.get(ClassNames.getServiceClientClassName(service)), - resourceNames, - messageTypes)); + } else if (callableMethodKind.equals(CallableMethodKind.REGULAR)) { + if (method.stream().equals(Stream.NONE)) { + sampleCodeOpt = + Optional.of( + ServiceClientSampleCodeComposer.composeRegularCallableMethodHeaderSampleCode( + method, + typeStore.get(ClassNames.getServiceClientClassName(service)), + resourceNames, + messageTypes)); + } else { + sampleCodeOpt = + Optional.of( + ServiceClientSampleCodeComposer.composeStreamCallableMethodHeaderSampleCode( + method, + typeStore.get(ClassNames.getServiceClientClassName(service)), + resourceNames, + messageTypes)); + } } return MethodDefinition.builder()