Skip to content

Commit

Permalink
fix: use bazelisk info to obtain googleapis bazel-bin when generating… (
Browse files Browse the repository at this point in the history
#2635)

* fix: use bazelisk info to obtain googleapis bazel-bin when generating autoconfigs

* chore: update starter modules in spring-cloud-previews

---------

Co-authored-by: Cloud Java Bot <[email protected]>
  • Loading branch information
diegomarquezp and cloud-java-bot authored Feb 23, 2024
1 parent fa5ab16 commit 3e39459
Show file tree
Hide file tree
Showing 8 changed files with 542 additions and 89 deletions.
7 changes: 5 additions & 2 deletions spring-cloud-generator/scripts/generate-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ function postprocess_library() {
rule_prefix=$(cat googleapis/$googleapis_folder/BUILD.bazel | grep _java_gapic_spring | perl -lane 'print m/"(.*)_java_gapic_spring/')

# copy generated code and unzip
cp googleapis/bazel-bin/$googleapis_folder/"$rule_prefix"_java_gapic_spring-spring.srcjar ../spring-cloud-previews
pushd googleapis
bazel_bin_location=$(bazelisk info bazel-bin)
popd
cp ${bazel_bin_location}/${googleapis_folder}/"${rule_prefix}"_java_gapic_spring-spring.srcjar ../spring-cloud-previews
cd ../spring-cloud-previews
unzip -o "$rule_prefix"_java_gapic_spring-spring.srcjar -d "$starter_artifactid"/
rm -rf "$rule_prefix"_java_gapic_spring-spring.srcjar
Expand Down Expand Up @@ -256,4 +259,4 @@ function run_formatter(){
from_directory=$1
cd $from_directory
mvn com.coveo:fmt-maven-plugin:format -Dfmt.skip=false
}
}
174 changes: 87 additions & 87 deletions spring-cloud-previews/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ public DataTransferServiceSettings dataTransferServiceSettings(
.enrollDataSourcesSettings()
.setRetrySettings(enrollDataSourcesRetrySettings);

RetrySettings unenrollDataSourcesRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.unenrollDataSourcesSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder
.unenrollDataSourcesSettings()
.setRetrySettings(unenrollDataSourcesRetrySettings);

RetrySettings listLocationsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
Expand Down Expand Up @@ -481,6 +488,20 @@ public DataTransferServiceSettings dataTransferServiceSettings(
"Configured method-level retry settings for enrollDataSources from properties.");
}
}
Retry unenrollDataSourcesRetry = clientProperties.getUnenrollDataSourcesRetry();
if (unenrollDataSourcesRetry != null) {
RetrySettings unenrollDataSourcesRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.unenrollDataSourcesSettings().getRetrySettings(),
unenrollDataSourcesRetry);
clientSettingsBuilder
.unenrollDataSourcesSettings()
.setRetrySettings(unenrollDataSourcesRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for unenrollDataSources from properties.");
}
}
Retry listLocationsRetry = clientProperties.getListLocationsRetry();
if (listLocationsRetry != null) {
RetrySettings listLocationsRetrySettings =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public class DataTransferServiceSpringProperties implements CredentialsSupplier
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry enrollDataSourcesRetry;
/**
* Allow override of retry settings at method-level for unenrollDataSources. If defined, this
* takes precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry unenrollDataSourcesRetry;
/**
* Allow override of retry settings at method-level for listLocations. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
Expand Down Expand Up @@ -285,6 +290,14 @@ public void setEnrollDataSourcesRetry(Retry enrollDataSourcesRetry) {
this.enrollDataSourcesRetry = enrollDataSourcesRetry;
}

public Retry getUnenrollDataSourcesRetry() {
return this.unenrollDataSourcesRetry;
}

public void setUnenrollDataSourcesRetry(Retry unenrollDataSourcesRetry) {
this.unenrollDataSourcesRetry = unenrollDataSourcesRetry;
}

public Retry getListLocationsRetry() {
return this.listLocationsRetry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,91 @@ public EnvironmentsSettings environmentsSettings(
.pollAirflowCommandSettings()
.setRetrySettings(pollAirflowCommandRetrySettings);

RetrySettings listWorkloadsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings);

RetrySettings createUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.createUserWorkloadsSecretSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.createUserWorkloadsSecretSettings()
.setRetrySettings(createUserWorkloadsSecretRetrySettings);

RetrySettings getUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getUserWorkloadsSecretSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.getUserWorkloadsSecretSettings()
.setRetrySettings(getUserWorkloadsSecretRetrySettings);

RetrySettings listUserWorkloadsSecretsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listUserWorkloadsSecretsSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.listUserWorkloadsSecretsSettings()
.setRetrySettings(listUserWorkloadsSecretsRetrySettings);

RetrySettings updateUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.updateUserWorkloadsSecretSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.updateUserWorkloadsSecretSettings()
.setRetrySettings(updateUserWorkloadsSecretRetrySettings);

RetrySettings deleteUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.deleteUserWorkloadsSecretSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.deleteUserWorkloadsSecretSettings()
.setRetrySettings(deleteUserWorkloadsSecretRetrySettings);

RetrySettings createUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.createUserWorkloadsConfigMapSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.createUserWorkloadsConfigMapSettings()
.setRetrySettings(createUserWorkloadsConfigMapRetrySettings);

RetrySettings getUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getUserWorkloadsConfigMapSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.getUserWorkloadsConfigMapSettings()
.setRetrySettings(getUserWorkloadsConfigMapRetrySettings);

RetrySettings listUserWorkloadsConfigMapsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listUserWorkloadsConfigMapsSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.listUserWorkloadsConfigMapsSettings()
.setRetrySettings(listUserWorkloadsConfigMapsRetrySettings);

RetrySettings updateUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.updateUserWorkloadsConfigMapSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.updateUserWorkloadsConfigMapSettings()
.setRetrySettings(updateUserWorkloadsConfigMapRetrySettings);

RetrySettings deleteUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.deleteUserWorkloadsConfigMapSettings().getRetrySettings(),
serviceRetry);
clientSettingsBuilder
.deleteUserWorkloadsConfigMapSettings()
.setRetrySettings(deleteUserWorkloadsConfigMapRetrySettings);

RetrySettings fetchDatabasePropertiesRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.fetchDatabasePropertiesSettings().getRetrySettings(),
Expand Down Expand Up @@ -272,6 +357,159 @@ public EnvironmentsSettings environmentsSettings(
"Configured method-level retry settings for pollAirflowCommand from properties.");
}
}
Retry listWorkloadsRetry = clientProperties.getListWorkloadsRetry();
if (listWorkloadsRetry != null) {
RetrySettings listWorkloadsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), listWorkloadsRetry);
clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Configured method-level retry settings for listWorkloads from properties.");
}
}
Retry createUserWorkloadsSecretRetry = clientProperties.getCreateUserWorkloadsSecretRetry();
if (createUserWorkloadsSecretRetry != null) {
RetrySettings createUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.createUserWorkloadsSecretSettings().getRetrySettings(),
createUserWorkloadsSecretRetry);
clientSettingsBuilder
.createUserWorkloadsSecretSettings()
.setRetrySettings(createUserWorkloadsSecretRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for createUserWorkloadsSecret from properties.");
}
}
Retry getUserWorkloadsSecretRetry = clientProperties.getGetUserWorkloadsSecretRetry();
if (getUserWorkloadsSecretRetry != null) {
RetrySettings getUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getUserWorkloadsSecretSettings().getRetrySettings(),
getUserWorkloadsSecretRetry);
clientSettingsBuilder
.getUserWorkloadsSecretSettings()
.setRetrySettings(getUserWorkloadsSecretRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for getUserWorkloadsSecret from properties.");
}
}
Retry listUserWorkloadsSecretsRetry = clientProperties.getListUserWorkloadsSecretsRetry();
if (listUserWorkloadsSecretsRetry != null) {
RetrySettings listUserWorkloadsSecretsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listUserWorkloadsSecretsSettings().getRetrySettings(),
listUserWorkloadsSecretsRetry);
clientSettingsBuilder
.listUserWorkloadsSecretsSettings()
.setRetrySettings(listUserWorkloadsSecretsRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for listUserWorkloadsSecrets from properties.");
}
}
Retry updateUserWorkloadsSecretRetry = clientProperties.getUpdateUserWorkloadsSecretRetry();
if (updateUserWorkloadsSecretRetry != null) {
RetrySettings updateUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.updateUserWorkloadsSecretSettings().getRetrySettings(),
updateUserWorkloadsSecretRetry);
clientSettingsBuilder
.updateUserWorkloadsSecretSettings()
.setRetrySettings(updateUserWorkloadsSecretRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for updateUserWorkloadsSecret from properties.");
}
}
Retry deleteUserWorkloadsSecretRetry = clientProperties.getDeleteUserWorkloadsSecretRetry();
if (deleteUserWorkloadsSecretRetry != null) {
RetrySettings deleteUserWorkloadsSecretRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.deleteUserWorkloadsSecretSettings().getRetrySettings(),
deleteUserWorkloadsSecretRetry);
clientSettingsBuilder
.deleteUserWorkloadsSecretSettings()
.setRetrySettings(deleteUserWorkloadsSecretRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for deleteUserWorkloadsSecret from properties.");
}
}
Retry createUserWorkloadsConfigMapRetry =
clientProperties.getCreateUserWorkloadsConfigMapRetry();
if (createUserWorkloadsConfigMapRetry != null) {
RetrySettings createUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.createUserWorkloadsConfigMapSettings().getRetrySettings(),
createUserWorkloadsConfigMapRetry);
clientSettingsBuilder
.createUserWorkloadsConfigMapSettings()
.setRetrySettings(createUserWorkloadsConfigMapRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for createUserWorkloadsConfigMap from properties.");
}
}
Retry getUserWorkloadsConfigMapRetry = clientProperties.getGetUserWorkloadsConfigMapRetry();
if (getUserWorkloadsConfigMapRetry != null) {
RetrySettings getUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getUserWorkloadsConfigMapSettings().getRetrySettings(),
getUserWorkloadsConfigMapRetry);
clientSettingsBuilder
.getUserWorkloadsConfigMapSettings()
.setRetrySettings(getUserWorkloadsConfigMapRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for getUserWorkloadsConfigMap from properties.");
}
}
Retry listUserWorkloadsConfigMapsRetry = clientProperties.getListUserWorkloadsConfigMapsRetry();
if (listUserWorkloadsConfigMapsRetry != null) {
RetrySettings listUserWorkloadsConfigMapsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listUserWorkloadsConfigMapsSettings().getRetrySettings(),
listUserWorkloadsConfigMapsRetry);
clientSettingsBuilder
.listUserWorkloadsConfigMapsSettings()
.setRetrySettings(listUserWorkloadsConfigMapsRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for listUserWorkloadsConfigMaps from properties.");
}
}
Retry updateUserWorkloadsConfigMapRetry =
clientProperties.getUpdateUserWorkloadsConfigMapRetry();
if (updateUserWorkloadsConfigMapRetry != null) {
RetrySettings updateUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.updateUserWorkloadsConfigMapSettings().getRetrySettings(),
updateUserWorkloadsConfigMapRetry);
clientSettingsBuilder
.updateUserWorkloadsConfigMapSettings()
.setRetrySettings(updateUserWorkloadsConfigMapRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for updateUserWorkloadsConfigMap from properties.");
}
}
Retry deleteUserWorkloadsConfigMapRetry =
clientProperties.getDeleteUserWorkloadsConfigMapRetry();
if (deleteUserWorkloadsConfigMapRetry != null) {
RetrySettings deleteUserWorkloadsConfigMapRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.deleteUserWorkloadsConfigMapSettings().getRetrySettings(),
deleteUserWorkloadsConfigMapRetry);
clientSettingsBuilder
.deleteUserWorkloadsConfigMapSettings()
.setRetrySettings(deleteUserWorkloadsConfigMapRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for deleteUserWorkloadsConfigMap from properties.");
}
}
Retry fetchDatabasePropertiesRetry = clientProperties.getFetchDatabasePropertiesRetry();
if (fetchDatabasePropertiesRetry != null) {
RetrySettings fetchDatabasePropertiesRetrySettings =
Expand Down
Loading

0 comments on commit 3e39459

Please sign in to comment.