Skip to content

Commit 3196a79

Browse files
committed
Merge branch 'main' into ludo-java21
2 parents dbe01d0 + 17d5f90 commit 3196a79

File tree

168 files changed

+11837
-1795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+11837
-1795
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,22 @@
4444
/security-command-center @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/gcp-security-command-center
4545
/servicedirectory @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
4646
/webrisk @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
47+
/tpu @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
4748

4849
# DEE Platform Ops (DEEPO)
4950
/errorreporting @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
5051
/monitoring @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
51-
/opencensus @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
52-
/trace @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
5352

5453
# Cloud SDK Databases & Data Analytics teams
5554
# ---* Cloud Native DB
56-
/bigtable @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-native-db-dpes
55+
/bigtable @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/bigtable-eng
5756
/memorystore @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
5857
/spanner @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/api-spanner-java
5958
# ---* Cloud Storage
6059
/storage @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-storage-dpes
6160
/storage-transfer @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-storage-dpes
6261
# ---* Infra DB
63-
/cloud-sql @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/infra-db-sdk
62+
/cloud-sql @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-sql-connectors
6463

6564
# Data & AI
6665
/aiplatform @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/text-embedding

.github/blunderbuss.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ assign_issues_by:
3838
- labels:
3939
- 'api: cloudsql'
4040
to:
41-
- GoogleCloudPlatform/infra-db-sdk
41+
- GoogleCloudPlatform/cloud-sql-connectors
4242
- labels:
4343
- 'api: spanner'
4444
to:
@@ -115,7 +115,7 @@ assign_prs_by:
115115
- labels:
116116
- 'api: cloudsql'
117117
to:
118-
- GoogleCloudPlatform/infra-db-sdk
118+
- GoogleCloudPlatform/cloud-sql-connectors
119119
- labels:
120120
- 'api: spanner'
121121
to:

.github/renovate.json5

Lines changed: 92 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,136 @@
1-
// find legacy configuration at https://github.com/GoogleCloudPlatform/java-docs-samples/blob/91792d4da53a12f96032f4556815f7d91f27257b/renovate.json
21
{
3-
"extends": [
4-
"config:recommended",
5-
":approveMajorUpdates",
6-
"schedule:earlyMondays",
7-
":ignoreUnstable",
2+
extends: [
3+
'config:recommended',
4+
':approveMajorUpdates',
5+
'schedule:earlyMondays',
6+
':ignoreUnstable',
87
],
9-
"labels": [
10-
"dependencies",
11-
"automerge"
8+
labels: [
9+
'dependencies',
10+
'automerge',
1211
],
13-
"minimumReleaseAge": "7 days",
14-
"dependencyDashboardLabels": [
15-
"type: process",
12+
minimumReleaseAge: '7 days',
13+
dependencyDashboardLabels: [
14+
'type: process',
1615
],
17-
// discontinue upgrades for java8 code samples
18-
"ignorePaths": ["**/*java8*/**", "**/*java-8*/**"],
19-
"packageRules": [
16+
ignorePaths: [
17+
'**/*java8*/**',
18+
'**/*java-8*/**',
19+
],
20+
packageRules: [
2021
{
21-
"matchCategories": [
22-
"java"
22+
matchCategories: [
23+
'java',
24+
],
25+
addLabels: [
26+
'lang: java',
2327
],
24-
"addLabels": [
25-
"lang: java"
26-
]
2728
},
28-
// TODO: check if auto-merge rules will work at all
2929
{
30-
"matchUpdateTypes": [
31-
"minor",
32-
"patch",
33-
"digest",
34-
"lockFileMaintenance"
30+
matchUpdateTypes: [
31+
'minor',
32+
'patch',
33+
'digest',
34+
'lockFileMaintenance',
3535
],
36-
"automerge": true
36+
automerge: true,
3737
},
3838
{
39-
"matchDepTypes": [
40-
"devDependencies"
39+
matchDepTypes: [
40+
'devDependencies',
4141
],
42-
"automerge": true
42+
automerge: true,
4343
},
44-
// group all Dockerfile dependencies
4544
{
46-
"matchCategories": [
47-
"docker"
48-
],
49-
"matchUpdateTypes": [
50-
"minor",
51-
"patch",
52-
"digest",
53-
"lockFileMaintenance"
54-
],
55-
"groupName": "docker",
56-
"pinDigests": true,
57-
"automerge": true
45+
matchCategories: [
46+
'docker',
47+
],
48+
matchUpdateTypes: [
49+
'minor',
50+
'patch',
51+
'digest',
52+
'lockFileMaintenance',
53+
],
54+
groupName: 'docker',
55+
pinDigests: true,
56+
automerge: true,
5857
},
59-
// group all terraform dependencies for google providers
6058
{
61-
"matchCategories": [
62-
"terraform"
59+
matchCategories: [
60+
'terraform',
61+
],
62+
matchDepTypes: [
63+
'provider',
64+
'required_provider',
6365
],
64-
"matchDepTypes": [
65-
"provider",
66-
"required_provider"
66+
groupName: 'Terraform Google providers',
67+
matchPackageNames: [
68+
'/^google/',
6769
],
68-
"matchPackagePatterns": "^google",
69-
"groupName": "Terraform Google providers",
7070
},
71-
// *** Java dependency rules:
72-
// group *ALL* Java dependencies
7371
{
74-
"matchCategories": [
75-
"java"
72+
matchCategories: [
73+
'java',
7674
],
77-
"matchUpdateTypes": [
78-
"minor",
79-
"patch",
80-
"digest",
81-
"lockFileMaintenance"
75+
matchUpdateTypes: [
76+
'minor',
77+
'patch',
78+
'digest',
79+
'lockFileMaintenance',
8280
],
83-
"groupName": "java",
84-
"automerge": true
81+
groupName: 'java',
82+
automerge: true,
8583
},
86-
// do not allow Spring Boot 3 upgrades yet
8784
{
88-
"matchCategories": [
89-
"java"
85+
matchCategories: [
86+
'java',
9087
],
91-
"matchPackagePatterns": [
92-
"org.springframework.boot"
88+
matchCurrentVersion: '>=2.0.0, <3.0.0',
89+
allowedVersions: '<3',
90+
groupName: 'Spring Boot upgrades for v2',
91+
description: '@akitsch: Spring Boot V3 requires Java 17',
92+
matchPackageNames: [
93+
'/org.springframework.boot/',
9394
],
94-
"matchCurrentVersion": ">=2.0.0, <3.0.0",
95-
"allowedVersions": "<3",
96-
"groupName": "Spring Boot upgrades for v2",
97-
"description": "@akitsch: Spring Boot V3 requires Java 17"
9895
},
99-
// limit micronaut upgrades for versions <= 4
10096
{
101-
"matchPackagePatterns": [
102-
"^io.micronaut"
97+
groupName: 'Micronaut packages',
98+
allowedVersions: '<4',
99+
matchFileNames: [
100+
'appengine-java11/**',
101+
'flexible/java-11/**',
103102
],
104-
"groupName": "Micronaut packages",
105-
"allowedVersions": "<4",
106-
"matchPaths": [
107-
"appengine-java11/**",
108-
"flexible/java-11/**"
103+
description: '@akitsch: Micronaut V4 requires Java 17',
104+
matchPackageNames: [
105+
'/^io.micronaut/',
109106
],
110-
"description": "@akitsch: Micronaut V4 requires Java 17"
111107
},
112-
// disable Scala dependency upgrades
113108
{
114-
"matchPackagePatterns": [
115-
"scala"
109+
enabled: false,
110+
matchPackageNames: [
111+
'/scala/',
116112
],
117-
"enabled": false
118113
},
119114
{
120-
"matchPackagePatterns": [
121-
"^jackson-module-scala"
115+
enabled: false,
116+
matchPackageNames: [
117+
'/^jackson-module-scala/',
122118
],
123-
"enabled": false
124119
},
125-
// disable SQL Spark dependency upgrades
126120
{
127-
"matchPackagePatterns": [
128-
"^spark-sql"
121+
enabled: false,
122+
matchPackageNames: [
123+
'/^spark-sql/',
129124
],
130-
"enabled": false
131125
},
132126
{},
133127
],
134-
"rebaseWhen": "behind-base-branch",
135-
"semanticCommits": "enabled",
136-
"vulnerabilityAlerts": {
137-
"labels": [
138-
"type:security"
128+
rebaseWhen: 'behind-base-branch',
129+
semanticCommits: 'enabled',
130+
vulnerabilityAlerts: {
131+
labels: [
132+
'type:security',
139133
],
140-
"minimumReleaseAge": null
134+
minimumReleaseAge: null,
141135
},
142-
}
136+
}

appengine-java11/appengine-simple-jetty-main/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<maven.compiler.source>11</maven.compiler.source>
2323
<maven.compiler.target>11</maven.compiler.target>
24-
<jetty.version>9.4.54.v20240208</jetty.version>
24+
<jetty.version>9.4.56.v20240826</jetty.version>
2525
</properties>
2626

2727
<!-- [START gae_java11_server_dependencies] -->
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2024 Google LLC
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+
*/
16+
17+
// [START apikeys_undelete_api_key]
18+
import com.google.api.apikeys.v2.ApiKeysClient;
19+
import com.google.api.apikeys.v2.Key;
20+
import com.google.api.apikeys.v2.UndeleteKeyRequest;
21+
import java.io.IOException;
22+
import java.util.concurrent.ExecutionException;
23+
import java.util.concurrent.TimeUnit;
24+
import java.util.concurrent.TimeoutException;
25+
26+
public class UndeleteApiKey {
27+
28+
public static void main(String[] args)
29+
throws IOException, ExecutionException, InterruptedException, TimeoutException {
30+
// TODO(developer): Replace these variables before running the sample.
31+
// Project ID or project number of the Google Cloud project.
32+
String projectId = "YOUR_PROJECT_ID";
33+
// The API key id to undelete.
34+
String keyId = "YOUR_KEY_ID";
35+
36+
undeleteApiKey(projectId, keyId);
37+
}
38+
39+
// Undeletes an API key.
40+
public static void undeleteApiKey(String projectId, String keyId)
41+
throws IOException, ExecutionException, InterruptedException, TimeoutException {
42+
// Initialize client that will be used to send requests. This client only needs to be created
43+
// once, and can be reused for multiple requests.
44+
try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
45+
46+
// Initialize the undelete request and set the argument.
47+
UndeleteKeyRequest undeleteKeyRequest = UndeleteKeyRequest.newBuilder()
48+
.setName(String.format("projects/%s/locations/global/keys/%s", projectId, keyId))
49+
.build();
50+
51+
// Make the request and wait for the operation to complete.
52+
Key undeletedKey = apiKeysClient.undeleteKeyAsync(undeleteKeyRequest)
53+
.get(3, TimeUnit.MINUTES);
54+
55+
System.out.printf("Successfully undeleted the API key: %s", undeletedKey.getName());
56+
}
57+
}
58+
}
59+
// [END apikeys_undelete_api_key]

auth/src/test/java/ApiKeySnippetsIT.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
public class ApiKeySnippetsIT {
3737

3838
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
39-
private static final String CREDENTIALS = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
4039
private static Key API_KEY;
4140
private static String API_KEY_STRING;
4241
private ByteArrayOutputStream stdOut;
@@ -79,8 +78,15 @@ public static void cleanup()
7978

8079
String apiKeyId = getApiKeyId(API_KEY);
8180
DeleteApiKey.deleteApiKey(PROJECT_ID, apiKeyId);
82-
String goal = String.format("Successfully deleted the API key: %s", API_KEY.getName());
83-
assertThat(stdOut.toString()).contains(goal);
81+
82+
UndeleteApiKey.undeleteApiKey(PROJECT_ID, apiKeyId);
83+
String undeletedKey = String.format("Successfully undeleted the API key: %s",
84+
API_KEY.getName());
85+
assertThat(stdOut.toString()).contains(undeletedKey);
86+
87+
DeleteApiKey.deleteApiKey(PROJECT_ID, apiKeyId);
88+
String deletedKey = String.format("Successfully deleted the API key: %s", API_KEY.getName());
89+
assertThat(stdOut.toString()).contains(deletedKey);
8490

8591
stdOut.close();
8692
System.setOut(out);

0 commit comments

Comments
 (0)