Skip to content

Commit 3c24d90

Browse files
SPI updates: logging docs, LRO support (#1419)
* Logging API: updating docs from proto * Speech API: introducing OperationFuture and OperationCallable to make handling of long-running operations easier
1 parent 00add6e commit 3c24d90

8 files changed

Lines changed: 159 additions & 77 deletions

File tree

google-cloud-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<dependency>
112112
<groupId>com.google.api</groupId>
113113
<artifactId>gax</artifactId>
114-
<version>0.0.24</version>
114+
<version>0.0.25</version>
115115
<exclusions>
116116
<exclusion>
117117
<groupId>io.grpc</groupId>

google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Client.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
// AUTO-GENERATED DOCUMENTATION AND SERVICE
4141
/**
42-
* Service Description: Service for configuring sinks used to export log entries outside Stackdriver
43-
* Logging.
42+
* Service Description: Service for configuring sinks used to export log entries outside of
43+
* Stackdriver Logging.
4444
*
4545
* <p>This class provides the ability to make remote calls to the backing service through method
4646
* calls that map to API methods. Sample code to get started:
@@ -218,12 +218,11 @@ public final ConfigServiceV2Settings getSettings() {
218218
* }
219219
* </code></pre>
220220
*
221-
* @param parent Required. The cloud resource containing the sinks. Example:
222-
* `"projects/my-logging-project"`.
221+
* @param parent Required. The resource name where this sink was created:
222+
* <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
223223
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
224224
*/
225225
public final ListSinksPagedResponse listSinks(String parent) {
226-
PARENT_PATH_TEMPLATE.validate(parent, "listSinks");
227226
ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build();
228227
return listSinks(request);
229228
}
@@ -321,12 +320,13 @@ public final UnaryCallable<ListSinksRequest, ListSinksResponse> listSinksCallabl
321320
* }
322321
* </code></pre>
323322
*
324-
* @param sinkName Required. The resource name of the sink to return. Example:
325-
* `"projects/my-project-id/sinks/my-sink-id"`.
323+
* @param sinkName Required. The resource name of the sink to return:
324+
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
325+
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
326326
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
327327
*/
328328
public final LogSink getSink(String sinkName) {
329-
SINK_PATH_TEMPLATE.validate(sinkName, "getSink");
329+
330330
GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(sinkName).build();
331331
return getSink(request);
332332
}
@@ -390,14 +390,14 @@ public final UnaryCallable<GetSinkRequest, LogSink> getSinkCallable() {
390390
* }
391391
* </code></pre>
392392
*
393-
* @param parent Required. The resource in which to create the sink. Example:
394-
* `"projects/my-project-id"`. The new sink must be provided in the request.
393+
* @param parent Required. The resource in which to create the sink:
394+
* <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
395395
* @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not
396396
* already in use.
397397
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
398398
*/
399399
public final LogSink createSink(String parent, LogSink sink) {
400-
PARENT_PATH_TEMPLATE.validate(parent, "createSink");
400+
401401
CreateSinkRequest request =
402402
CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build();
403403
return createSink(request);
@@ -467,14 +467,16 @@ public final UnaryCallable<CreateSinkRequest, LogSink> createSinkCallable() {
467467
* </code></pre>
468468
*
469469
* @param sinkName Required. The resource name of the sink to update, including the parent
470-
* resource and the sink identifier. If the sink does not exist, this method creates the sink.
471-
* Example: `"projects/my-project-id/sinks/my-sink-id"`.
470+
* resource and the sink identifier:
471+
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
472+
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
473+
* <p>Example: `"projects/my-project-id/sinks/my-sink-id"`.
472474
* @param sink Required. The updated sink, whose name is the same identifier that appears as part
473475
* of `sinkName`. If `sinkName` does not exist, then this method creates a new sink.
474476
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
475477
*/
476478
public final LogSink updateSink(String sinkName, LogSink sink) {
477-
SINK_PATH_TEMPLATE.validate(sinkName, "updateSink");
479+
478480
UpdateSinkRequest request =
479481
UpdateSinkRequest.newBuilder().setSinkName(sinkName).setSink(sink).build();
480482
return updateSink(request);
@@ -543,12 +545,14 @@ public final UnaryCallable<UpdateSinkRequest, LogSink> updateSinkCallable() {
543545
* </code></pre>
544546
*
545547
* @param sinkName Required. The resource name of the sink to delete, including the parent
546-
* resource and the sink identifier. Example: `"projects/my-project-id/sinks/my-sink-id"`. It
547-
* is an error if the sink does not exist.
548+
* resource and the sink identifier:
549+
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
550+
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
551+
* <p>It is an error if the sink does not exist.
548552
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
549553
*/
550554
public final void deleteSink(String sinkName) {
551-
SINK_PATH_TEMPLATE.validate(sinkName, "deleteSink");
555+
552556
DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(sinkName).build();
553557
deleteSink(request);
554558
}

google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Client.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public final LoggingServiceV2Settings getSettings() {
218218

219219
// AUTO-GENERATED DOCUMENTATION AND METHOD
220220
/**
221-
* Deletes a log and all its log entries. The log will reappear if it receives new entries.
221+
* Deletes all the log entries in a log. The log reappears if it receives new entries.
222222
*
223223
* <p>Sample code:
224224
*
@@ -229,19 +229,22 @@ public final LoggingServiceV2Settings getSettings() {
229229
* }
230230
* </code></pre>
231231
*
232-
* @param logName Required. The resource name of the log to delete. Example:
233-
* `"projects/my-project/logs/syslog"`.
232+
* @param logName Required. The resource name of the log to delete:
233+
* <p>"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
234+
* <p>`[LOG_ID]` must be URL-encoded. For example, `"projects/my-project-id/logs/syslog"`,
235+
* `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. For more
236+
* information about log names, see [LogEntry][google.logging.v2.LogEntry].
234237
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
235238
*/
236239
public final void deleteLog(String logName) {
237-
LOG_PATH_TEMPLATE.validate(logName, "deleteLog");
240+
238241
DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(logName).build();
239242
deleteLog(request);
240243
}
241244

242245
// AUTO-GENERATED DOCUMENTATION AND METHOD
243246
/**
244-
* Deletes a log and all its log entries. The log will reappear if it receives new entries.
247+
* Deletes all the log entries in a log. The log reappears if it receives new entries.
245248
*
246249
* <p>Sample code:
247250
*
@@ -264,7 +267,7 @@ private final void deleteLog(DeleteLogRequest request) {
264267

265268
// AUTO-GENERATED DOCUMENTATION AND METHOD
266269
/**
267-
* Deletes a log and all its log entries. The log will reappear if it receives new entries.
270+
* Deletes all the log entries in a log. The log reappears if it receives new entries.
268271
*
269272
* <p>Sample code:
270273
*
@@ -301,8 +304,11 @@ public final UnaryCallable<DeleteLogRequest, Empty> deleteLogCallable() {
301304
* </code></pre>
302305
*
303306
* @param logName Optional. A default log resource name that is assigned to all log entries in
304-
* `entries` that do not specify a value for `log_name`. Example:
305-
* `"projects/my-project/logs/syslog"`. See [LogEntry][google.logging.v2.LogEntry].
307+
* `entries` that do not specify a value for `log_name`:
308+
* <p>"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
309+
* <p>`[LOG_ID]` must be URL-encoded. For example, `"projects/my-project-id/logs/syslog"` or
310+
* `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. For more
311+
* information about log names, see [LogEntry][google.logging.v2.LogEntry].
306312
* @param resource Optional. A default monitored resource object that is assigned to all log
307313
* entries in `entries` that do not specify a value for `resource`. Example:
308314
* <p>{ "type": "gce_instance", "labels": { "zone": "us-central1-a", "instance_id":
@@ -325,9 +331,7 @@ public final WriteLogEntriesResponse writeLogEntries(
325331
MonitoredResource resource,
326332
Map<String, String> labels,
327333
List<LogEntry> entries) {
328-
if (!logName.isEmpty()) {
329-
LOG_PATH_TEMPLATE.validate(logName, "writeLogEntries");
330-
}
334+
331335
WriteLogEntriesRequest request =
332336
WriteLogEntriesRequest.newBuilder()
333337
.setLogName(logName)
@@ -402,12 +406,13 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
402406
* }
403407
* </code></pre>
404408
*
405-
* @param resourceNames Optional. One or more cloud resources from which to retrieve log entries.
406-
* Example: `"projects/my-project-1A"`, `"projects/1234567890"`. Projects listed in
407-
* `projectIds` are added to this list.
409+
* @param resourceNames Required. One or more cloud resources from which to retrieve log entries:
410+
* <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
411+
* <p>Projects listed in the `project_ids` field are added to this list.
408412
* @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
409413
* Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are
410-
* returned. An empty filter matches all log entries.
414+
* returned. An empty filter matches all log entries. The maximum length of the filter is
415+
* 20000 characters.
411416
* @param orderBy Optional. How the results should be sorted. Presently, the only permitted values
412417
* are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in
413418
* order of increasing values of `LogEntry.timestamp` (oldest first), and the second option

google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Client.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,11 @@ public final MetricsServiceV2Settings getSettings() {
220220
* }
221221
* </code></pre>
222222
*
223-
* @param parent Required. The resource name containing the metrics. Example:
224-
* `"projects/my-project-id"`.
223+
* @param parent Required. The name of the project containing the metrics:
224+
* <p>"projects/[PROJECT_ID]"
225225
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
226226
*/
227227
public final ListLogMetricsPagedResponse listLogMetrics(String parent) {
228-
PARENT_PATH_TEMPLATE.validate(parent, "listLogMetrics");
229228
ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build();
230229
return listLogMetrics(request);
231230
}
@@ -325,8 +324,8 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
325324
* }
326325
* </code></pre>
327326
*
328-
* @param metricName The resource name of the desired metric. Example:
329-
* `"projects/my-project-id/metrics/my-metric-id"`.
327+
* @param metricName The resource name of the desired metric:
328+
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
330329
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
331330
*/
332331
public final LogMetric getLogMetric(String metricName) {
@@ -395,14 +394,14 @@ public final UnaryCallable<GetLogMetricRequest, LogMetric> getLogMetricCallable(
395394
* }
396395
* </code></pre>
397396
*
398-
* @param parent The resource name of the project in which to create the metric. Example:
399-
* `"projects/my-project-id"`.
397+
* @param parent The resource name of the project in which to create the metric:
398+
* <p>"projects/[PROJECT_ID]"
400399
* <p>The new metric must be provided in the request.
401400
* @param metric The new logs-based metric, which must not have an identifier that already exists.
402401
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
403402
*/
404403
public final LogMetric createLogMetric(String parent, LogMetric metric) {
405-
PARENT_PATH_TEMPLATE.validate(parent, "createLogMetric");
404+
406405
CreateLogMetricRequest request =
407406
CreateLogMetricRequest.newBuilder().setParent(parent).setMetric(metric).build();
408407
return createLogMetric(request);
@@ -471,12 +470,12 @@ public final UnaryCallable<CreateLogMetricRequest, LogMetric> createLogMetricCal
471470
* }
472471
* </code></pre>
473472
*
474-
* @param metricName The resource name of the metric to update. Example:
475-
* `"projects/my-project-id/metrics/my-metric-id"`.
476-
* <p>The updated metric must be provided in the request and have the same identifier that is
477-
* specified in `metricName`. If the metric does not exist, it is created.
478-
* @param metric The updated metric, whose name must be the same as the metric identifier in
479-
* `metricName`. If `metricName` does not exist, then a new metric is created.
473+
* @param metricName The resource name of the metric to update:
474+
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
475+
* <p>The updated metric must be provided in the request and it's `name` field must be the
476+
* same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
477+
* created.
478+
* @param metric The updated metric.
480479
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
481480
*/
482481
public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
@@ -548,8 +547,8 @@ public final UnaryCallable<UpdateLogMetricRequest, LogMetric> updateLogMetricCal
548547
* }
549548
* </code></pre>
550549
*
551-
* @param metricName The resource name of the metric to delete. Example:
552-
* `"projects/my-project-id/metrics/my-metric-id"`.
550+
* @param metricName The resource name of the metric to delete:
551+
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
553552
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
554553
*/
555554
public final void deleteLogMetric(String metricName) {

google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
* ===================== ConfigServiceV2Client =====================
3838
*
39-
* <p>Service Description: Service for configuring sinks used to export log entries outside
39+
* <p>Service Description: Service for configuring sinks used to export log entries outside of
4040
* Stackdriver Logging.
4141
*
4242
* <p>Sample for ConfigServiceV2Client:

0 commit comments

Comments
 (0)