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

Commit

Permalink
chore: migrate to owlbot (#219)
Browse files Browse the repository at this point in the history
feat: add kind field which is used to distinguish between responsetypes 
feat: add `potentially_thresholded_requests_per_hour` field to `PropertyQuota`
  • Loading branch information
Neenu1995 committed Jun 3, 2021
1 parent 8b30dcd commit c1d3e02
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 64 deletions.
3 changes: 3 additions & 0 deletions .github/.OwlBot.lock.yaml
@@ -0,0 +1,3 @@
docker:
digest: sha256:ee698481139bf3df35cd83d2f17f9670ee914d6184f8909a81d672a6abaf0e72
image: gcr.io/repo-automation-bots/owlbot-java:latest
29 changes: 29 additions & 0 deletions .github/.OwlBot.yaml
@@ -0,0 +1,29 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

docker:
image: "gcr.io/repo-automation-bots/owlbot-java:latest"

deep-remove-regex:
- "/grpc-google-.*/src"
- "/proto-google-.*/src"
- "/google-.*/src"

deep-copy-regex:
- source: "/google/analytics/data/(v.*)/.*-java/proto-google-.*/src"
dest: "/owl-bot-staging/$1/proto-google-analytics-data-$1/src"
- source: "/google/analytics/data/(v.*)/.*-java/grpc-google-.*/src"
dest: "/owl-bot-staging/$1/grpc-google-analytics-data-$1/src"
- source: "/google/analytics/data/(v.*)/.*-java/gapic-google-.*/src"
dest: "/owl-bot-staging/$1/google-analytics-data/src"
19 changes: 9 additions & 10 deletions google-analytics-data-bom/pom.xml
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version='1.0' encoding='UTF-8'?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.analytics</groupId>
Expand Down Expand Up @@ -64,31 +64,30 @@

<dependencyManagement>
<dependencies>

<dependency>
<groupId>com.google.analytics</groupId>
<artifactId>google-analytics-data</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:google-analytics-data:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-analytics-data-v1alpha</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1alpha:current} -->
<artifactId>grpc-google-analytics-data-v1alpha</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1alpha:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-analytics-data-v1beta</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1beta:current} -->
<artifactId>grpc-google-analytics-data-v1beta</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1beta:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-analytics-data-v1alpha</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1alpha:current} -->
<artifactId>proto-google-analytics-data-v1alpha</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1alpha:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-analytics-data-v1beta</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-analytics-data-v1beta:current} -->
<artifactId>proto-google-analytics-data-v1beta</artifactId>
<version>0.7.2-SNAPSHOT</version><!-- {x-version-update:proto-google-analytics-data-v1beta:current} -->
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
4 changes: 2 additions & 2 deletions google-analytics-data/pom.xml
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version='1.0' encoding='UTF-8'?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.analytics</groupId>
Expand Down Expand Up @@ -117,4 +117,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
24 changes: 9 additions & 15 deletions synth.py → owlbot.py
@@ -1,30 +1,24 @@
# Copyright 2020 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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

import synthtool.languages.java as java

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

for version in versions:
java.pregenerated_library(
service=service,
version=version,
path=f'google/analytics/data/{version}',
cloud_api=False,
)

java.common_templates()
s.remove_staging_dirs()
java.common_templates()
6 changes: 3 additions & 3 deletions pom.xml
Expand Up @@ -122,10 +122,10 @@

<modules>
<module>google-analytics-data</module>
<module>proto-google-analytics-data-v1alpha</module>
<module>proto-google-analytics-data-v1beta</module>
<module>grpc-google-analytics-data-v1alpha</module>
<module>grpc-google-analytics-data-v1beta</module>
<module>proto-google-analytics-data-v1alpha</module>
<module>proto-google-analytics-data-v1beta</module>
<module>google-analytics-data-bom</module>
</modules>

Expand Down Expand Up @@ -198,4 +198,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>
Expand Up @@ -53,8 +53,9 @@ public static void main(String... args) throws Exception {
*/
String propertyId = "YOUR-GA4-PROPERTY-ID";

/** TODO(developer): Replace this variable with a valid path to the credentials.json file
* for your service account downloaded from the Cloud Console.
/**
* TODO(developer): Replace this variable with a valid path to the credentials.json file for
* your service account downloaded from the Cloud Console.
*/
String credentialsJsonPath = "/path/to/credentials.json";
sampleRunReport(propertyId, credentialsJsonPath);
Expand All @@ -66,8 +67,8 @@ static void sampleRunReport(String propertyId, String credentialsJsonPath) throw
// [START analyticsdata_json_credentials_initialize]
// Explicitly use service account credentials by specifying
// the private key file.
GoogleCredentials credentials = GoogleCredentials
.fromStream(new FileInputStream(credentialsJsonPath));
GoogleCredentials credentials =
GoogleCredentials.fromStream(new FileInputStream(credentialsJsonPath));

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

// [START analyticsdata_json_credentials_run_report]
RunReportRequest request = RunReportRequest.newBuilder()
.setProperty("properties/" + propertyId)
.addDimensions(
Dimension.newBuilder().setName("city"))
.addMetrics(Metric.newBuilder().setName("activeUsers"))
.addDateRanges(
DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today")).build();
RunReportRequest request =
RunReportRequest.newBuilder()
.setProperty("properties/" + propertyId)
.addDimensions(Dimension.newBuilder().setName("city"))
.addMetrics(Metric.newBuilder().setName("activeUsers"))
.addDateRanges(DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today"))
.build();

// Make the request.
RunReportResponse response = analyticsData.runReport(request);
Expand All @@ -95,12 +96,11 @@ static void sampleRunReport(String propertyId, String credentialsJsonPath) throw
System.out.println("Report result:");
// Iterate through every row of the API response.
for (Row row : response.getRowsList()) {
System.out.printf("%s, %s%n", row.getDimensionValues(0).getValue(),
row.getMetricValues(0).getValue());
System.out.printf(
"%s, %s%n", row.getDimensionValues(0).getValue(), row.getMetricValues(0).getValue());
}
// [END analyticsdata_json_credentials_print_report]
}
}
}
// [END analyticsdata_json_credentials_quickstart]

Expand Up @@ -53,8 +53,8 @@ public static void main(String... args) throws Exception {
// on the provided GA4 property id.
static void sampleRunReport(String propertyId) throws Exception {
/**
* TODO(developer): Uncomment this variable and replace with your
* Google Analytics 4 property ID before running the sample.
* TODO(developer): Uncomment this variable and replace with your Google Analytics 4 property ID
* before running the sample.
*/
// propertyId = "YOUR-GA4-PROPERTY-ID";

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

// [START analyticsdata_run_report]
RunReportRequest request = RunReportRequest.newBuilder()
.setProperty("properties/" + propertyId)
.addDimensions(
Dimension.newBuilder().setName("city"))
.addMetrics(Metric.newBuilder().setName("activeUsers"))
.addDateRanges(
DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today")).build();
RunReportRequest request =
RunReportRequest.newBuilder()
.setProperty("properties/" + propertyId)
.addDimensions(Dimension.newBuilder().setName("city"))
.addMetrics(Metric.newBuilder().setName("activeUsers"))
.addDateRanges(DateRange.newBuilder().setStartDate("2020-03-31").setEndDate("today"))
.build();

// Make the request.
RunReportResponse response = analyticsData.runReport(request);
Expand All @@ -81,8 +81,8 @@ static void sampleRunReport(String propertyId) throws Exception {
System.out.println("Report result:");
// Iterate through every row of the API response.
for (Row row : response.getRowsList()) {
System.out.printf("%s, %s%n", row.getDimensionValues(0).getValue(),
row.getMetricValues(0).getValue());
System.out.printf(
"%s, %s%n", row.getDimensionValues(0).getValue(), row.getMetricValues(0).getValue());
}
// [END analyticsdata_print_report]
}
Expand Down
Expand Up @@ -24,9 +24,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for quickstart sample.
*/
/** Tests for quickstart sample. */
@RunWith(JUnit4.class)
public class QuickstartJsonCredentialsSampleTest {

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

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


private String runSample(String ga4PropertyId) throws Exception {
PrintStream stdOut = System.out;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Expand Down
Expand Up @@ -24,9 +24,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for quickstart sample.
*/
/** Tests for quickstart sample. */
@RunWith(JUnit4.class)
public class QuickstartSampleTest {

Expand Down
4 changes: 2 additions & 2 deletions versions.txt
Expand Up @@ -2,7 +2,7 @@
# module:released-version:current-version

google-analytics-data:0.7.1:0.7.2-SNAPSHOT
proto-google-analytics-data-v1alpha:0.7.1:0.7.2-SNAPSHOT
proto-google-analytics-data-v1beta:0.7.1:0.7.2-SNAPSHOT
grpc-google-analytics-data-v1alpha:0.7.1:0.7.2-SNAPSHOT
grpc-google-analytics-data-v1beta:0.7.1:0.7.2-SNAPSHOT
proto-google-analytics-data-v1alpha:0.7.1:0.7.2-SNAPSHOT
proto-google-analytics-data-v1beta:0.7.1:0.7.2-SNAPSHOT

0 comments on commit c1d3e02

Please sign in to comment.