Skip to content

Commit 5e6760e

Browse files
authored
Updated mlengine, monitoring, pubsub, spanner, and speech. (GoogleCloudPlatform#993)
* Updated mlengine/online-prediction. * Updated monitoring/ * Updated pubsub/ * Updated spanner/ * Updated speech/ * Fixed spanner mistakes.
1 parent 872391f commit 5e6760e

File tree

29 files changed

+254
-232
lines changed

29 files changed

+254
-232
lines changed

mlengine/online-prediction/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Cloud Machine Learning Engine - Online Prediction with Java
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=mlengine/online-prediction/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
## Setup
47
This sample demonstrates how to send online prediction requests to your deployed
58
model on CMLE.

mlengine/online-prediction/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ limitations under the License.
1717
<artifactId>mlengine-online-prediction</artifactId>
1818
<version>1</version>
1919

20+
<!--
21+
The parent pom defines common style checks and testing strategies for our samples.
22+
Removing or replacing it should not affect the execution of the samples in anyway.
23+
-->
24+
<parent>
25+
<groupId>com.google.cloud.samples</groupId>
26+
<artifactId>shared-configuration</artifactId>
27+
<version>1.0.8</version>
28+
</parent>
29+
30+
<properties>
31+
<maven.compiler.target>1.8</maven.compiler.target>
32+
<maven.compiler.source>1.8</maven.compiler.source>
33+
</properties>
34+
2035
<build>
2136
<plugins>
2237
<plugin>

monitoring/cloud-client/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Getting Started with Google Stackdriver Monitoring API and the Google Cloud Client libraries
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=monitoring/cloud-client/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
6+
37
[Google Stackdriver Monitoring API][monitoring] collects metrics, events, and
48
metadata from Google Cloud Platform, Amazon Web Services (AWS), hosted uptime
59
probes, application instrumentation, and a variety of common application

monitoring/cloud-client/pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@
1919
<artifactId>monitoring-google-cloud-samples</artifactId>
2020
<packaging>jar</packaging>
2121

22-
<!-- Parent defines config for testing & linting. -->
22+
<!--
23+
The parent pom defines common style checks and testing strategies for our samples.
24+
Removing or replacing it should not affect the execution of the samples in anyway.
25+
-->
2326
<parent>
24-
<artifactId>doc-samples</artifactId>
25-
<groupId>com.google.cloud</groupId>
26-
<version>1.0.0</version>
27-
<relativePath>../..</relativePath>
27+
<groupId>com.google.cloud.samples</groupId>
28+
<artifactId>shared-configuration</artifactId>
29+
<version>1.0.8</version>
2830
</parent>
2931

3032
<properties>
3133
<maven.compiler.target>1.8</maven.compiler.target>
3234
<maven.compiler.source>1.8</maven.compiler.source>
33-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3435
</properties>
3536

3637
<!-- Workaround for issue : https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2192 -->

monitoring/cloud-client/src/main/java/com/example/monitoring/QuickstartSample.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
/*
2-
Copyright 2017, Google, Inc.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.example.monitoring;
1818

19+
//CHECKSTYLE OFF: VariableDeclarationUsageDistance
1920
// [START monitoring_quickstart]
21+
2022
import com.google.api.Metric;
2123
import com.google.api.MonitoredResource;
22-
23-
// Imports the Google Cloud client library
2424
import com.google.cloud.monitoring.v3.MetricServiceClient;
25-
2625
import com.google.monitoring.v3.CreateTimeSeriesRequest;
2726
import com.google.monitoring.v3.Point;
2827
import com.google.monitoring.v3.ProjectName;
2928
import com.google.monitoring.v3.TimeInterval;
3029
import com.google.monitoring.v3.TimeSeries;
3130
import com.google.monitoring.v3.TypedValue;
3231
import com.google.protobuf.util.Timestamps;
33-
3432
import java.util.ArrayList;
3533
import java.util.HashMap;
3634
import java.util.List;
3735
import java.util.Map;
3836

37+
// Imports the Google Cloud client library
38+
3939
public class QuickstartSample {
40+
4041
public static void main(String... args) throws Exception {
4142
// Your Google Cloud Platform project ID
4243
String projectId = System.getProperty("projectId");
@@ -105,3 +106,4 @@ public static void main(String... args) throws Exception {
105106
}
106107
}
107108
// [END monitoring_quickstart]
109+
//CHECKSTYLE ON: VariableDeclarationUsageDistance

monitoring/cloud-client/src/main/java/com/example/monitoring/Snippets.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -37,7 +37,6 @@
3737
import com.google.monitoring.v3.TypedValue;
3838
import com.google.protobuf.Duration;
3939
import com.google.protobuf.util.Timestamps;
40-
4140
import java.io.IOException;
4241
import java.util.ArrayList;
4342
import java.util.HashMap;
@@ -134,6 +133,7 @@ void deleteMetricDescriptor(String name) throws IOException {
134133
* DOUBLE value_type and GAUGE metric kind. If the metric descriptor
135134
* doesn't exist, it will be auto-created.
136135
*/
136+
//CHECKSTYLE OFF: VariableDeclarationUsageDistance
137137
void writeTimeSeries() throws IOException {
138138
// [START monitoring_write_timeseries]
139139
String projectId = System.getProperty("projectId");
@@ -194,6 +194,7 @@ void writeTimeSeries() throws IOException {
194194
System.out.println("Done writing time series value.");
195195
// [END monitoring_write_timeseries]
196196
}
197+
//CHECKSTYLE ON: VariableDeclarationUsageDistance
197198

198199
/**
199200
* Demonstrates listing time series headers.

monitoring/cloud-client/src/test/java/com/example/monitoring/QuickstartSampleIT.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
/*
2-
Copyright 2016, Google, Inc.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2016 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.example.monitoring;
1818

1919
import static com.google.common.truth.Truth.assertThat;
2020

21+
import java.io.ByteArrayOutputStream;
22+
import java.io.PrintStream;
2123
import org.junit.After;
2224
import org.junit.Before;
2325
import org.junit.Test;
2426
import org.junit.runner.RunWith;
2527
import org.junit.runners.JUnit4;
2628

27-
import java.io.ByteArrayOutputStream;
28-
import java.io.PrintStream;
29-
3029
/**
3130
* Tests for quickstart sample.
3231
*/

monitoring/cloud-client/src/test/java/com/example/monitoring/SnippetsIT.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
/*
2-
Copyright 2016, Google, Inc.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2016 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.example.monitoring;
1818

1919
import static com.google.common.truth.Truth.assertThat;
2020

21+
import java.io.ByteArrayOutputStream;
22+
import java.io.PrintStream;
2123
import org.junit.After;
2224
import org.junit.Before;
2325
import org.junit.Test;
2426
import org.junit.runner.RunWith;
2527
import org.junit.runners.JUnit4;
2628

27-
import java.io.ByteArrayOutputStream;
28-
import java.io.PrintStream;
29-
3029
/**
3130
* Tests for quickstart sample.
3231
*/

pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333

3434
<maven.compiler.target>1.8</maven.compiler.target>
3535
<maven.compiler.source>1.8</maven.compiler.source>
36-
37-
<spanner.test.instance>default-instance</spanner.test.instance>
38-
<spanner.sample.database>mysample</spanner.sample.database>
39-
<spanner.quickstart.database>quickstart-db</spanner.quickstart.database>
4036
</properties>
4137

4238
<modules>
@@ -72,6 +68,8 @@
7268

7369
<module>logging</module>
7470

71+
<module>mlengine/online-prediction</module>
72+
7573
<module>monitoring/cloud-client</module>
7674

7775
<module>pubsub/cloud-client</module>

pubsub/cloud-client/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Getting Started with Cloud Pub/Sub and the Google Cloud Client libraries
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=pubsub/cloud-client/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
[Google Cloud Pub/Sub][pubsub] is a fully-managed real-time messaging service that allows you to
47
send and receive messages between independent applications.
58
This sample Java application demonstrates how to access the Pub/Sub API using

0 commit comments

Comments
 (0)