Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit c1d3e02

Browse files
authored
chore: migrate to owlbot (#219)
feat: add kind field which is used to distinguish between responsetypes feat: add `potentially_thresholded_requests_per_hour` field to `PropertyQuota`
1 parent 8b30dcd commit c1d3e02

File tree

11 files changed

+84
-64
lines changed

11 files changed

+84
-64
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docker:
2+
digest: sha256:ee698481139bf3df35cd83d2f17f9670ee914d6184f8909a81d672a6abaf0e72
3+
image: gcr.io/repo-automation-bots/owlbot-java:latest

.github/.OwlBot.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
docker:
16+
image: "gcr.io/repo-automation-bots/owlbot-java:latest"
17+
18+
deep-remove-regex:
19+
- "/grpc-google-.*/src"
20+
- "/proto-google-.*/src"
21+
- "/google-.*/src"
22+
23+
deep-copy-regex:
24+
- source: "/google/analytics/data/(v.*)/.*-java/proto-google-.*/src"
25+
dest: "/owl-bot-staging/$1/proto-google-analytics-data-$1/src"
26+
- source: "/google/analytics/data/(v.*)/.*-java/grpc-google-.*/src"
27+
dest: "/owl-bot-staging/$1/grpc-google-analytics-data-$1/src"
28+
- source: "/google/analytics/data/(v.*)/.*-java/gapic-google-.*/src"
29+
dest: "/owl-bot-staging/$1/google-analytics-data/src"

google-analytics-data-bom/pom.xml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0"?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.analytics</groupId>
@@ -64,31 +64,30 @@
6464

6565
<dependencyManagement>
6666
<dependencies>
67-
6867
<dependency>
6968
<groupId>com.google.analytics</groupId>
7069
<artifactId>google-analytics-data</artifactId>
7170
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:google-analytics-data:current} -->
7271
</dependency>
7372
<dependency>
7473
<groupId>com.google.api.grpc</groupId>
75-
<artifactId>proto-google-analytics-data-v1alpha</artifactId>
76-
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1alpha:current} -->
74+
<artifactId>grpc-google-analytics-data-v1alpha</artifactId>
75+
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1alpha:current} -->
7776
</dependency>
7877
<dependency>
7978
<groupId>com.google.api.grpc</groupId>
80-
<artifactId>proto-google-analytics-data-v1beta</artifactId>
81-
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1beta:current} -->
79+
<artifactId>grpc-google-analytics-data-v1beta</artifactId>
80+
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1beta:current} -->
8281
</dependency>
8382
<dependency>
8483
<groupId>com.google.api.grpc</groupId>
85-
<artifactId>grpc-google-analytics-data-v1alpha</artifactId>
86-
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1alpha:current} -->
84+
<artifactId>proto-google-analytics-data-v1alpha</artifactId>
85+
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1alpha:current} -->
8786
</dependency>
8887
<dependency>
8988
<groupId>com.google.api.grpc</groupId>
90-
<artifactId>grpc-google-analytics-data-v1beta</artifactId>
91-
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1beta:current} -->
89+
<artifactId>proto-google-analytics-data-v1beta</artifactId>
90+
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1beta:current} -->
9291
</dependency>
9392
</dependencies>
9493
</dependencyManagement>

google-analytics-data/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0"?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.analytics</groupId>
@@ -117,4 +117,4 @@
117117
</plugin>
118118
</plugins>
119119
</build>
120-
</project>
120+
</project>

synth.py renamed to owlbot.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1-
# Copyright 2020 Google LLC
1+
# Copyright 2021 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""This script is used to synthesize generated parts of this library."""
15+
import synthtool as s
16+
from synthtool.languages import java
1617

17-
import synthtool.languages.java as java
1818

19-
service = 'analytics-data'
20-
versions = ['v1alpha', 'v1beta']
19+
for library in s.get_staging_dirs():
20+
# put any special-case replacements here
21+
s.move(library)
2122

22-
for version in versions:
23-
java.pregenerated_library(
24-
service=service,
25-
version=version,
26-
path=f'google/analytics/data/{version}',
27-
cloud_api=False,
28-
)
29-
30-
java.common_templates()
23+
s.remove_staging_dirs()
24+
java.common_templates()

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@
122122

123123
<modules>
124124
<module>google-analytics-data</module>
125-
<module>proto-google-analytics-data-v1alpha</module>
126-
<module>proto-google-analytics-data-v1beta</module>
127125
<module>grpc-google-analytics-data-v1alpha</module>
128126
<module>grpc-google-analytics-data-v1beta</module>
127+
<module>proto-google-analytics-data-v1alpha</module>
128+
<module>proto-google-analytics-data-v1beta</module>
129129
<module>google-analytics-data-bom</module>
130130
</modules>
131131

@@ -198,4 +198,4 @@
198198
</plugin>
199199
</plugins>
200200
</reporting>
201-
</project>
201+
</project>

samples/snippets/src/main/java/com/example/analytics/QuickstartJsonCredentialsSample.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ public static void main(String... args) throws Exception {
5353
*/
5454
String propertyId = "YOUR-GA4-PROPERTY-ID";
5555

56-
/** TODO(developer): Replace this variable with a valid path to the credentials.json file
57-
* for your service account downloaded from the Cloud Console.
56+
/**
57+
* TODO(developer): Replace this variable with a valid path to the credentials.json file for
58+
* your service account downloaded from the Cloud Console.
5859
*/
5960
String credentialsJsonPath = "/path/to/credentials.json";
6061
sampleRunReport(propertyId, credentialsJsonPath);
@@ -66,8 +67,8 @@ static void sampleRunReport(String propertyId, String credentialsJsonPath) throw
6667
// [START analyticsdata_json_credentials_initialize]
6768
// Explicitly use service account credentials by specifying
6869
// the private key file.
69-
GoogleCredentials credentials = GoogleCredentials
70-
.fromStream(new FileInputStream(credentialsJsonPath));
70+
GoogleCredentials credentials =
71+
GoogleCredentials.fromStream(new FileInputStream(credentialsJsonPath));
7172

7273
BetaAnalyticsDataSettings betaAnalyticsDataSettings =
7374
BetaAnalyticsDataSettings.newBuilder()
@@ -79,13 +80,13 @@ static void sampleRunReport(String propertyId, String credentialsJsonPath) throw
7980
// [END analyticsdata_json_credentials_initialize]
8081

8182
// [START analyticsdata_json_credentials_run_report]
82-
RunReportRequest request = RunReportRequest.newBuilder()
83-
.setProperty("properties/" + propertyId)
84-
.addDimensions(
85-
Dimension.newBuilder().setName("city"))
86-
.addMetrics(Metric.newBuilder().setName("activeUsers"))
87-
.addDateRanges(
88-
DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today")).build();
83+
RunReportRequest request =
84+
RunReportRequest.newBuilder()
85+
.setProperty("properties/" + propertyId)
86+
.addDimensions(Dimension.newBuilder().setName("city"))
87+
.addMetrics(Metric.newBuilder().setName("activeUsers"))
88+
.addDateRanges(DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today"))
89+
.build();
8990

9091
// Make the request.
9192
RunReportResponse response = analyticsData.runReport(request);
@@ -95,12 +96,11 @@ static void sampleRunReport(String propertyId, String credentialsJsonPath) throw
9596
System.out.println("Report result:");
9697
// Iterate through every row of the API response.
9798
for (Row row : response.getRowsList()) {
98-
System.out.printf("%s, %s%n", row.getDimensionValues(0).getValue(),
99-
row.getMetricValues(0).getValue());
99+
System.out.printf(
100+
"%s, %s%n", row.getDimensionValues(0).getValue(), row.getMetricValues(0).getValue());
100101
}
101102
// [END analyticsdata_json_credentials_print_report]
102103
}
103104
}
104105
}
105106
// [END analyticsdata_json_credentials_quickstart]
106-

samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public static void main(String... args) throws Exception {
5353
// on the provided GA4 property id.
5454
static void sampleRunReport(String propertyId) throws Exception {
5555
/**
56-
* TODO(developer): Uncomment this variable and replace with your
57-
* Google Analytics 4 property ID before running the sample.
56+
* TODO(developer): Uncomment this variable and replace with your Google Analytics 4 property ID
57+
* before running the sample.
5858
*/
5959
// propertyId = "YOUR-GA4-PROPERTY-ID";
6060

@@ -65,13 +65,13 @@ static void sampleRunReport(String propertyId) throws Exception {
6565
// [END analyticsdata_initialize]
6666

6767
// [START analyticsdata_run_report]
68-
RunReportRequest request = RunReportRequest.newBuilder()
69-
.setProperty("properties/" + propertyId)
70-
.addDimensions(
71-
Dimension.newBuilder().setName("city"))
72-
.addMetrics(Metric.newBuilder().setName("activeUsers"))
73-
.addDateRanges(
74-
DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today")).build();
68+
RunReportRequest request =
69+
RunReportRequest.newBuilder()
70+
.setProperty("properties/" + propertyId)
71+
.addDimensions(Dimension.newBuilder().setName("city"))
72+
.addMetrics(Metric.newBuilder().setName("activeUsers"))
73+
.addDateRanges(DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today"))
74+
.build();
7575

7676
// Make the request.
7777
RunReportResponse response = analyticsData.runReport(request);
@@ -81,8 +81,8 @@ static void sampleRunReport(String propertyId) throws Exception {
8181
System.out.println("Report result:");
8282
// Iterate through every row of the API response.
8383
for (Row row : response.getRowsList()) {
84-
System.out.printf("%s, %s%n", row.getDimensionValues(0).getValue(),
85-
row.getMetricValues(0).getValue());
84+
System.out.printf(
85+
"%s, %s%n", row.getDimensionValues(0).getValue(), row.getMetricValues(0).getValue());
8686
}
8787
// [END analyticsdata_print_report]
8888
}

samples/snippets/src/test/java/com/example/analytics/QuickstartJsonCredentialsSampleTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
import org.junit.runner.RunWith;
2525
import org.junit.runners.JUnit4;
2626

27-
/**
28-
* Tests for quickstart sample.
29-
*/
27+
/** Tests for quickstart sample. */
3028
@RunWith(JUnit4.class)
3129
public class QuickstartJsonCredentialsSampleTest {
3230

@@ -35,7 +33,6 @@ public class QuickstartJsonCredentialsSampleTest {
3533

3634
private String credentialsJsonPath = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
3735

38-
3936
private String runSample(String ga4PropertyId) throws Exception {
4037
PrintStream stdOut = System.out;
4138
ByteArrayOutputStream bout = new ByteArrayOutputStream();

samples/snippets/src/test/java/com/example/analytics/QuickstartSampleTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
import org.junit.runner.RunWith;
2525
import org.junit.runners.JUnit4;
2626

27-
/**
28-
* Tests for quickstart sample.
29-
*/
27+
/** Tests for quickstart sample. */
3028
@RunWith(JUnit4.class)
3129
public class QuickstartSampleTest {
3230

0 commit comments

Comments
 (0)