Skip to content

Commit e1a3689

Browse files
authored
Update Region Tags (GoogleCloudPlatform#1193)
* appidentity region tags * region tag removal
1 parent bd0ed67 commit e1a3689

File tree

18 files changed

+72
-120
lines changed

18 files changed

+72
-120
lines changed

appengine-java8/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import javax.servlet.http.HttpServletResponse;
3030
import org.apache.http.client.utils.URIBuilder;
3131

32-
// [START example]
3332
@SuppressWarnings("serial")
3433
// With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.
3534
@WebServlet(
@@ -68,4 +67,3 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
6867
resp.getWriter().println("Event tracked.");
6968
}
7069
}
71-
// [END example]

appengine-java8/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
public class IdentityServlet extends HttpServlet {
3434

35-
// [START versioned_hostnames]
35+
// [START gae_java8_app_identity_versioned_hostnames]
3636
@Override
3737
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
3838
resp.setContentType("text/plain");
@@ -41,5 +41,5 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
4141
resp.getWriter()
4242
.println(env.getAttributes().get("com.google.appengine.runtime.default_version_hostname"));
4343
}
44-
// [END versioned_hostnames]
44+
// [END gae_java8_app_identity_versioned_hostnames]
4545
}

appengine-java8/appidentity/src/main/java/com/example/appengine/appidentity/SignForAppServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public SignForAppServlet() {
5454
appIdentity = AppIdentityServiceFactory.getAppIdentityService();
5555
}
5656

57-
// [START asserting_identity_to_other_services]
57+
// [START gae_java8_app_identity_other_services]
5858
// Note that the algorithm used by AppIdentity.signForApp() and
5959
// getPublicCertificatesForApp() is "SHA256withRSA"
6060

@@ -102,7 +102,7 @@ private String simulateIdentityAssertion()
102102
"isValid=%b for message: %s\n\tsignature: %s\n\tpublic cert: %s",
103103
isValid, message, Arrays.toString(blobSignature), Arrays.toString(publicCert));
104104
}
105-
// [END asserting_identity_to_other_services]
105+
// [END gae_java8_app_identity_other_services]
106106

107107
@Override
108108
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {

appengine-java8/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
@SuppressWarnings("serial")
3333
class UrlShortener {
34-
// [START asserting_identity_to_Google_APIs]
34+
// [START gae_java8_app_identity_google_apis]
3535

3636
/**
3737
* Returns a shortened URL by calling the Google URL Shortener API.
@@ -74,5 +74,5 @@ public String createShortUrl(String longUrl) throws Exception {
7474
}
7575
}
7676
}
77-
// [END asserting_identity_to_Google_APIs]
77+
// [END gae_java8_app_identity_google_apis]
7878
}

appengine-java8/bigquery/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
<scope>provided</scope>
5050
</dependency>
5151

52-
<!-- [START dependencies] -->
5352
<dependency>
5453
<groupId>com.google.cloud</groupId>
5554
<artifactId>google-cloud-bigquery</artifactId>
@@ -60,7 +59,6 @@
6059
<artifactId>google-cloud-monitoring</artifactId>
6160
<version>1.38.0</version>
6261
</dependency>
63-
<!-- [END dependencies ] -->
6462

6563
<dependency>
6664
<groupId>commons-cli</groupId>

appengine-java8/bigquery/src/main/java/com/example/appengine/bigquerylogging/BigQueryRunner.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package com.example.appengine.bigquerylogging;
1818

19-
// [START bigquery_logging_all]
20-
// [START bigquery_logging_deps]
21-
2219
import com.google.api.Metric;
2320
import com.google.api.MetricDescriptor;
2421
import com.google.cloud.ServiceOptions;
@@ -52,14 +49,12 @@
5249
import java.util.Set;
5350
import java.util.UUID;
5451
import java.util.stream.Collectors;
55-
// [END bigquery_logging_deps]
5652

5753
public class BigQueryRunner {
5854
private static final String CUSTOM_METRIC_FILTER =
5955
"metric.type = starts_with(\"custom.googleapis.com/\")";
6056
private static BigQueryRunner instance;
6157

62-
// [START bigquery_logging_metrics]
6358
private static final MetricDescriptor QUERY_DURATION_METRIC = MetricDescriptor
6459
.newBuilder()
6560
.setName("custom.googleapis.com/queryDuration")
@@ -81,7 +76,6 @@ public class BigQueryRunner {
8176
private static final Set<MetricDescriptor> REQUIRED_METRICS = ImmutableSet.of(
8277
QUERY_DURATION_METRIC, ROWS_RETURNED_METRIC
8378
);
84-
// [END bigquery_logging_metrics]
8579

8680
private static TableResult mostRecentRunResult;
8781
private static Set<String> existingMetrics = Sets.newHashSet();
@@ -117,7 +111,6 @@ public static TableResult getMostRecentRunResult() {
117111
}
118112

119113
public void runQuery() throws InterruptedException {
120-
// [START bigquery_logging_query]
121114
QueryJobConfiguration queryConfig =
122115
QueryJobConfiguration.newBuilder(
123116
"SELECT "
@@ -150,9 +143,7 @@ public void runQuery() throws InterruptedException {
150143
// errors, not just the latest one.
151144
throw new RuntimeException(queryJob.getStatus().getError().toString());
152145
}
153-
// [END bigquery_logging_query]
154146

155-
// [START bigquery_logging_log_metrics]
156147
// Log the result metrics.
157148
TableResult result = queryJob.getQueryResults();
158149

@@ -172,7 +163,6 @@ public void runQuery() throws InterruptedException {
172163
createMetricsIfNeeded();
173164
client.createTimeSeries(request);
174165
os.println("Done writing metrics.");
175-
// [END bigquery_logging_log_metrics]
176166

177167
mostRecentRunResult = result;
178168
}
@@ -205,7 +195,6 @@ private TimeSeries prepareMetric(MetricDescriptor requiredMetric, long metricVal
205195
.build();
206196
}
207197

208-
// [START bigquery_logging_list_time_series]
209198
public List<TimeSeriesSummary> getTimeSeriesValues() {
210199
List<TimeSeriesSummary> summaries = Lists.newArrayList();
211200
createMetricsIfNeeded();
@@ -236,9 +225,7 @@ public List<TimeSeriesSummary> getTimeSeriesValues() {
236225
}
237226
return summaries;
238227
}
239-
// [END bigquery_logging_list_time_series]
240228

241-
// [START bigquery_logging_list_and_create_metrics]
242229
private void createMetricsIfNeeded() {
243230
// If all required metrics already exist, no need to make service calls.
244231
if (REQUIRED_METRICS.stream()
@@ -262,9 +249,7 @@ private void createMetricsIfNeeded() {
262249
.filter(metric -> !existingMetrics.contains(metric.getDisplayName()))
263250
.forEach(this::createMetric);
264251
}
265-
// [END bigquery_logging_list_and_create_metrics]
266252

267-
// [START bigquery_logging_create_metric]
268253
private void createMetric(MetricDescriptor newMetric) {
269254
CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
270255
.setName(projectName)
@@ -273,6 +258,5 @@ private void createMetric(MetricDescriptor newMetric) {
273258

274259
client.createMetricDescriptor(request);
275260
}
276-
// [END bigquery_logging_create_metric]
261+
277262
}
278-
// [END bigquery_logging_all]

appengine-java8/bigtable/src/main/java/com/example/bigtable/BigtableHelloWorld.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ public static String create(Connection connection) {
5757
try {
5858
// The admin API lets us create, manage and delete tables
5959
Admin admin = connection.getAdmin();
60-
// [END connecting_to_bigtable]
6160

62-
// [START creating_a_table]
6361
// Create a table with a single column family
6462
HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
6563
descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY_NAME));
@@ -77,7 +75,6 @@ public static String doHelloWorld() {
7775

7876
StringBuilder result = new StringBuilder();
7977

80-
// [START connecting_to_bigtable]
8178
// Create the Bigtable connection, use try-with-resources to make sure it gets closed
8279
Connection connection = BigtableHelper.getConnection();
8380
result.append(create(connection));
@@ -86,7 +83,6 @@ public static String doHelloWorld() {
8683

8784
// Retrieve the table we just created so we can do some reads and writes
8885

89-
// [START writing_rows]
9086
// Write some rows to the table
9187
result.append("Write some greetings to the table<br>");
9288
for (int i = 0; i < GREETINGS.length; i++) {
@@ -108,9 +104,7 @@ public static String doHelloWorld() {
108104
put.addColumn(COLUMN_FAMILY_NAME, COLUMN_NAME, Bytes.toBytes(GREETINGS[i]));
109105
table.put(put);
110106
}
111-
// [END writing_rows]
112107

113-
// [START getting_a_row]
114108
// Get the first greeting by row key
115109
String rowKey = "greeting0";
116110
Result getResult = table.get(new Get(Bytes.toBytes(rowKey)));
@@ -123,7 +117,6 @@ public static String doHelloWorld() {
123117
result.append(greeting);
124118
result.append("<br>");
125119

126-
// [START scanning_all_rows]
127120
// Now scan across all rows.
128121
Scan scan = new Scan();
129122

@@ -135,7 +128,6 @@ public static String doHelloWorld() {
135128
result.append(Bytes.toString(valueBytes));
136129
result.append("<br>");
137130
}
138-
// [END scanning_all_rows]
139131

140132
} catch (IOException e) {
141133
result.append("Exception while running HelloWorld: " + e.getMessage() + "<br>");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy