Skip to content

Commit c666e05

Browse files
Renaming project resource entity to parent, one private->public fix
1 parent 016cc2d commit c666e05

7 files changed

Lines changed: 84 additions & 84 deletions

File tree

gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ public final ConfigServiceV2Settings getSettings() {
102102
return settings;
103103
}
104104

105-
private static final PathTemplate PROJECT_PATH_TEMPLATE =
105+
private static final PathTemplate PARENT_PATH_TEMPLATE =
106106
PathTemplate.createWithoutUrlEncoding("projects/{project}");
107107

108108
private static final PathTemplate SINK_PATH_TEMPLATE =
109109
PathTemplate.createWithoutUrlEncoding("projects/{project}/sinks/{sink}");
110110

111111
/**
112112
* Formats a string containing the fully-qualified path to represent
113-
* a project resource.
113+
* a parent resource.
114114
*/
115-
public static final String formatProjectName(String project) {
116-
return PROJECT_PATH_TEMPLATE.instantiate("project", project);
115+
public static final String formatParentName(String project) {
116+
return PARENT_PATH_TEMPLATE.instantiate("project", project);
117117
}
118118

119119
/**
@@ -128,10 +128,10 @@ public static final String formatSinkName(String project, String sink) {
128128

129129
/**
130130
* Parses the project from the given fully-qualified path which
131-
* represents a project resource.
131+
* represents a parent resource.
132132
*/
133-
public static final String parseProjectFromProjectName(String projectName) {
134-
return PROJECT_PATH_TEMPLATE.parse(projectName).get("project");
133+
public static final String parseProjectFromParentName(String parentName) {
134+
return PARENT_PATH_TEMPLATE.parse(parentName).get("project");
135135
}
136136

137137
/**
@@ -217,7 +217,7 @@ public void close() throws IOException {
217217
* Sample code:
218218
* <pre><code>
219219
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
220-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
220+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
221221
* for (LogSink element : configServiceV2Api.listSinks(formattedParent)) {
222222
* // doThingsWith(element);
223223
* }
@@ -229,7 +229,7 @@ public void close() throws IOException {
229229
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
230230
*/
231231
public final PageAccessor<LogSink> listSinks(String parent) {
232-
PROJECT_PATH_TEMPLATE.validate(parent, "listSinks");
232+
PARENT_PATH_TEMPLATE.validate(parent, "listSinks");
233233
ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build();
234234
return listSinks(request);
235235
}
@@ -241,7 +241,7 @@ public final PageAccessor<LogSink> listSinks(String parent) {
241241
* Sample code:
242242
* <pre><code>
243243
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
244-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
244+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
245245
* ListSinksRequest request = ListSinksRequest.newBuilder()
246246
* .setParent(formattedParent)
247247
* .build();
@@ -265,7 +265,7 @@ public final PageAccessor<LogSink> listSinks(ListSinksRequest request) {
265265
* Sample code:
266266
* <pre><code>
267267
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
268-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
268+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
269269
* ListSinksRequest request = ListSinksRequest.newBuilder()
270270
* .setParent(formattedParent)
271271
* .build();
@@ -288,7 +288,7 @@ public final ApiCallable<ListSinksRequest, PageAccessor<LogSink>> listSinksPaged
288288
* Sample code:
289289
* <pre><code>
290290
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
291-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
291+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
292292
* ListSinksRequest request = ListSinksRequest.newBuilder()
293293
* .setParent(formattedParent)
294294
* .build();
@@ -383,7 +383,7 @@ public final ApiCallable<GetSinkRequest, LogSink> getSinkCallable() {
383383
* Sample code:
384384
* <pre><code>
385385
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
386-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
386+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
387387
* LogSink sink = LogSink.newBuilder().build();
388388
* LogSink response = configServiceV2Api.createSink(formattedParent, sink);
389389
* }
@@ -398,7 +398,7 @@ public final ApiCallable<GetSinkRequest, LogSink> getSinkCallable() {
398398
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
399399
*/
400400
public final LogSink createSink(String parent, LogSink sink) {
401-
PROJECT_PATH_TEMPLATE.validate(parent, "createSink");
401+
PARENT_PATH_TEMPLATE.validate(parent, "createSink");
402402
CreateSinkRequest request =
403403
CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build();
404404
return createSink(request);
@@ -411,7 +411,7 @@ public final LogSink createSink(String parent, LogSink sink) {
411411
* Sample code:
412412
* <pre><code>
413413
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
414-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
414+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
415415
* LogSink sink = LogSink.newBuilder().build();
416416
* CreateSinkRequest request = CreateSinkRequest.newBuilder()
417417
* .setParent(formattedParent)
@@ -435,7 +435,7 @@ public final LogSink createSink(CreateSinkRequest request) {
435435
* Sample code:
436436
* <pre><code>
437437
* try (ConfigServiceV2Api configServiceV2Api = ConfigServiceV2Api.create()) {
438-
* String formattedParent = ConfigServiceV2Api.formatProjectName("[PROJECT]");
438+
* String formattedParent = ConfigServiceV2Api.formatParentName("[PROJECT]");
439439
* LogSink sink = LogSink.newBuilder().build();
440440
* CreateSinkRequest request = CreateSinkRequest.newBuilder()
441441
* .setParent(formattedParent)

gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,18 @@ public final LoggingServiceV2Settings getSettings() {
112112
return settings;
113113
}
114114

115-
private static final PathTemplate PROJECT_PATH_TEMPLATE =
115+
private static final PathTemplate PARENT_PATH_TEMPLATE =
116116
PathTemplate.createWithoutUrlEncoding("projects/{project}");
117117

118118
private static final PathTemplate LOG_PATH_TEMPLATE =
119119
PathTemplate.createWithoutUrlEncoding("projects/{project}/logs/{log}");
120120

121121
/**
122122
* Formats a string containing the fully-qualified path to represent
123-
* a project resource.
123+
* a parent resource.
124124
*/
125-
public static final String formatProjectName(String project) {
126-
return PROJECT_PATH_TEMPLATE.instantiate("project", project);
125+
public static final String formatParentName(String project) {
126+
return PARENT_PATH_TEMPLATE.instantiate("project", project);
127127
}
128128

129129
/**
@@ -138,10 +138,10 @@ public static final String formatLogName(String project, String log) {
138138

139139
/**
140140
* Parses the project from the given fully-qualified path which
141-
* represents a project resource.
141+
* represents a parent resource.
142142
*/
143-
public static final String parseProjectFromProjectName(String projectName) {
144-
return PROJECT_PATH_TEMPLATE.parse(projectName).get("project");
143+
public static final String parseProjectFromParentName(String parentName) {
144+
return PARENT_PATH_TEMPLATE.parse(parentName).get("project");
145145
}
146146

147147
/**
@@ -532,7 +532,7 @@ public final ApiCallable<ListLogEntriesRequest, ListLogEntriesResponse> listLogE
532532
* @param request The request object containing all of the parameters for the API call.
533533
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
534534
*/
535-
private final PageAccessor<MonitoredResourceDescriptor> listMonitoredResourceDescriptors(
535+
public final PageAccessor<MonitoredResourceDescriptor> listMonitoredResourceDescriptors(
536536
ListMonitoredResourceDescriptorsRequest request) {
537537
return listMonitoredResourceDescriptorsPagedCallable().call(request);
538538
}

gcloud-java-logging/baseline/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ public final MetricsServiceV2Settings getSettings() {
102102
return settings;
103103
}
104104

105-
private static final PathTemplate PROJECT_PATH_TEMPLATE =
105+
private static final PathTemplate PARENT_PATH_TEMPLATE =
106106
PathTemplate.createWithoutUrlEncoding("projects/{project}");
107107

108108
private static final PathTemplate METRIC_PATH_TEMPLATE =
109109
PathTemplate.createWithoutUrlEncoding("projects/{project}/metrics/{metric}");
110110

111111
/**
112112
* Formats a string containing the fully-qualified path to represent
113-
* a project resource.
113+
* a parent resource.
114114
*/
115-
public static final String formatProjectName(String project) {
116-
return PROJECT_PATH_TEMPLATE.instantiate("project", project);
115+
public static final String formatParentName(String project) {
116+
return PARENT_PATH_TEMPLATE.instantiate("project", project);
117117
}
118118

119119
/**
@@ -128,10 +128,10 @@ public static final String formatMetricName(String project, String metric) {
128128

129129
/**
130130
* Parses the project from the given fully-qualified path which
131-
* represents a project resource.
131+
* represents a parent resource.
132132
*/
133-
public static final String parseProjectFromProjectName(String projectName) {
134-
return PROJECT_PATH_TEMPLATE.parse(projectName).get("project");
133+
public static final String parseProjectFromParentName(String parentName) {
134+
return PARENT_PATH_TEMPLATE.parse(parentName).get("project");
135135
}
136136

137137
/**
@@ -218,7 +218,7 @@ public void close() throws IOException {
218218
* Sample code:
219219
* <pre><code>
220220
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
221-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
221+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
222222
* for (LogMetric element : metricsServiceV2Api.listLogMetrics(formattedParent)) {
223223
* // doThingsWith(element);
224224
* }
@@ -230,7 +230,7 @@ public void close() throws IOException {
230230
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
231231
*/
232232
public final PageAccessor<LogMetric> listLogMetrics(String parent) {
233-
PROJECT_PATH_TEMPLATE.validate(parent, "listLogMetrics");
233+
PARENT_PATH_TEMPLATE.validate(parent, "listLogMetrics");
234234
ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build();
235235
return listLogMetrics(request);
236236
}
@@ -242,7 +242,7 @@ public final PageAccessor<LogMetric> listLogMetrics(String parent) {
242242
* Sample code:
243243
* <pre><code>
244244
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
245-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
245+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
246246
* ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
247247
* .setParent(formattedParent)
248248
* .build();
@@ -266,7 +266,7 @@ public final PageAccessor<LogMetric> listLogMetrics(ListLogMetricsRequest reques
266266
* Sample code:
267267
* <pre><code>
268268
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
269-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
269+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
270270
* ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
271271
* .setParent(formattedParent)
272272
* .build();
@@ -290,7 +290,7 @@ public final PageAccessor<LogMetric> listLogMetrics(ListLogMetricsRequest reques
290290
* Sample code:
291291
* <pre><code>
292292
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
293-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
293+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
294294
* ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
295295
* .setParent(formattedParent)
296296
* .build();
@@ -386,7 +386,7 @@ public final ApiCallable<GetLogMetricRequest, LogMetric> getLogMetricCallable()
386386
* Sample code:
387387
* <pre><code>
388388
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
389-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
389+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
390390
* LogMetric metric = LogMetric.newBuilder().build();
391391
* LogMetric response = metricsServiceV2Api.createLogMetric(formattedParent, metric);
392392
* }
@@ -401,7 +401,7 @@ public final ApiCallable<GetLogMetricRequest, LogMetric> getLogMetricCallable()
401401
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
402402
*/
403403
public final LogMetric createLogMetric(String parent, LogMetric metric) {
404-
PROJECT_PATH_TEMPLATE.validate(parent, "createLogMetric");
404+
PARENT_PATH_TEMPLATE.validate(parent, "createLogMetric");
405405
CreateLogMetricRequest request =
406406
CreateLogMetricRequest.newBuilder().setParent(parent).setMetric(metric).build();
407407
return createLogMetric(request);
@@ -414,7 +414,7 @@ public final LogMetric createLogMetric(String parent, LogMetric metric) {
414414
* Sample code:
415415
* <pre><code>
416416
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
417-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
417+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
418418
* LogMetric metric = LogMetric.newBuilder().build();
419419
* CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
420420
* .setParent(formattedParent)
@@ -438,7 +438,7 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) {
438438
* Sample code:
439439
* <pre><code>
440440
* try (MetricsServiceV2Api metricsServiceV2Api = MetricsServiceV2Api.create()) {
441-
* String formattedParent = MetricsServiceV2Api.formatProjectName("[PROJECT]");
441+
* String formattedParent = MetricsServiceV2Api.formatParentName("[PROJECT]");
442442
* LogMetric metric = LogMetric.newBuilder().build();
443443
* CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
444444
* .setParent(formattedParent)

gcloud-java-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public Sink create(SinkInfo sink) {
195195
@Override
196196
public Future<Sink> createAsync(SinkInfo sink) {
197197
CreateSinkRequest request = CreateSinkRequest.newBuilder()
198-
.setParent(ConfigServiceV2Api.formatProjectName(options().projectId()))
198+
.setParent(ConfigServiceV2Api.formatParentName(options().projectId()))
199199
.setSink(sink.toPb(options().projectId()))
200200
.build();
201201
return lazyTransform(rpc.create(request), Sink.fromPbFunction(this));
@@ -231,7 +231,7 @@ public Future<Sink> getSinkAsync(String sink) {
231231
private static ListSinksRequest listSinksRequest(LoggingOptions serviceOptions,
232232
Map<Option.OptionType, ?> options) {
233233
ListSinksRequest.Builder builder = ListSinksRequest.newBuilder();
234-
builder.setParent(ConfigServiceV2Api.formatProjectName(serviceOptions.projectId()));
234+
builder.setParent(ConfigServiceV2Api.formatParentName(serviceOptions.projectId()));
235235
Integer pageSize = PAGE_SIZE.get(options);
236236
String pageToken = PAGE_TOKEN.get(options);
237237
if (pageSize != null) {
@@ -352,7 +352,7 @@ public Metric create(MetricInfo metric) {
352352
@Override
353353
public Future<Metric> createAsync(MetricInfo metric) {
354354
CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
355-
.setParent(MetricsServiceV2Api.formatProjectName(options().projectId()))
355+
.setParent(MetricsServiceV2Api.formatParentName(options().projectId()))
356356
.setMetric(metric.toPb())
357357
.build();
358358
return lazyTransform(rpc.create(request), Metric.fromPbFunction(this));
@@ -388,7 +388,7 @@ public Future<Metric> getMetricAsync(String metric) {
388388
private static ListLogMetricsRequest listMetricsRequest(LoggingOptions serviceOptions,
389389
Map<Option.OptionType, ?> options) {
390390
ListLogMetricsRequest.Builder builder = ListLogMetricsRequest.newBuilder();
391-
builder.setParent(MetricsServiceV2Api.formatProjectName(serviceOptions.projectId()));
391+
builder.setParent(MetricsServiceV2Api.formatParentName(serviceOptions.projectId()));
392392
Integer pageSize = PAGE_SIZE.get(options);
393393
String pageToken = PAGE_TOKEN.get(options);
394394
if (pageSize != null) {

0 commit comments

Comments
 (0)