From 0ebd889ca4e9385446c5590a9c1bf414f3147279 Mon Sep 17 00:00:00 2001 From: Diego Marquez Date: Thu, 2 May 2024 14:29:45 -0400 Subject: [PATCH] chore: generate autoconfigs (#2839) We needed to update the way we compute GOOGLEAPIS_COMMITISH to consider MONOREPO_TAG when cloning google-cloud-java. In this way, the generated autoconfigs use the protos matching the googleapis committish from the config yaml at the specified tag. --- .../scripts/generate-steps.sh | 3 +- spring-cloud-previews/README.md | 178 ++++----- ...iTuningServiceSpringAutoConfiguration.java | 331 +++++++++++++++++ .../GenAiTuningServiceSpringProperties.java | 189 ++++++++++ ...otebookServiceSpringAutoConfiguration.java | 345 ++++++++++++++++++ .../NotebookServiceSpringProperties.java | 189 ++++++++++ ...esourceServiceSpringAutoConfiguration.java | 306 ++++++++++++++++ ...istentResourceServiceSpringProperties.java | 163 +++++++++ ...itional-spring-configuration-metadata.json | 18 + ...ot.autoconfigure.AutoConfiguration.imports | 3 + spring-cloud-previews/pom.xml | 12 +- 11 files changed, 1641 insertions(+), 96 deletions(-) create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringProperties.java diff --git a/spring-cloud-generator/scripts/generate-steps.sh b/spring-cloud-generator/scripts/generate-steps.sh index 9a25c8d132..364cdfc005 100644 --- a/spring-cloud-generator/scripts/generate-steps.sh +++ b/spring-cloud-generator/scripts/generate-steps.sh @@ -35,8 +35,9 @@ function compute_monorepo_version() { # $1 - Monorepo version tag (or committish) function generate_libraries_list(){ monorepo_commitish=$1 - git clone --depth=1 https://github.com/googleapis/google-cloud-java.git + git clone --no-single-branch --depth=1 https://github.com/googleapis/google-cloud-java.git pushd google-cloud-java || { echo "Failure: google-cloud-java folder does not exists."; exit 1; } + git checkout "${MONOREPO_TAG}" # read googleapis committish used in hermetic build GOOGLEAPIS_COMMITTISH=$(yq -r ".googleapis_commitish" generation_config.yaml) popd || { echo "Failure in popd."; exit 1; } diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md index 65a8b0a63c..8b7d1a1f25 100644 --- a/spring-cloud-previews/README.md +++ b/spring-cloud-previews/README.md @@ -16,92 +16,92 @@ add the following dependency to your `pom.xml`: | Client Library | Starter Maven Artifact | |----------------| -----------------------| -|[java-accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| -|[java-accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| -|[java-aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| -|[java-api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-api-gateway/README.md)|com.google.cloud:google-cloud-api-gateway-spring-starter| -|[java-apigee-connect](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| -|[java-appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-appengine-admin/README.md)|com.google.cloud:google-cloud-appengine-admin-spring-starter| -|[java-artifact-registry](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-artifact-registry/README.md)|com.google.cloud:google-cloud-artifact-registry-spring-starter| -|[java-asset](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-asset/README.md)|com.google.cloud:google-cloud-asset-spring-starter| -|[java-assured-workloads](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-assured-workloads/README.md)|com.google.cloud:google-cloud-assured-workloads-spring-starter| -|[java-automl](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| -|[java-bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| -|[java-bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| -|[java-bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| -|[java-billing](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| -|[java-billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-billingbudgets/README.md)|com.google.cloud:google-cloud-billingbudgets-spring-starter| -|[java-binary-authorization](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-binary-authorization/README.md)|com.google.cloud:google-cloud-binary-authorization-spring-starter| -|[java-channel](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| -|[java-cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| -|[java-compute](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-compute/README.md)|com.google.cloud:google-cloud-compute-spring-starter| -|[java-contact-center-insights](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-contact-center-insights/README.md)|com.google.cloud:google-cloud-contact-center-insights-spring-starter| -|[java-container](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-container/README.md)|com.google.cloud:google-cloud-container-spring-starter| -|[java-containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-containeranalysis/README.md)|com.google.cloud:google-cloud-containeranalysis-spring-starter| -|[java-data-fusion](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-data-fusion/README.md)|com.google.cloud:google-cloud-data-fusion-spring-starter| -|[java-datacatalog](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| -|[java-dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dataplex/README.md)|com.google.cloud:google-cloud-dataplex-spring-starter| -|[java-dataproc-metastore](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dataproc-metastore/README.md)|com.google.cloud:google-cloud-dataproc-metastore-spring-starter| -|[java-dataproc](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| -|[java-datastream](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-datastream/README.md)|com.google.cloud:google-cloud-datastream-spring-starter| -|[java-debugger-client](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-debugger-client/README.md)|com.google.cloud:google-cloud-debugger-client-spring-starter| -|[java-deploy](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| -|[java-dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| -|[java-dlp](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| -|[java-dms](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-dms/README.md)|com.google.cloud:google-cloud-dms-spring-starter| -|[java-document-ai](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-document-ai/README.md)|com.google.cloud:google-cloud-document-ai-spring-starter| -|[java-domains](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| -|[java-essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-essential-contacts/README.md)|com.google.cloud:google-cloud-essential-contacts-spring-starter| -|[java-eventarc](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| -|[java-filestore](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| -|[java-functions](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| -|[java-gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-gkehub/README.md)|com.google.cloud:google-cloud-gkehub-spring-starter| -|[java-gsuite-addons](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-gsuite-addons/README.md)|com.google.cloud:google-cloud-gsuite-addons-spring-starter| -|[java-iam-admin](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| -|[java-iam](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| -|[java-iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| -|[java-ids](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| -|[java-iot](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| -|[java-language](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-language/README.md)|com.google.cloud:google-cloud-language-spring-starter| -|[java-managed-identities](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-managed-identities/README.md)|com.google.cloud:google-cloud-managed-identities-spring-starter| -|[java-memcache](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-memcache/README.md)|com.google.cloud:google-cloud-memcache-spring-starter| -|[java-monitoring-dashboards](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-monitoring-dashboards/README.md)|com.google.cloud:google-cloud-monitoring-dashboard-spring-starter| -|[java-network-management](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| -|[java-networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| -|[java-notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| -|[java-optimization](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-optimization/README.md)|com.google.cloud:google-cloud-optimization-spring-starter| -|[java-orchestration-airflow](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-orchestration-airflow/README.md)|com.google.cloud:google-cloud-orchestration-airflow-spring-starter| -|[java-orgpolicy](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-orgpolicy/README.md)|com.google.cloud:google-cloud-orgpolicy-spring-starter| -|[java-os-config](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-os-config/README.md)|com.google.cloud:google-cloud-os-config-spring-starter| -|[java-os-login](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-os-login/README.md)|com.google.cloud:google-cloud-os-login-spring-starter| -|[java-policy-troubleshooter](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-policy-troubleshooter/README.md)|com.google.cloud:google-cloud-policy-troubleshooter-spring-starter| -|[java-profiler](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| -|[java-recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| -|[java-recommender](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| -|[java-redis](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-redis/README.md)|com.google.cloud:google-cloud-redis-spring-starter| -|[java-resource-settings](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-resource-settings/README.md)|com.google.cloud:google-cloud-resource-settings-spring-starter| -|[java-retail](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| -|[java-scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| -|[java-security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-security-private-ca/README.md)|com.google.cloud:google-cloud-security-private-ca-spring-starter| -|[java-securitycenter](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| -|[java-service-control](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-service-control/README.md)|com.google.cloud:google-cloud-service-control-spring-starter| -|[java-service-management](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-service-management/README.md)|com.google.cloud:google-cloud-service-management-spring-starter| -|[java-service-usage](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-service-usage/README.md)|com.google.cloud:google-cloud-service-usage-spring-starter| -|[java-servicedirectory](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| -|[java-shell](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| -|[java-speech](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-speech/README.md)|com.google.cloud:google-cloud-speech-spring-starter| -|[java-storage-transfer](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-storage-transfer/README.md)|com.google.cloud:google-cloud-storage-transfer-spring-starter| -|[java-talent](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| -|[java-tasks](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| -|[java-texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| -|[java-tpu](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| -|[java-trace](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| -|[java-translate](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-translate/README.md)|com.google.cloud:google-cloud-translate-spring-starter| -|[java-video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| -|[java-video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-video-transcoder/README.md)|com.google.cloud:google-cloud-video-transcoder-spring-starter| -|[java-vmmigration](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| -|[java-vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| -|[java-webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| -|[java-websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-websecurityscanner/README.md)|com.google.cloud:google-cloud-websecurityscanner-spring-starter| -|[java-workflow-executions](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-workflow-executions/README.md)|com.google.cloud:google-cloud-workflow-executions-spring-starter| -|[java-workflows](https://github.com/googleapis/google-cloud-java/blob/v1.33.0/java-workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java-accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| +|[java-accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| +|[java-aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| +|[java-api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-api-gateway/README.md)|com.google.cloud:google-cloud-api-gateway-spring-starter| +|[java-apigee-connect](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| +|[java-appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-appengine-admin/README.md)|com.google.cloud:google-cloud-appengine-admin-spring-starter| +|[java-artifact-registry](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-artifact-registry/README.md)|com.google.cloud:google-cloud-artifact-registry-spring-starter| +|[java-asset](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-asset/README.md)|com.google.cloud:google-cloud-asset-spring-starter| +|[java-assured-workloads](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-assured-workloads/README.md)|com.google.cloud:google-cloud-assured-workloads-spring-starter| +|[java-automl](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| +|[java-bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| +|[java-bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| +|[java-bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| +|[java-billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-billingbudgets/README.md)|com.google.cloud:google-cloud-billingbudgets-spring-starter| +|[java-billing](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| +|[java-binary-authorization](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-binary-authorization/README.md)|com.google.cloud:google-cloud-binary-authorization-spring-starter| +|[java-channel](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| +|[java-cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| +|[java-compute](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-compute/README.md)|com.google.cloud:google-cloud-compute-spring-starter| +|[java-contact-center-insights](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-contact-center-insights/README.md)|com.google.cloud:google-cloud-contact-center-insights-spring-starter| +|[java-containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-containeranalysis/README.md)|com.google.cloud:google-cloud-containeranalysis-spring-starter| +|[java-container](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-container/README.md)|com.google.cloud:google-cloud-container-spring-starter| +|[java-datacatalog](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| +|[java-data-fusion](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-data-fusion/README.md)|com.google.cloud:google-cloud-data-fusion-spring-starter| +|[java-dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dataplex/README.md)|com.google.cloud:google-cloud-dataplex-spring-starter| +|[java-dataproc](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| +|[java-dataproc-metastore](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dataproc-metastore/README.md)|com.google.cloud:google-cloud-dataproc-metastore-spring-starter| +|[java-datastream](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-datastream/README.md)|com.google.cloud:google-cloud-datastream-spring-starter| +|[java-debugger-client](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-debugger-client/README.md)|com.google.cloud:google-cloud-debugger-client-spring-starter| +|[java-deploy](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| +|[java-dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| +|[java-dlp](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| +|[java-dms](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-dms/README.md)|com.google.cloud:google-cloud-dms-spring-starter| +|[java-document-ai](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-document-ai/README.md)|com.google.cloud:google-cloud-document-ai-spring-starter| +|[java-domains](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| +|[java-essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-essential-contacts/README.md)|com.google.cloud:google-cloud-essential-contacts-spring-starter| +|[java-eventarc](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| +|[java-filestore](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| +|[java-functions](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| +|[java-gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-gkehub/README.md)|com.google.cloud:google-cloud-gkehub-spring-starter| +|[java-gsuite-addons](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-gsuite-addons/README.md)|com.google.cloud:google-cloud-gsuite-addons-spring-starter| +|[java-iam-admin](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| +|[java-iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| +|[java-iam](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| +|[java-ids](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| +|[java-iot](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| +|[java-language](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-language/README.md)|com.google.cloud:google-cloud-language-spring-starter| +|[java-managed-identities](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-managed-identities/README.md)|com.google.cloud:google-cloud-managed-identities-spring-starter| +|[java-memcache](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-memcache/README.md)|com.google.cloud:google-cloud-memcache-spring-starter| +|[java-monitoring-dashboards](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-monitoring-dashboards/README.md)|com.google.cloud:google-cloud-monitoring-dashboard-spring-starter| +|[java-networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| +|[java-network-management](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| +|[java-notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| +|[java-optimization](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-optimization/README.md)|com.google.cloud:google-cloud-optimization-spring-starter| +|[java-orchestration-airflow](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-orchestration-airflow/README.md)|com.google.cloud:google-cloud-orchestration-airflow-spring-starter| +|[java-orgpolicy](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-orgpolicy/README.md)|com.google.cloud:google-cloud-orgpolicy-spring-starter| +|[java-os-config](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-os-config/README.md)|com.google.cloud:google-cloud-os-config-spring-starter| +|[java-os-login](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-os-login/README.md)|com.google.cloud:google-cloud-os-login-spring-starter| +|[java-policy-troubleshooter](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-policy-troubleshooter/README.md)|com.google.cloud:google-cloud-policy-troubleshooter-spring-starter| +|[java-profiler](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| +|[java-recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| +|[java-recommender](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| +|[java-redis](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-redis/README.md)|com.google.cloud:google-cloud-redis-spring-starter| +|[java-resource-settings](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-resource-settings/README.md)|com.google.cloud:google-cloud-resource-settings-spring-starter| +|[java-retail](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| +|[java-scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| +|[java-securitycenter](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| +|[java-security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-security-private-ca/README.md)|com.google.cloud:google-cloud-security-private-ca-spring-starter| +|[java-service-control](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-service-control/README.md)|com.google.cloud:google-cloud-service-control-spring-starter| +|[java-servicedirectory](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| +|[java-service-management](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-service-management/README.md)|com.google.cloud:google-cloud-service-management-spring-starter| +|[java-service-usage](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-service-usage/README.md)|com.google.cloud:google-cloud-service-usage-spring-starter| +|[java-shell](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| +|[java-speech](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-speech/README.md)|com.google.cloud:google-cloud-speech-spring-starter| +|[java-storage-transfer](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-storage-transfer/README.md)|com.google.cloud:google-cloud-storage-transfer-spring-starter| +|[java-talent](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| +|[java-tasks](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| +|[java-texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| +|[java-tpu](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| +|[java-trace](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| +|[java-translate](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-translate/README.md)|com.google.cloud:google-cloud-translate-spring-starter| +|[java-video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| +|[java-video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-video-transcoder/README.md)|com.google.cloud:google-cloud-video-transcoder-spring-starter| +|[java-vmmigration](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| +|[java-vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| +|[java-webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| +|[java-websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-websecurityscanner/README.md)|com.google.cloud:google-cloud-websecurityscanner-spring-starter| +|[java-workflow-executions](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-workflow-executions/README.md)|com.google.cloud:google-cloud-workflow-executions-spring-starter| +|[java-workflows](https://github.com/googleapis/google-cloud-java/blob/v1.36.0/java-workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..8dddccb3e1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java @@ -0,0 +1,331 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.aiplatform.v1.GenAiTuningServiceClient; +import com.google.cloud.aiplatform.v1.GenAiTuningServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link GenAiTuningServiceClient}. + * + *

Provides auto-configuration for Spring Boot + * + *

The default instance has everything set to sensible defaults: + * + *

+ */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@AutoConfiguration +@AutoConfigureAfter(GcpContextAutoConfiguration.class) +@ConditionalOnClass(GenAiTuningServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.gen-ai-tuning-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(GenAiTuningServiceSpringProperties.class) +public class GenAiTuningServiceSpringAutoConfiguration { + private final GenAiTuningServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(GenAiTuningServiceSpringAutoConfiguration.class); + + protected GenAiTuningServiceSpringAutoConfiguration( + GenAiTuningServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from GenAiTuningService-specific configuration"); + } + this.credentialsProvider = + ((CredentialsProvider) new DefaultCredentialsProvider(this.clientProperties)); + } else { + this.credentialsProvider = credentialsProvider; + } + } + + /** + * Provides a default transport channel provider bean, corresponding to the client library's + * default transport channel provider. If the library supports both GRPC and REST transport, and + * the useRest property is configured, the HTTP/JSON transport provider will be used instead of + * GRPC. + * + * @return a default transport channel provider. + */ + @Bean + @ConditionalOnMissingBean(name = "defaultGenAiTuningServiceTransportChannelProvider") + public TransportChannelProvider defaultGenAiTuningServiceTransportChannelProvider() { + return GenAiTuningServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a GenAiTuningServiceSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultGenAiTuningServiceTransportChannelProvider()). It also configures the quota project ID + * and executor thread count, if provided through properties. + * + *

Retry settings are also configured from service-level and method-level properties specified + * in GenAiTuningServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link GenAiTuningServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GenAiTuningServiceSettings genAiTuningServiceSettings( + @Qualifier("defaultGenAiTuningServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GenAiTuningServiceSettings.Builder clientSettingsBuilder = + GenAiTuningServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + GenAiTuningServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings createTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTuningJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createTuningJobSettings() + .setRetrySettings(createTuningJobRetrySettings); + + RetrySettings getTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTuningJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getTuningJobSettings().setRetrySettings(getTuningJobRetrySettings); + + RetrySettings listTuningJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTuningJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listTuningJobsSettings().setRetrySettings(listTuningJobsRetrySettings); + + RetrySettings cancelTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelTuningJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .cancelTuningJobSettings() + .setRetrySettings(cancelTuningJobRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createTuningJobRetry = clientProperties.getCreateTuningJobRetry(); + if (createTuningJobRetry != null) { + RetrySettings createTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTuningJobSettings().getRetrySettings(), + createTuningJobRetry); + clientSettingsBuilder + .createTuningJobSettings() + .setRetrySettings(createTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createTuningJob from properties."); + } + } + Retry getTuningJobRetry = clientProperties.getGetTuningJobRetry(); + if (getTuningJobRetry != null) { + RetrySettings getTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTuningJobSettings().getRetrySettings(), getTuningJobRetry); + clientSettingsBuilder.getTuningJobSettings().setRetrySettings(getTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getTuningJob from properties."); + } + } + Retry listTuningJobsRetry = clientProperties.getListTuningJobsRetry(); + if (listTuningJobsRetry != null) { + RetrySettings listTuningJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTuningJobsSettings().getRetrySettings(), + listTuningJobsRetry); + clientSettingsBuilder.listTuningJobsSettings().setRetrySettings(listTuningJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listTuningJobs from properties."); + } + } + Retry cancelTuningJobRetry = clientProperties.getCancelTuningJobRetry(); + if (cancelTuningJobRetry != null) { + RetrySettings cancelTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelTuningJobSettings().getRetrySettings(), + cancelTuningJobRetry); + clientSettingsBuilder + .cancelTuningJobSettings() + .setRetrySettings(cancelTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for cancelTuningJob from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); + if (setIamPolicyRetry != null) { + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties."); + } + } + Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry(); + if (getIamPolicyRetry != null) { + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); + } + } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GenAiTuningServiceClient bean configured with GenAiTuningServiceSettings. + * + * @param genAiTuningServiceSettings settings to configure an instance of client bean. + * @return a {@link GenAiTuningServiceClient} bean configured with {@link + * GenAiTuningServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GenAiTuningServiceClient genAiTuningServiceClient( + GenAiTuningServiceSettings genAiTuningServiceSettings) throws IOException { + return GenAiTuningServiceClient.create(genAiTuningServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-gen-ai-tuning-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringProperties.java new file mode 100644 index 0000000000..7956803492 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringProperties.java @@ -0,0 +1,189 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for GenAiTuningService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.gen-ai-tuning-service") +public class GenAiTuningServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createTuningJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTuningJobRetry; + /** + * Allow override of retry settings at method-level for getTuningJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTuningJobRetry; + /** + * Allow override of retry settings at method-level for listTuningJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTuningJobsRetry; + /** + * Allow override of retry settings at method-level for cancelTuningJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelTuningJobRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCreateTuningJobRetry() { + return this.createTuningJobRetry; + } + + public void setCreateTuningJobRetry(Retry createTuningJobRetry) { + this.createTuningJobRetry = createTuningJobRetry; + } + + public Retry getGetTuningJobRetry() { + return this.getTuningJobRetry; + } + + public void setGetTuningJobRetry(Retry getTuningJobRetry) { + this.getTuningJobRetry = getTuningJobRetry; + } + + public Retry getListTuningJobsRetry() { + return this.listTuningJobsRetry; + } + + public void setListTuningJobsRetry(Retry listTuningJobsRetry) { + this.listTuningJobsRetry = listTuningJobsRetry; + } + + public Retry getCancelTuningJobRetry() { + return this.cancelTuningJobRetry; + } + + public void setCancelTuningJobRetry(Retry cancelTuningJobRetry) { + this.cancelTuningJobRetry = cancelTuningJobRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..11b6f673da --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java @@ -0,0 +1,345 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.aiplatform.v1.NotebookServiceClient; +import com.google.cloud.aiplatform.v1.NotebookServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link NotebookServiceClient}. + * + *

Provides auto-configuration for Spring Boot + * + *

The default instance has everything set to sensible defaults: + * + *

+ */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@AutoConfiguration +@AutoConfigureAfter(GcpContextAutoConfiguration.class) +@ConditionalOnClass(NotebookServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.notebook-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(NotebookServiceSpringProperties.class) +public class NotebookServiceSpringAutoConfiguration { + private final NotebookServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(NotebookServiceSpringAutoConfiguration.class); + + protected NotebookServiceSpringAutoConfiguration( + NotebookServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from NotebookService-specific configuration"); + } + this.credentialsProvider = + ((CredentialsProvider) new DefaultCredentialsProvider(this.clientProperties)); + } else { + this.credentialsProvider = credentialsProvider; + } + } + + /** + * Provides a default transport channel provider bean, corresponding to the client library's + * default transport channel provider. If the library supports both GRPC and REST transport, and + * the useRest property is configured, the HTTP/JSON transport provider will be used instead of + * GRPC. + * + * @return a default transport channel provider. + */ + @Bean + @ConditionalOnMissingBean(name = "defaultNotebookServiceTransportChannelProvider") + public TransportChannelProvider defaultNotebookServiceTransportChannelProvider() { + return NotebookServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a NotebookServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultNotebookServiceTransportChannelProvider()). It also configures the quota project ID and + * executor thread count, if provided through properties. + * + *

Retry settings are also configured from service-level and method-level properties specified + * in NotebookServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link NotebookServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public NotebookServiceSettings notebookServiceSettings( + @Qualifier("defaultNotebookServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + NotebookServiceSettings.Builder clientSettingsBuilder = NotebookServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + NotebookServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings getNotebookRuntimeTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotebookRuntimeTemplateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getNotebookRuntimeTemplateSettings() + .setRetrySettings(getNotebookRuntimeTemplateRetrySettings); + + RetrySettings listNotebookRuntimeTemplatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotebookRuntimeTemplatesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listNotebookRuntimeTemplatesSettings() + .setRetrySettings(listNotebookRuntimeTemplatesRetrySettings); + + RetrySettings getNotebookRuntimeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotebookRuntimeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getNotebookRuntimeSettings() + .setRetrySettings(getNotebookRuntimeRetrySettings); + + RetrySettings listNotebookRuntimesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotebookRuntimesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listNotebookRuntimesSettings() + .setRetrySettings(listNotebookRuntimesRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getNotebookRuntimeTemplateRetry = clientProperties.getGetNotebookRuntimeTemplateRetry(); + if (getNotebookRuntimeTemplateRetry != null) { + RetrySettings getNotebookRuntimeTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotebookRuntimeTemplateSettings().getRetrySettings(), + getNotebookRuntimeTemplateRetry); + clientSettingsBuilder + .getNotebookRuntimeTemplateSettings() + .setRetrySettings(getNotebookRuntimeTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getNotebookRuntimeTemplate from properties."); + } + } + Retry listNotebookRuntimeTemplatesRetry = + clientProperties.getListNotebookRuntimeTemplatesRetry(); + if (listNotebookRuntimeTemplatesRetry != null) { + RetrySettings listNotebookRuntimeTemplatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotebookRuntimeTemplatesSettings().getRetrySettings(), + listNotebookRuntimeTemplatesRetry); + clientSettingsBuilder + .listNotebookRuntimeTemplatesSettings() + .setRetrySettings(listNotebookRuntimeTemplatesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listNotebookRuntimeTemplates from properties."); + } + } + Retry getNotebookRuntimeRetry = clientProperties.getGetNotebookRuntimeRetry(); + if (getNotebookRuntimeRetry != null) { + RetrySettings getNotebookRuntimeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotebookRuntimeSettings().getRetrySettings(), + getNotebookRuntimeRetry); + clientSettingsBuilder + .getNotebookRuntimeSettings() + .setRetrySettings(getNotebookRuntimeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getNotebookRuntime from properties."); + } + } + Retry listNotebookRuntimesRetry = clientProperties.getListNotebookRuntimesRetry(); + if (listNotebookRuntimesRetry != null) { + RetrySettings listNotebookRuntimesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotebookRuntimesSettings().getRetrySettings(), + listNotebookRuntimesRetry); + clientSettingsBuilder + .listNotebookRuntimesSettings() + .setRetrySettings(listNotebookRuntimesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listNotebookRuntimes from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); + if (setIamPolicyRetry != null) { + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties."); + } + } + Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry(); + if (getIamPolicyRetry != null) { + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); + } + } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a NotebookServiceClient bean configured with NotebookServiceSettings. + * + * @param notebookServiceSettings settings to configure an instance of client bean. + * @return a {@link NotebookServiceClient} bean configured with {@link NotebookServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public NotebookServiceClient notebookServiceClient( + NotebookServiceSettings notebookServiceSettings) throws IOException { + return NotebookServiceClient.create(notebookServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-notebook-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java new file mode 100644 index 0000000000..d0006f0223 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java @@ -0,0 +1,189 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for NotebookService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.notebook-service") +public class NotebookServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getNotebookRuntimeTemplate. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNotebookRuntimeTemplateRetry; + /** + * Allow override of retry settings at method-level for listNotebookRuntimeTemplates. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNotebookRuntimeTemplatesRetry; + /** + * Allow override of retry settings at method-level for getNotebookRuntime. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNotebookRuntimeRetry; + /** + * Allow override of retry settings at method-level for listNotebookRuntimes. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNotebookRuntimesRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetNotebookRuntimeTemplateRetry() { + return this.getNotebookRuntimeTemplateRetry; + } + + public void setGetNotebookRuntimeTemplateRetry(Retry getNotebookRuntimeTemplateRetry) { + this.getNotebookRuntimeTemplateRetry = getNotebookRuntimeTemplateRetry; + } + + public Retry getListNotebookRuntimeTemplatesRetry() { + return this.listNotebookRuntimeTemplatesRetry; + } + + public void setListNotebookRuntimeTemplatesRetry(Retry listNotebookRuntimeTemplatesRetry) { + this.listNotebookRuntimeTemplatesRetry = listNotebookRuntimeTemplatesRetry; + } + + public Retry getGetNotebookRuntimeRetry() { + return this.getNotebookRuntimeRetry; + } + + public void setGetNotebookRuntimeRetry(Retry getNotebookRuntimeRetry) { + this.getNotebookRuntimeRetry = getNotebookRuntimeRetry; + } + + public Retry getListNotebookRuntimesRetry() { + return this.listNotebookRuntimesRetry; + } + + public void setListNotebookRuntimesRetry(Retry listNotebookRuntimesRetry) { + this.listNotebookRuntimesRetry = listNotebookRuntimesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4107b2627d --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java @@ -0,0 +1,306 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.aiplatform.v1.PersistentResourceServiceClient; +import com.google.cloud.aiplatform.v1.PersistentResourceServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link PersistentResourceServiceClient}. + * + *

Provides auto-configuration for Spring Boot + * + *

The default instance has everything set to sensible defaults: + * + *

+ */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@AutoConfiguration +@AutoConfigureAfter(GcpContextAutoConfiguration.class) +@ConditionalOnClass(PersistentResourceServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.persistent-resource-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(PersistentResourceServiceSpringProperties.class) +public class PersistentResourceServiceSpringAutoConfiguration { + private final PersistentResourceServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(PersistentResourceServiceSpringAutoConfiguration.class); + + protected PersistentResourceServiceSpringAutoConfiguration( + PersistentResourceServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from PersistentResourceService-specific configuration"); + } + this.credentialsProvider = + ((CredentialsProvider) new DefaultCredentialsProvider(this.clientProperties)); + } else { + this.credentialsProvider = credentialsProvider; + } + } + + /** + * Provides a default transport channel provider bean, corresponding to the client library's + * default transport channel provider. If the library supports both GRPC and REST transport, and + * the useRest property is configured, the HTTP/JSON transport provider will be used instead of + * GRPC. + * + * @return a default transport channel provider. + */ + @Bean + @ConditionalOnMissingBean(name = "defaultPersistentResourceServiceTransportChannelProvider") + public TransportChannelProvider defaultPersistentResourceServiceTransportChannelProvider() { + return PersistentResourceServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a PersistentResourceServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultPersistentResourceServiceTransportChannelProvider()). It also configures the quota + * project ID and executor thread count, if provided through properties. + * + *

Retry settings are also configured from service-level and method-level properties specified + * in PersistentResourceServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link PersistentResourceServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public PersistentResourceServiceSettings persistentResourceServiceSettings( + @Qualifier("defaultPersistentResourceServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PersistentResourceServiceSettings.Builder clientSettingsBuilder = + PersistentResourceServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + PersistentResourceServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings getPersistentResourceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPersistentResourceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getPersistentResourceSettings() + .setRetrySettings(getPersistentResourceRetrySettings); + + RetrySettings listPersistentResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPersistentResourcesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPersistentResourcesSettings() + .setRetrySettings(listPersistentResourcesRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getPersistentResourceRetry = clientProperties.getGetPersistentResourceRetry(); + if (getPersistentResourceRetry != null) { + RetrySettings getPersistentResourceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPersistentResourceSettings().getRetrySettings(), + getPersistentResourceRetry); + clientSettingsBuilder + .getPersistentResourceSettings() + .setRetrySettings(getPersistentResourceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPersistentResource from properties."); + } + } + Retry listPersistentResourcesRetry = clientProperties.getListPersistentResourcesRetry(); + if (listPersistentResourcesRetry != null) { + RetrySettings listPersistentResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPersistentResourcesSettings().getRetrySettings(), + listPersistentResourcesRetry); + clientSettingsBuilder + .listPersistentResourcesSettings() + .setRetrySettings(listPersistentResourcesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPersistentResources from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); + if (setIamPolicyRetry != null) { + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties."); + } + } + Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry(); + if (getIamPolicyRetry != null) { + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); + } + } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a PersistentResourceServiceClient bean configured with + * PersistentResourceServiceSettings. + * + * @param persistentResourceServiceSettings settings to configure an instance of client bean. + * @return a {@link PersistentResourceServiceClient} bean configured with {@link + * PersistentResourceServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public PersistentResourceServiceClient persistentResourceServiceClient( + PersistentResourceServiceSettings persistentResourceServiceSettings) throws IOException { + return PersistentResourceServiceClient.create(persistentResourceServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-persistent-resource-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringProperties.java new file mode 100644 index 0000000000..8f9339957b --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringProperties.java @@ -0,0 +1,163 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for PersistentResourceService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.persistent-resource-service") +public class PersistentResourceServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getPersistentResource. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPersistentResourceRetry; + /** + * Allow override of retry settings at method-level for listPersistentResources. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPersistentResourcesRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetPersistentResourceRetry() { + return this.getPersistentResourceRetry; + } + + public void setGetPersistentResourceRetry(Retry getPersistentResourceRetry) { + this.getPersistentResourceRetry = getPersistentResourceRetry; + } + + public Retry getListPersistentResourcesRetry() { + return this.listPersistentResourcesRetry; + } + + public void setListPersistentResourcesRetry(Retry listPersistentResourcesRetry) { + this.listPersistentResourcesRetry = listPersistentResourcesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index e74d2d4e88..94a054b2ab 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -48,6 +48,12 @@ "description": "Auto-configure Google Cloud aiplatform/FeaturestoreService components.", "defaultValue": true }, + { + "name": "com.google.cloud.aiplatform.v1.gen-ai-tuning-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/GenAiTuningService components.", + "defaultValue": true + }, { "name": "com.google.cloud.aiplatform.v1.index-endpoint-service.enabled", "type": "java.lang.Boolean", @@ -102,6 +108,18 @@ "description": "Auto-configure Google Cloud aiplatform/ModelService components.", "defaultValue": true }, + { + "name": "com.google.cloud.aiplatform.v1.notebook-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/NotebookService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.aiplatform.v1.persistent-resource-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/PersistentResourceService components.", + "defaultValue": true + }, { "name": "com.google.cloud.aiplatform.v1.pipeline-service.enabled", "type": "java.lang.Boolean", diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 461de70264..0e0b4ab34e 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -6,6 +6,7 @@ com.google.cloud.aiplatform.v1.spring.FeatureOnlineStoreServiceSpringAutoConfigu com.google.cloud.aiplatform.v1.spring.FeatureRegistryServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.FeaturestoreOnlineServingServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.FeaturestoreServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.GenAiTuningServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.IndexEndpointServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.IndexServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.JobServiceSpringAutoConfiguration @@ -15,6 +16,8 @@ com.google.cloud.aiplatform.v1.spring.MetadataServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.MigrationServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.ModelGardenServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.ModelServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.NotebookServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.PersistentResourceServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.PipelineServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.PredictionServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.ScheduleServiceSpringAutoConfiguration diff --git a/spring-cloud-previews/pom.xml b/spring-cloud-previews/pom.xml index 7cb1d2d872..cd2deed579 100644 --- a/spring-cloud-previews/pom.xml +++ b/spring-cloud-previews/pom.xml @@ -30,12 +30,12 @@ google-cloud-storage-transfer-spring-starter google-cloud-speech-spring-starter google-cloud-shell-spring-starter - google-cloud-servicedirectory-spring-starter google-cloud-service-usage-spring-starter google-cloud-service-management-spring-starter + google-cloud-servicedirectory-spring-starter google-cloud-service-control-spring-starter - google-cloud-securitycenter-spring-starter google-cloud-security-private-ca-spring-starter + google-cloud-securitycenter-spring-starter google-cloud-scheduler-spring-starter google-cloud-retail-spring-starter google-cloud-resource-settings-spring-starter @@ -50,8 +50,8 @@ google-cloud-orchestration-airflow-spring-starter google-cloud-optimization-spring-starter google-cloud-notebooks-spring-starter - google-cloud-networkconnectivity-spring-starter google-cloud-network-management-spring-starter + google-cloud-networkconnectivity-spring-starter google-cloud-monitoring-dashboard-spring-starter google-cloud-memcache-spring-starter google-cloud-managed-identities-spring-starter @@ -59,8 +59,8 @@ google-cloud-iot-spring-starter google-cloud-ids-spring-starter google-cloud-iamcredentials-spring-starter - google-iam-policy-spring-starter google-iam-admin-spring-starter + google-iam-policy-spring-starter google-cloud-gsuite-addons-spring-starter google-cloud-gkehub-spring-starter google-cloud-functions-spring-starter @@ -75,11 +75,11 @@ google-cloud-deploy-spring-starter google-cloud-debugger-client-spring-starter google-cloud-datastream-spring-starter - google-cloud-dataproc-spring-starter google-cloud-dataproc-metastore-spring-starter + google-cloud-dataproc-spring-starter google-cloud-dataplex-spring-starter - google-cloud-datacatalog-spring-starter google-cloud-data-fusion-spring-starter + google-cloud-datacatalog-spring-starter google-cloud-containeranalysis-spring-starter google-cloud-container-spring-starter google-cloud-contact-center-insights-spring-starter