Skip to content

Commit

Permalink
feat!: remove Start/EndTime from LogSink, Metadata from LogEntry, imp…
Browse files Browse the repository at this point in the history
…lement multipattern resource names (#174)

* Integrate Python GAPIC Microgenerator in googleapis. This PR uses using documentai as an example. Depends on googleapis/gapic-generator-python#402

PiperOrigin-RevId: 309824146

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon May 4 15:06:44 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: e0f9d9e1f9de890db765be46f45ca8490723e3eb
Source-Link: googleapis/googleapis@e0f9d9e

* fix: restore GAPIC v2 retry configs

Restores GAPIC v2 retry config overrides that were
mistakenly removed during migration.

PiperOrigin-RevId: 312088359

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon May 18 08:57:12 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 5a90d467aa65e7f038f87585e8fbb45d74475e7c
Source-Link: googleapis/googleapis@5a90d46

* bazel: update protobuf, rules_go, gazelle, and gapic-generator-go versions - protobuf v3.12.1 - rules_go v0.23.0 - gazelle v0.21.0 - gapic-generator-go v0.14.1

PiperOrigin-RevId: 313460921

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed May 27 14:10:16 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: c4e37010d74071851ff24121f522e802231ac86e
Source-Link: googleapis/googleapis@c4e3701

* fix!: remove unused resource names

* fix: fix LogMetricName usage

* chore: allow breaking changes

* chore: fix formatting

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
yoshi-automation and chingor13 committed Jun 22, 2020
1 parent 0db74a5 commit d3d2370
Show file tree
Hide file tree
Showing 178 changed files with 16,301 additions and 12,171 deletions.
23 changes: 23 additions & 0 deletions google-cloud-logging/clirr-ignored-differences.xml
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<!-- TODO: remove after 2.0.0 released -->
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/logging/v2/ConfigClient</className>
<method>* *(com.google.logging.v2.*Name*)</method>
<to>* *(com.google.logging.v2.*Name*)</to>
</difference>
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/logging/v2/MetricsClient</className>
<method>* *LogMetric*(com.google.logging.v2.*Name*)</method>
<to>* *LogMetric*(com.google.logging.v2.*Name*)</to>
</difference>
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/logging/v2/LoggingClient</className>
<method>* listLogs(com.google.logging.v2.ParentName)</method>
<to>* listLogs(com.google.logging.v2.ProjectName)</to>
</difference>
</differences>
Expand Up @@ -24,7 +24,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.logging.v2.LogEntryOperation;
import com.google.logging.v2.LogEntrySourceLocation;
import com.google.logging.v2.ProjectLogName;
import com.google.logging.v2.LogName;
import com.google.protobuf.Timestamp;
import java.io.Serializable;
import java.util.HashMap;
Expand Down Expand Up @@ -466,7 +466,7 @@ com.google.logging.v2.LogEntry toPb(String projectId) {
com.google.logging.v2.LogEntry.Builder builder = payload.toPb();
builder.putAllLabels(labels);
if (logName != null) {
builder.setLogName(ProjectLogName.of(projectId, logName).toString());
builder.setLogName(LogName.ofProjectLogName(projectId, logName).toString());
}
if (resource != null) {
builder.setResource(resource.toPb());
Expand Down Expand Up @@ -525,7 +525,7 @@ static LogEntry fromPb(com.google.logging.v2.LogEntry entryPb) {
builder.setLabels(entryPb.getLabelsMap());
builder.setSeverity(Severity.fromPb(entryPb.getSeverity()));
if (!entryPb.getLogName().equals("")) {
builder.setLogName(ProjectLogName.parse(entryPb.getLogName()).getLog());
builder.setLogName(LogName.parse(entryPb.getLogName()).getLog());
}
if (!entryPb.getResource().equals(com.google.api.MonitoredResource.getDefaultInstance())) {
builder.setResource(MonitoredResource.fromPb(entryPb.getResource()));
Expand Down
Expand Up @@ -46,29 +46,7 @@
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
import com.google.logging.v2.CreateLogMetricRequest;
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteLogMetricRequest;
import com.google.logging.v2.DeleteLogRequest;
import com.google.logging.v2.DeleteSinkRequest;
import com.google.logging.v2.GetLogMetricRequest;
import com.google.logging.v2.GetSinkRequest;
import com.google.logging.v2.ListLogEntriesRequest;
import com.google.logging.v2.ListLogEntriesResponse;
import com.google.logging.v2.ListLogMetricsRequest;
import com.google.logging.v2.ListLogMetricsResponse;
import com.google.logging.v2.ListMonitoredResourceDescriptorsRequest;
import com.google.logging.v2.ListMonitoredResourceDescriptorsResponse;
import com.google.logging.v2.ListSinksRequest;
import com.google.logging.v2.ListSinksResponse;
import com.google.logging.v2.ProjectLogName;
import com.google.logging.v2.ProjectMetricName;
import com.google.logging.v2.ProjectName;
import com.google.logging.v2.ProjectSinkName;
import com.google.logging.v2.UpdateLogMetricRequest;
import com.google.logging.v2.UpdateSinkRequest;
import com.google.logging.v2.WriteLogEntriesRequest;
import com.google.logging.v2.WriteLogEntriesResponse;
import com.google.logging.v2.*;
import com.google.protobuf.Empty;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -254,7 +232,9 @@ public Sink update(SinkInfo sink) {
public ApiFuture<Sink> updateAsync(SinkInfo sink) {
UpdateSinkRequest request =
UpdateSinkRequest.newBuilder()
.setSinkName(ProjectSinkName.of(getOptions().getProjectId(), sink.getName()).toString())
.setSinkName(
LogSinkName.ofProjectSinkName(getOptions().getProjectId(), sink.getName())
.toString())
.setSink(sink.toPb(getOptions().getProjectId()))
.build();
return transform(rpc.update(request), Sink.fromPbFunction(this));
Expand All @@ -269,7 +249,8 @@ public Sink getSink(String sink) {
public ApiFuture<Sink> getSinkAsync(String sink) {
GetSinkRequest request =
GetSinkRequest.newBuilder()
.setSinkName(ProjectSinkName.of(getOptions().getProjectId(), sink).toString())
.setSinkName(
LogSinkName.ofProjectSinkName(getOptions().getProjectId(), sink).toString())
.build();
return transform(rpc.get(request), Sink.fromPbFunction(this));
}
Expand Down Expand Up @@ -333,7 +314,8 @@ public boolean deleteSink(String sink) {
public ApiFuture<Boolean> deleteSinkAsync(String sink) {
DeleteSinkRequest request =
DeleteSinkRequest.newBuilder()
.setSinkName(ProjectSinkName.of(getOptions().getProjectId(), sink).toString())
.setSinkName(
LogSinkName.ofProjectSinkName(getOptions().getProjectId(), sink).toString())
.build();
return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION);
}
Expand All @@ -345,7 +327,7 @@ public boolean deleteLog(String log) {
public ApiFuture<Boolean> deleteLogAsync(String log) {
DeleteLogRequest request =
DeleteLogRequest.newBuilder()
.setLogName(ProjectLogName.of(getOptions().getProjectId(), log).toString())
.setLogName(LogName.ofProjectLogName(getOptions().getProjectId(), log).toString())
.build();
return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION);
}
Expand Down Expand Up @@ -441,7 +423,7 @@ public ApiFuture<Metric> updateAsync(MetricInfo metric) {
UpdateLogMetricRequest request =
UpdateLogMetricRequest.newBuilder()
.setMetricName(
ProjectMetricName.of(getOptions().getProjectId(), metric.getName()).toString())
LogMetricName.of(getOptions().getProjectId(), metric.getName()).toString())
.setMetric(metric.toPb())
.build();
return transform(rpc.update(request), Metric.fromPbFunction(this));
Expand All @@ -456,7 +438,7 @@ public Metric getMetric(String metric) {
public ApiFuture<Metric> getMetricAsync(String metric) {
GetLogMetricRequest request =
GetLogMetricRequest.newBuilder()
.setMetricName(ProjectMetricName.of(getOptions().getProjectId(), metric).toString())
.setMetricName(LogMetricName.of(getOptions().getProjectId(), metric).toString())
.build();
return transform(rpc.get(request), Metric.fromPbFunction(this));
}
Expand Down Expand Up @@ -520,7 +502,7 @@ public boolean deleteMetric(String metric) {
public ApiFuture<Boolean> deleteMetricAsync(String metric) {
DeleteLogMetricRequest request =
DeleteLogMetricRequest.newBuilder()
.setMetricName(ProjectMetricName.of(getOptions().getProjectId(), metric).toString())
.setMetricName(LogMetricName.of(getOptions().getProjectId(), metric).toString())
.build();
return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION);
}
Expand All @@ -533,7 +515,7 @@ private static WriteLogEntriesRequest writeLogEntriesRequest(
WriteLogEntriesRequest.Builder builder = WriteLogEntriesRequest.newBuilder();
String logName = LOG_NAME.get(options);
if (logName != null) {
builder.setLogName(ProjectLogName.of(projectId, logName).toString());
builder.setLogName(LogName.ofProjectLogName(projectId, logName).toString());
}
MonitoredResource resource = RESOURCE.get(options);
if (resource != null) {
Expand Down

0 comments on commit d3d2370

Please sign in to comment.