Skip to content

Commit 1b09421

Browse files
chore: Update generation configuration at Wed Sep 25 23:44:01 UTC 2024 (#2189)
* chore: Update generation configuration at Wed Sep 25 23:44:01 UTC 2024 * update gen script * update gen workflow * chore: generate libraries at Wed Sep 25 23:48:28 UTC 2024 --------- Co-authored-by: Joe Wang <[email protected]>
1 parent 9ea45dc commit 1b09421

File tree

145 files changed

+8750
-722
lines changed

Some content is hidden

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

145 files changed

+8750
-722
lines changed

.github/scripts/hermetic_library_generation.sh

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,24 @@ message="chore: generate libraries at $(date)"
6767

6868
git checkout "${target_branch}"
6969
git checkout "${current_branch}"
70-
# if the last commit doesn't contain changes to generation configuration,
71-
# do not generate again as the result will be the same.
72-
change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
73-
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
74-
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
75-
exit 0
76-
fi
70+
7771
# copy generation configuration from target branch to current branch.
7872
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
79-
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
8073

8174
# parse image tag from the generation configuration.
8275
image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)
8376

77+
repo_root_dir=$(pwd)
78+
mkdir -p "${repo_root_dir}/output"
79+
# download api definitions from googleapis repository
80+
googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs)
81+
api_def_dir=$(mktemp -d)
82+
git clone https://github.com/googleapis/googleapis.git "${api_def_dir}"
83+
pushd "${api_def_dir}"
84+
git checkout "${googleapis_commitish}"
85+
cp -r google/ grafeas/ "${repo_root_dir}/output"
86+
popd
87+
8488
# run hermetic code generation docker image.
8589
docker run \
8690
--rm \
@@ -90,26 +94,21 @@ docker run \
9094
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
9195
--current-generation-config-path="${workspace_name}/${generation_config}"
9296

97+
# remove api definitions after generation
98+
rm -rf "${api_def_dir}"
9399

94100
# commit the change to the pull request.
95-
if [[ $(basename $(pwd)) == "google-cloud-java" ]]; then
96-
git add java-* pom.xml gapic-libraries-bom/pom.xml versions.txt
97-
else
98-
# The image leaves intermediate folders and files it works with. Here we remove them
99-
rm -rdf output googleapis "${baseline_generation_config}"
100-
git add --all -- ':!pr_description.txt'
101-
fi
101+
rm -rdf output googleapis "${baseline_generation_config}"
102+
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
102103
changed_files=$(git diff --cached --name-only)
103-
if [[ "${changed_files}" == "" ]]; then
104-
echo "There is no generated code change with the generation config change ${config_diff}."
105-
echo "Skip committing to the pull request."
106-
exit 0
104+
if [[ "${changed_files}" != "" ]]; then
105+
echo "Commit changes..."
106+
git commit -m "${message}"
107+
git push
108+
else
109+
echo "There is no generated code change, skip commit."
107110
fi
108111

109-
echo "Configuration diff:"
110-
echo "${config_diff}"
111-
git commit -m "${message}"
112-
git push
113112
# set pr body if pr_description.txt is generated.
114113
if [[ -f "pr_description.txt" ]]; then
115114
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")

.github/workflows/hermetic_library_generation.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ on:
2020
env:
2121
HEAD_REF: ${{ github.head_ref }}
2222
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
23+
GITHUB_REPOSITORY: ${{ github.repository }}
2324

2425
jobs:
2526
library_generation:
26-
# skip pull requests coming from a forked repository
27-
if: github.env.REPO_FULL_NAME == github.repository
2827
runs-on: ubuntu-latest
2928
steps:
3029
- uses: actions/checkout@v4
@@ -35,6 +34,10 @@ jobs:
3534
shell: bash
3635
run: |
3736
set -ex
37+
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
38+
echo "This PR comes from a fork. Generation will be skipped"
39+
exit 0
40+
fi
3841
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
3942
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
4043
bash .github/scripts/hermetic_library_generation.sh \

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.44.0</version>
22+
<version>26.47.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
@@ -44,28 +44,28 @@ If you are using Maven without the BOM, add this to your dependencies:
4444
<dependency>
4545
<groupId>com.google.cloud</groupId>
4646
<artifactId>google-cloud-pubsub</artifactId>
47-
<version>1.132.0</version>
47+
<version>1.132.2</version>
4848
</dependency>
4949

5050
```
5151

5252
If you are using Gradle 5.x or later, add this to your dependencies:
5353

5454
```Groovy
55-
implementation platform('com.google.cloud:libraries-bom:26.44.0')
55+
implementation platform('com.google.cloud:libraries-bom:26.47.0')
5656
5757
implementation 'com.google.cloud:google-cloud-pubsub'
5858
```
5959
If you are using Gradle without BOM, add this to your dependencies:
6060

6161
```Groovy
62-
implementation 'com.google.cloud:google-cloud-pubsub:1.132.0'
62+
implementation 'com.google.cloud:google-cloud-pubsub:1.132.2'
6363
```
6464

6565
If you are using SBT, add this to your dependencies:
6666

6767
```Scala
68-
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.132.0"
68+
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.132.2"
6969
```
7070
<!-- {x-version-update-end} -->
7171

@@ -414,7 +414,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
414414
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html
415415
[stability-image]: https://img.shields.io/badge/stability-stable-green
416416
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg
417-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.132.0
417+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.132.2
418418
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
419419
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
420420
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

generation_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
gapic_generator_version: 2.46.0
2-
googleapis_commitish: 5c181aaf78bd1ae2e08c3a2971cd9e87b6e00986
2+
googleapis_commitish: 005df4681b89bd204a90b76168a6dc9d9e7bf4fe
33
libraries_bom_version: 26.47.0
44
libraries:
55
- api_shortname: pubsub

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
7373
* build() is called, the tree of builders is called to create the complete settings object.
7474
*
75-
* <p>For example, to set the total timeout of createSchema to 30 seconds:
75+
* <p>For example, to set the
76+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
77+
* of createSchema:
7678
*
7779
* <pre>{@code
7880
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -88,10 +90,21 @@
8890
* .createSchemaSettings()
8991
* .getRetrySettings()
9092
* .toBuilder()
91-
* .setTotalTimeout(Duration.ofSeconds(30))
93+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
94+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
95+
* .setMaxAttempts(5)
96+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
97+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
98+
* .setRetryDelayMultiplier(1.3)
99+
* .setRpcTimeoutMultiplier(1.5)
100+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
92101
* .build());
93102
* SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
94103
* }</pre>
104+
*
105+
* Please refer to the [Client Side Retry
106+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
107+
* additional support in setting retries.
95108
*/
96109
@Generated("by gapic-generator-java")
97110
public class SchemaServiceSettings extends ClientSettings<SchemaServiceSettings> {

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,8 @@ public final Subscription createSubscription(
878878
* .setDetached(true)
879879
* .setEnableExactlyOnceDelivery(true)
880880
* .setTopicMessageRetentionDuration(Duration.newBuilder().build())
881+
* .setAnalyticsHubSubscriptionInfo(
882+
* Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
881883
* .build();
882884
* Subscription response = subscriptionAdminClient.createSubscription(request);
883885
* }
@@ -1141,6 +1143,8 @@ public final Subscription createSubscription(
11411143
* .setDetached(true)
11421144
* .setEnableExactlyOnceDelivery(true)
11431145
* .setTopicMessageRetentionDuration(Duration.newBuilder().build())
1146+
* .setAnalyticsHubSubscriptionInfo(
1147+
* Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
11441148
* .build();
11451149
* ApiFuture<Subscription> future =
11461150
* subscriptionAdminClient.createSubscriptionCallable().futureCall(request);

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@
8080
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
8181
* build() is called, the tree of builders is called to create the complete settings object.
8282
*
83-
* <p>For example, to set the total timeout of createSubscription to 30 seconds:
83+
* <p>For example, to set the
84+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
85+
* of createSubscription:
8486
*
8587
* <pre>{@code
8688
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -97,10 +99,21 @@
9799
* .createSubscriptionSettings()
98100
* .getRetrySettings()
99101
* .toBuilder()
100-
* .setTotalTimeout(Duration.ofSeconds(30))
102+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
103+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
104+
* .setMaxAttempts(5)
105+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
106+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
107+
* .setRetryDelayMultiplier(1.3)
108+
* .setRpcTimeoutMultiplier(1.5)
109+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
101110
* .build());
102111
* SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
103112
* }</pre>
113+
*
114+
* Please refer to the [Client Side Retry
115+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
116+
* additional support in setting retries.
104117
*/
105118
@Generated("by gapic-generator-java")
106119
public class SubscriptionAdminSettings extends ClientSettings<SubscriptionAdminSettings> {

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
7474
* build() is called, the tree of builders is called to create the complete settings object.
7575
*
76-
* <p>For example, to set the total timeout of createTopic to 30 seconds:
76+
* <p>For example, to set the
77+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
78+
* of createTopic:
7779
*
7880
* <pre>{@code
7981
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -89,10 +91,21 @@
8991
* .createTopicSettings()
9092
* .getRetrySettings()
9193
* .toBuilder()
92-
* .setTotalTimeout(Duration.ofSeconds(30))
94+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
95+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
96+
* .setMaxAttempts(5)
97+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
98+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
99+
* .setRetryDelayMultiplier(1.3)
100+
* .setRpcTimeoutMultiplier(1.5)
101+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
93102
* .build());
94103
* TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
95104
* }</pre>
105+
*
106+
* Please refer to the [Client Side Retry
107+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
108+
* additional support in setting retries.
96109
*/
97110
@Generated("by gapic-generator-java")
98111
public class TopicAdminSettings extends ClientSettings<TopicAdminSettings> {

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
101101
* build() is called, the tree of builders is called to create the complete settings object.
102102
*
103-
* <p>For example, to set the total timeout of createTopic to 30 seconds:
103+
* <p>For example, to set the
104+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
105+
* of createTopic:
104106
*
105107
* <pre>{@code
106108
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -116,10 +118,21 @@
116118
* .createTopicSettings()
117119
* .getRetrySettings()
118120
* .toBuilder()
119-
* .setTotalTimeout(Duration.ofSeconds(30))
121+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
122+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
123+
* .setMaxAttempts(5)
124+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
125+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
126+
* .setRetryDelayMultiplier(1.3)
127+
* .setRpcTimeoutMultiplier(1.5)
128+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
120129
* .build());
121130
* PublisherStubSettings topicAdminSettings = topicAdminSettingsBuilder.build();
122131
* }</pre>
132+
*
133+
* Please refer to the [Client Side Retry
134+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
135+
* additional support in setting retries.
123136
*/
124137
@Generated("by gapic-generator-java")
125138
public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
@@ -182,9 +195,7 @@ public String extractNextToken(ListTopicsResponse payload) {
182195

183196
@Override
184197
public Iterable<Topic> extractResources(ListTopicsResponse payload) {
185-
return payload.getTopicsList() == null
186-
? ImmutableList.<Topic>of()
187-
: payload.getTopicsList();
198+
return payload.getTopicsList();
188199
}
189200
};
190201

@@ -224,9 +235,7 @@ public String extractNextToken(ListTopicSubscriptionsResponse payload) {
224235

225236
@Override
226237
public Iterable<String> extractResources(ListTopicSubscriptionsResponse payload) {
227-
return payload.getSubscriptionsList() == null
228-
? ImmutableList.<String>of()
229-
: payload.getSubscriptionsList();
238+
return payload.getSubscriptionsList();
230239
}
231240
};
232241

@@ -263,9 +272,7 @@ public String extractNextToken(ListTopicSnapshotsResponse payload) {
263272

264273
@Override
265274
public Iterable<String> extractResources(ListTopicSnapshotsResponse payload) {
266-
return payload.getSnapshotsList() == null
267-
? ImmutableList.<String>of()
268-
: payload.getSnapshotsList();
275+
return payload.getSnapshotsList();
269276
}
270277
};
271278

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
9191
* build() is called, the tree of builders is called to create the complete settings object.
9292
*
93-
* <p>For example, to set the total timeout of createSchema to 30 seconds:
93+
* <p>For example, to set the
94+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
95+
* of createSchema:
9496
*
9597
* <pre>{@code
9698
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -107,10 +109,21 @@
107109
* .createSchemaSettings()
108110
* .getRetrySettings()
109111
* .toBuilder()
110-
* .setTotalTimeout(Duration.ofSeconds(30))
112+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
113+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
114+
* .setMaxAttempts(5)
115+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
116+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
117+
* .setRetryDelayMultiplier(1.3)
118+
* .setRpcTimeoutMultiplier(1.5)
119+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
111120
* .build());
112121
* SchemaServiceStubSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
113122
* }</pre>
123+
*
124+
* Please refer to the [Client Side Retry
125+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
126+
* additional support in setting retries.
114127
*/
115128
@Generated("by gapic-generator-java")
116129
public class SchemaServiceStubSettings extends StubSettings<SchemaServiceStubSettings> {
@@ -171,9 +184,7 @@ public String extractNextToken(ListSchemasResponse payload) {
171184

172185
@Override
173186
public Iterable<Schema> extractResources(ListSchemasResponse payload) {
174-
return payload.getSchemasList() == null
175-
? ImmutableList.<Schema>of()
176-
: payload.getSchemasList();
187+
return payload.getSchemasList();
177188
}
178189
};
179190

@@ -211,9 +222,7 @@ public String extractNextToken(ListSchemaRevisionsResponse payload) {
211222

212223
@Override
213224
public Iterable<Schema> extractResources(ListSchemaRevisionsResponse payload) {
214-
return payload.getSchemasList() == null
215-
? ImmutableList.<Schema>of()
216-
: payload.getSchemasList();
225+
return payload.getSchemasList();
217226
}
218227
};
219228

0 commit comments

Comments
 (0)