Skip to content

Commit bb81597

Browse files
authored
Release gapics (#3423)
Generated with googleapis/gapic-generator#2131 to fix error in LoggingClient (see fix at andreamlin/google-cloud-java@386c987) Update google-common-protos to v 1.12.0. Add google-cloud-tasks for the first time. Remove LoggingSmokeTest.java, because the Logging smoke config has been removed from googleapis/googleapis, and the existing LoggingSmokeTest.java is incompatible with the current google-cloud-logging/src/main.
1 parent baf93cd commit bb81597

File tree

59 files changed

+2655
-923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2655
-923
lines changed

google-cloud-logging/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
<artifactId>truth</artifactId>
5858
<scope>test</scope>
5959
</dependency>
60+
<dependency>
61+
<groupId>com.google.api.grpc</groupId>
62+
<artifactId>proto-google-common-protos</artifactId>
63+
<scope>compile</scope>
64+
</dependency>
6065
<dependency>
6166
<groupId>com.google.api.grpc</groupId>
6267
<artifactId>grpc-google-cloud-logging-v2</artifactId>

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,102 @@ public final UnaryCallable<CreateSinkRequest, LogSink> createSinkCallable() {
525525
return stub.createSinkCallable();
526526
}
527527

528+
// AUTO-GENERATED DOCUMENTATION AND METHOD
529+
/**
530+
* Updates a sink. This method replaces the following fields in the existing sink with values from
531+
* the new sink: `destination`, and `filter`. The updated sink might also have a new
532+
* `writer_identity`; see the `unique_writer_identity` field.
533+
*
534+
* <p>Sample code:
535+
*
536+
* <pre><code>
537+
* try (ConfigClient configClient = ConfigClient.create()) {
538+
* SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
539+
* LogSink sink = LogSink.newBuilder().build();
540+
* FieldMask updateMask = FieldMask.newBuilder().build();
541+
* LogSink response = configClient.updateSink(sinkName, sink, updateMask);
542+
* }
543+
* </code></pre>
544+
*
545+
* @param sinkName Required. The full resource name of the sink to update, including the parent
546+
* resource and the sink identifier:
547+
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
548+
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
549+
* "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
550+
* "folders/[FOLDER_ID]/sinks/[SINK_ID]"
551+
* <p>Example: `"projects/my-project-id/sinks/my-sink-id"`.
552+
* @param sink Required. The updated sink, whose name is the same identifier that appears as part
553+
* of `sink_name`.
554+
* @param updateMask Optional. Field mask that specifies the fields in `sink` that need an update.
555+
* A sink field will be overwritten if, and only if, it is in the update mask. `name` and
556+
* output only fields cannot be updated.
557+
* <p>An empty updateMask is temporarily treated as using the following mask for backwards
558+
* compatibility purposes: destination,filter,includeChildren At some point in the future,
559+
* behavior will be removed and specifying an empty updateMask will be an error.
560+
* <p>For a detailed `FieldMask` definition, see
561+
* https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
562+
* <p>Example: `updateMask=filter`.
563+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
564+
*/
565+
public final LogSink updateSink(SinkName sinkName, LogSink sink, FieldMask updateMask) {
566+
567+
UpdateSinkRequest request =
568+
UpdateSinkRequest.newBuilder()
569+
.setSinkName(sinkName == null ? null : sinkName.toString())
570+
.setSink(sink)
571+
.setUpdateMask(updateMask)
572+
.build();
573+
return updateSink(request);
574+
}
575+
576+
// AUTO-GENERATED DOCUMENTATION AND METHOD
577+
/**
578+
* Updates a sink. This method replaces the following fields in the existing sink with values from
579+
* the new sink: `destination`, and `filter`. The updated sink might also have a new
580+
* `writer_identity`; see the `unique_writer_identity` field.
581+
*
582+
* <p>Sample code:
583+
*
584+
* <pre><code>
585+
* try (ConfigClient configClient = ConfigClient.create()) {
586+
* SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
587+
* LogSink sink = LogSink.newBuilder().build();
588+
* FieldMask updateMask = FieldMask.newBuilder().build();
589+
* LogSink response = configClient.updateSink(sinkName.toString(), sink, updateMask);
590+
* }
591+
* </code></pre>
592+
*
593+
* @param sinkName Required. The full resource name of the sink to update, including the parent
594+
* resource and the sink identifier:
595+
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
596+
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
597+
* "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
598+
* "folders/[FOLDER_ID]/sinks/[SINK_ID]"
599+
* <p>Example: `"projects/my-project-id/sinks/my-sink-id"`.
600+
* @param sink Required. The updated sink, whose name is the same identifier that appears as part
601+
* of `sink_name`.
602+
* @param updateMask Optional. Field mask that specifies the fields in `sink` that need an update.
603+
* A sink field will be overwritten if, and only if, it is in the update mask. `name` and
604+
* output only fields cannot be updated.
605+
* <p>An empty updateMask is temporarily treated as using the following mask for backwards
606+
* compatibility purposes: destination,filter,includeChildren At some point in the future,
607+
* behavior will be removed and specifying an empty updateMask will be an error.
608+
* <p>For a detailed `FieldMask` definition, see
609+
* https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
610+
* <p>Example: `updateMask=filter`.
611+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
612+
*/
613+
public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateMask) {
614+
615+
UpdateSinkRequest request =
616+
UpdateSinkRequest.newBuilder()
617+
.setSinkName(sinkName)
618+
.setSink(sink)
619+
.setUpdateMask(updateMask)
620+
.build();
621+
return updateSink(request);
622+
}
623+
528624
// AUTO-GENERATED DOCUMENTATION AND METHOD
529625
/**
530626
* Updates a sink. This method replaces the following fields in the existing sink with values from

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ public final UnaryCallable<DeleteLogRequest, Empty> deleteLogCallable() {
274274

275275
// AUTO-GENERATED DOCUMENTATION AND METHOD
276276
/**
277-
* ## Log entry resources
278-
*
279-
* <p>Writes log entries to Stackdriver Logging. This API method is the only way to send log
280-
* entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver
281-
* Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging.
277+
* Writes log entries to Stackdriver Logging. This API method is the only way to send log entries
278+
* to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver Logging
279+
* agent (fluentd) and all logging libraries configured to use Stackdriver Logging. A single
280+
* request may contain log entries for a maximum of 1000 different resources (projects,
281+
* organizations, billing accounts or folders)
282282
*
283283
* <p>Sample code:
284284
*
@@ -319,8 +319,9 @@ public final UnaryCallable<DeleteLogRequest, Empty> deleteLogCallable() {
319319
* earlier in the list will sort before the entries later in the list. See the `entries.list`
320320
* method.
321321
* <p>Log entries with timestamps that are more than the [logs retention
322-
* period](/logging/quota-policy) in the past or more than 24 hours in the future might be
323-
* discarded. Discarding does not return an error.
322+
* period](/logging/quota-policy) in the past or more than 24 hours in the future will not be
323+
* available when calling `entries.list`. However, those log entries can still be exported
324+
* with [LogSinks](/logging/docs/api/tasks/exporting-logs).
324325
* <p>To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy)
325326
* for calls to `entries.write`, you should try to include several log entries in this list,
326327
* rather than calling this method for each individual log entry.
@@ -344,11 +345,11 @@ public final WriteLogEntriesResponse writeLogEntries(
344345

345346
// AUTO-GENERATED DOCUMENTATION AND METHOD
346347
/**
347-
* ## Log entry resources
348-
*
349-
* <p>Writes log entries to Stackdriver Logging. This API method is the only way to send log
350-
* entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver
351-
* Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging.
348+
* Writes log entries to Stackdriver Logging. This API method is the only way to send log entries
349+
* to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver Logging
350+
* agent (fluentd) and all logging libraries configured to use Stackdriver Logging. A single
351+
* request may contain log entries for a maximum of 1000 different resources (projects,
352+
* organizations, billing accounts or folders)
352353
*
353354
* <p>Sample code:
354355
*
@@ -389,8 +390,9 @@ public final WriteLogEntriesResponse writeLogEntries(
389390
* earlier in the list will sort before the entries later in the list. See the `entries.list`
390391
* method.
391392
* <p>Log entries with timestamps that are more than the [logs retention
392-
* period](/logging/quota-policy) in the past or more than 24 hours in the future might be
393-
* discarded. Discarding does not return an error.
393+
* period](/logging/quota-policy) in the past or more than 24 hours in the future will not be
394+
* available when calling `entries.list`. However, those log entries can still be exported
395+
* with [LogSinks](/logging/docs/api/tasks/exporting-logs).
394396
* <p>To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy)
395397
* for calls to `entries.write`, you should try to include several log entries in this list,
396398
* rather than calling this method for each individual log entry.
@@ -414,11 +416,11 @@ public final WriteLogEntriesResponse writeLogEntries(
414416

415417
// AUTO-GENERATED DOCUMENTATION AND METHOD
416418
/**
417-
* ## Log entry resources
418-
*
419-
* <p>Writes log entries to Stackdriver Logging. This API method is the only way to send log
420-
* entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver
421-
* Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging.
419+
* Writes log entries to Stackdriver Logging. This API method is the only way to send log entries
420+
* to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver Logging
421+
* agent (fluentd) and all logging libraries configured to use Stackdriver Logging. A single
422+
* request may contain log entries for a maximum of 1000 different resources (projects,
423+
* organizations, billing accounts or folders)
422424
*
423425
* <p>Sample code:
424426
*
@@ -441,11 +443,11 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
441443

442444
// AUTO-GENERATED DOCUMENTATION AND METHOD
443445
/**
444-
* ## Log entry resources
445-
*
446-
* <p>Writes log entries to Stackdriver Logging. This API method is the only way to send log
447-
* entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver
448-
* Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging.
446+
* Writes log entries to Stackdriver Logging. This API method is the only way to send log entries
447+
* to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver Logging
448+
* agent (fluentd) and all logging libraries configured to use Stackdriver Logging. A single
449+
* request may contain log entries for a maximum of 1000 different resources (projects,
450+
* organizations, billing accounts or folders)
449451
*
450452
* <p>Sample code:
451453
*
@@ -475,10 +477,10 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
475477
*
476478
* <pre><code>
477479
* try (LoggingClient loggingClient = LoggingClient.create()) {
478-
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
480+
* List&lt;String&gt; formattedResourceNames = new ArrayList&lt;&gt;();
479481
* String filter = "";
480482
* String orderBy = "";
481-
* for (LogEntry element : loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
483+
* for (LogEntry element : loggingClient.listLogEntries(formattedResourceNames, filter, orderBy).iterateAll()) {
482484
* // doThingsWith(element);
483485
* }
484486
* }
@@ -522,9 +524,9 @@ public final ListLogEntriesPagedResponse listLogEntries(
522524
*
523525
* <pre><code>
524526
* try (LoggingClient loggingClient = LoggingClient.create()) {
525-
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
527+
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
526528
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
527-
* .addAllResourceNames(resourceNames)
529+
* .addAllResourceNames(ParentName.toStringList(resourceNames))
528530
* .build();
529531
* for (LogEntry element : loggingClient.listLogEntries(request).iterateAll()) {
530532
* // doThingsWith(element);
@@ -548,9 +550,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
548550
*
549551
* <pre><code>
550552
* try (LoggingClient loggingClient = LoggingClient.create()) {
551-
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
553+
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
552554
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
553-
* .addAllResourceNames(resourceNames)
555+
* .addAllResourceNames(ParentName.toStringList(resourceNames))
554556
* .build();
555557
* ApiFuture&lt;ListLogEntriesPagedResponse&gt; future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
556558
* // Do something
@@ -574,9 +576,9 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re
574576
*
575577
* <pre><code>
576578
* try (LoggingClient loggingClient = LoggingClient.create()) {
577-
* List&lt;String&gt; resourceNames = new ArrayList&lt;&gt;();
579+
* List&lt;ParentName&gt; resourceNames = new ArrayList&lt;&gt;();
578580
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
579-
* .addAllResourceNames(resourceNames)
581+
* .addAllResourceNames(ParentName.toStringList(resourceNames))
580582
* .build();
581583
* while (true) {
582584
* ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,23 @@ public static class Builder extends StubSettings.Builder<ConfigServiceV2StubSett
400400
settings =
401401
RetrySettings.newBuilder()
402402
.setInitialRetryDelay(Duration.ofMillis(100L))
403-
.setRetryDelayMultiplier(1.2)
404-
.setMaxRetryDelay(Duration.ofMillis(1000L))
405-
.setInitialRpcTimeout(Duration.ofMillis(30000L))
406-
.setRpcTimeoutMultiplier(1.5)
407-
.setMaxRpcTimeout(Duration.ofMillis(60000L))
408-
.setTotalTimeout(Duration.ofMillis(90000L))
403+
.setRetryDelayMultiplier(1.3)
404+
.setMaxRetryDelay(Duration.ofMillis(60000L))
405+
.setInitialRpcTimeout(Duration.ofMillis(20000L))
406+
.setRpcTimeoutMultiplier(1.0)
407+
.setMaxRpcTimeout(Duration.ofMillis(20000L))
408+
.setTotalTimeout(Duration.ofMillis(600000L))
409409
.build();
410410
definitions.put("default", settings);
411411
settings =
412412
RetrySettings.newBuilder()
413413
.setInitialRetryDelay(Duration.ofMillis(100L))
414-
.setRetryDelayMultiplier(1.2)
415-
.setMaxRetryDelay(Duration.ofMillis(1000L))
416-
.setInitialRpcTimeout(Duration.ofMillis(30000L))
417-
.setRpcTimeoutMultiplier(1.5)
418-
.setMaxRpcTimeout(Duration.ofMillis(60000L))
419-
.setTotalTimeout(Duration.ofMillis(120000L))
414+
.setRetryDelayMultiplier(1.3)
415+
.setMaxRetryDelay(Duration.ofMillis(60000L))
416+
.setInitialRpcTimeout(Duration.ofMillis(20000L))
417+
.setRpcTimeoutMultiplier(1.0)
418+
.setMaxRpcTimeout(Duration.ofMillis(20000L))
419+
.setTotalTimeout(Duration.ofMillis(600000L))
420420
.build();
421421
definitions.put("write_sink", settings);
422422
RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -493,7 +493,7 @@ private static Builder initDefaults(Builder builder) {
493493

494494
builder
495495
.updateSinkSettings()
496-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
496+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
497497
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
498498

499499
builder

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,23 +512,23 @@ public static class Builder extends StubSettings.Builder<LoggingServiceV2StubSet
512512
settings =
513513
RetrySettings.newBuilder()
514514
.setInitialRetryDelay(Duration.ofMillis(100L))
515-
.setRetryDelayMultiplier(1.2)
516-
.setMaxRetryDelay(Duration.ofMillis(1000L))
515+
.setRetryDelayMultiplier(1.3)
516+
.setMaxRetryDelay(Duration.ofMillis(60000L))
517517
.setInitialRpcTimeout(Duration.ofMillis(20000L))
518-
.setRpcTimeoutMultiplier(1.5)
519-
.setMaxRpcTimeout(Duration.ofMillis(60000L))
520-
.setTotalTimeout(Duration.ofMillis(90000L))
518+
.setRpcTimeoutMultiplier(1.0)
519+
.setMaxRpcTimeout(Duration.ofMillis(20000L))
520+
.setTotalTimeout(Duration.ofMillis(600000L))
521521
.build();
522522
definitions.put("default", settings);
523523
settings =
524524
RetrySettings.newBuilder()
525525
.setInitialRetryDelay(Duration.ofMillis(100L))
526-
.setRetryDelayMultiplier(1.2)
527-
.setMaxRetryDelay(Duration.ofMillis(1000L))
528-
.setInitialRpcTimeout(Duration.ofMillis(2000L))
529-
.setRpcTimeoutMultiplier(1.5)
530-
.setMaxRpcTimeout(Duration.ofMillis(10000L))
531-
.setTotalTimeout(Duration.ofMillis(20000L))
526+
.setRetryDelayMultiplier(1.3)
527+
.setMaxRetryDelay(Duration.ofMillis(60000L))
528+
.setInitialRpcTimeout(Duration.ofMillis(20000L))
529+
.setRpcTimeoutMultiplier(1.0)
530+
.setMaxRpcTimeout(Duration.ofMillis(20000L))
531+
.setTotalTimeout(Duration.ofMillis(600000L))
532532
.build();
533533
definitions.put("list", settings);
534534
RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -603,7 +603,7 @@ private static Builder initDefaults(Builder builder) {
603603
builder
604604
.listLogEntriesSettings()
605605
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
606-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("list"));
606+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
607607

608608
builder
609609
.listMonitoredResourceDescriptorsSettings()

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ public static class Builder extends StubSettings.Builder<MetricsServiceV2StubSet
296296
settings =
297297
RetrySettings.newBuilder()
298298
.setInitialRetryDelay(Duration.ofMillis(100L))
299-
.setRetryDelayMultiplier(1.2)
300-
.setMaxRetryDelay(Duration.ofMillis(1000L))
299+
.setRetryDelayMultiplier(1.3)
300+
.setMaxRetryDelay(Duration.ofMillis(60000L))
301301
.setInitialRpcTimeout(Duration.ofMillis(20000L))
302-
.setRpcTimeoutMultiplier(1.5)
303-
.setMaxRpcTimeout(Duration.ofMillis(60000L))
304-
.setTotalTimeout(Duration.ofMillis(90000L))
302+
.setRpcTimeoutMultiplier(1.0)
303+
.setMaxRpcTimeout(Duration.ofMillis(20000L))
304+
.setTotalTimeout(Duration.ofMillis(600000L))
305305
.build();
306306
definitions.put("default", settings);
307307
RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -363,7 +363,7 @@ private static Builder initDefaults(Builder builder) {
363363

364364
builder
365365
.updateLogMetricSettings()
366-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
366+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
367367
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
368368

369369
builder

0 commit comments

Comments
 (0)