From a311e782782fa20c9e4d211890ce21a1ccd7771d Mon Sep 17 00:00:00 2001 From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:04:51 +0000 Subject: [PATCH] chore: update starter modules in spring-cloud-previews (#3435) Co-authored-by: Cloud Java Bot --- spring-cloud-previews/README.md | 219 ++++++------ ...RagDataServiceSpringAutoConfiguration.java | 338 ++++++++++++++++++ .../VertexRagDataServiceSpringProperties.java | 202 +++++++++++ ...rtexRagServiceSpringAutoConfiguration.java | 316 ++++++++++++++++ .../VertexRagServiceSpringProperties.java | 176 +++++++++ ...itional-spring-configuration-metadata.json | 12 + ...ot.autoconfigure.AutoConfiguration.imports | 2 + ...rvationServiceSpringAutoConfiguration.java | 21 ++ .../ReservationServiceSpringProperties.java | 13 + ...etworkProfilesSpringAutoConfiguration.java | 207 +++++++++++ .../NetworkProfilesSpringProperties.java | 101 ++++++ ...itional-spring-configuration-metadata.json | 6 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../DataCatalogSpringAutoConfiguration.java | 53 +++ .../spring/DataCatalogSpringProperties.java | 39 ++ .../HubServiceSpringAutoConfiguration.java | 16 + .../v1/spring/HubServiceSpringProperties.java | 13 + .../pom.xml | 35 ++ .../MemorystoreSpringAutoConfiguration.java | 258 +++++++++++++ .../spring/MemorystoreSpringProperties.java | 137 +++++++ .../memorystore/v1/spring/package-info.java | 23 ++ ...itional-spring-configuration-metadata.json | 10 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + spring-cloud-previews/pom.xml | 1 + 24 files changed, 2091 insertions(+), 109 deletions(-) create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/pom.xml create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/package-info.java create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json create mode 100644 spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md index 300c54d82f..b8cd4d650c 100644 --- a/spring-cloud-previews/README.md +++ b/spring-cloud-previews/README.md @@ -16,112 +16,113 @@ add the following dependency to your `pom.xml`: | Client Library | Starter Maven Artifact | |----------------| -----------------------| -|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| -|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| -|[java/advisorynotifications](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/advisorynotifications/README.md)|com.google.cloud:google-cloud-advisorynotifications-spring-starter| -|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| -|[java/analyticshub](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/analyticshub/README.md)|com.google.cloud:google-cloud-analyticshub-spring-starter| -|[java/api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.0/java/apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| -|[java/apikeys](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/apikeys/README.md)|com.google.cloud:google-cloud-apikeys-spring-starter| -|[java/appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.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.48.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.48.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| -|[java/backupdr](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/backupdr/README.md)|com.google.cloud:google-cloud-backupdr-spring-starter| -|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| -|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| -|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| -|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| -|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| -|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| -|[java/cloudcontrolspartner](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/cloudcontrolspartner/README.md)|com.google.cloud:google-cloud-cloudcontrolspartner-spring-starter| -|[java/cloudquotas](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/cloudquotas/README.md)|com.google.cloud:google-cloud-cloudquotas-spring-starter| -|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| -|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| -|[java/datalineage](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/datalineage/README.md)|com.google.cloud:google-cloud-datalineage-spring-starter| -|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| -|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| -|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| -|[java/discoveryengine](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/discoveryengine/README.md)|com.google.cloud:google-cloud-discoveryengine-spring-starter| -|[java/distributedcloudedge](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/distributedcloudedge/README.md)|com.google.cloud:google-cloud-distributedcloudedge-spring-starter| -|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| -|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| -|[java/edgenetwork](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/edgenetwork/README.md)|com.google.cloud:google-cloud-edgenetwork-spring-starter| -|[java/essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| -|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| -|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| -|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.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.48.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| -|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| -|[java/iap](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/iap/README.md)|com.google.cloud:google-cloud-iap-spring-starter| -|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| -|[java/infra-manager](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/infra-manager/README.md)|com.google.cloud:google-cloud-infra-manager-spring-starter| -|[java/iot](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| -|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.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.48.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.48.0/java/network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| -|[java/network-security](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/network-security/README.md)|com.google.cloud:google-cloud-network-security-spring-starter| -|[java/networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| -|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| -|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.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.48.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.48.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.48.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.48.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| -|[java/publicca](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/publicca/README.md)|com.google.cloud:google-cloud-publicca-spring-starter| -|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| -|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| -|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| -|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| -|[java/securesourcemanager](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/securesourcemanager/README.md)|com.google.cloud:google-cloud-securesourcemanager-spring-starter| -|[java/security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| -|[java/securitycentermanagement](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/securitycentermanagement/README.md)|com.google.cloud:google-cloud-securitycentermanagement-spring-starter| -|[java/securityposture](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/securityposture/README.md)|com.google.cloud:google-cloud-securityposture-spring-starter| -|[java/service-control](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.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.48.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| -|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| -|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| -|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| -|[java/telcoautomation](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/telcoautomation/README.md)|com.google.cloud:google-cloud-telcoautomation-spring-starter| -|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| -|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| -|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| -|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.0/java/video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| -|[java/video-stitcher](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/video-stitcher/README.md)|com.google.cloud:google-cloud-video-stitcher-spring-starter| -|[java/video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| -|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| -|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| -|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.48.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.48.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.48.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| -|[java/workstations](https://github.com/googleapis/google-cloud-java/blob/v1.48.0/java/workstations/README.md)|com.google.cloud:google-cloud-workstations-spring-starter| +|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| +|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| +|[java/advisorynotifications](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/advisorynotifications/README.md)|com.google.cloud:google-cloud-advisorynotifications-spring-starter| +|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| +|[java/analyticshub](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/analyticshub/README.md)|com.google.cloud:google-cloud-analyticshub-spring-starter| +|[java/api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.0/java/apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| +|[java/apikeys](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/apikeys/README.md)|com.google.cloud:google-cloud-apikeys-spring-starter| +|[java/appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.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.49.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.49.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| +|[java/backupdr](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/backupdr/README.md)|com.google.cloud:google-cloud-backupdr-spring-starter| +|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| +|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| +|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| +|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| +|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| +|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| +|[java/cloudcontrolspartner](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/cloudcontrolspartner/README.md)|com.google.cloud:google-cloud-cloudcontrolspartner-spring-starter| +|[java/cloudquotas](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/cloudquotas/README.md)|com.google.cloud:google-cloud-cloudquotas-spring-starter| +|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| +|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| +|[java/datalineage](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/datalineage/README.md)|com.google.cloud:google-cloud-datalineage-spring-starter| +|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| +|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| +|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| +|[java/discoveryengine](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/discoveryengine/README.md)|com.google.cloud:google-cloud-discoveryengine-spring-starter| +|[java/distributedcloudedge](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/distributedcloudedge/README.md)|com.google.cloud:google-cloud-distributedcloudedge-spring-starter| +|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| +|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| +|[java/edgenetwork](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/edgenetwork/README.md)|com.google.cloud:google-cloud-edgenetwork-spring-starter| +|[java/essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| +|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| +|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| +|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.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.49.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| +|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| +|[java/iap](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/iap/README.md)|com.google.cloud:google-cloud-iap-spring-starter| +|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| +|[java/infra-manager](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/infra-manager/README.md)|com.google.cloud:google-cloud-infra-manager-spring-starter| +|[java/iot](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| +|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.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.49.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.49.0/java/network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| +|[java/network-security](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/network-security/README.md)|com.google.cloud:google-cloud-network-security-spring-starter| +|[java/networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| +|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| +|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.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.49.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.49.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.49.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.49.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| +|[java/publicca](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/publicca/README.md)|com.google.cloud:google-cloud-publicca-spring-starter| +|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| +|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| +|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| +|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| +|[java/securesourcemanager](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/securesourcemanager/README.md)|com.google.cloud:google-cloud-securesourcemanager-spring-starter| +|[java/security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| +|[java/securitycentermanagement](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/securitycentermanagement/README.md)|com.google.cloud:google-cloud-securitycentermanagement-spring-starter| +|[java/securityposture](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/securityposture/README.md)|com.google.cloud:google-cloud-securityposture-spring-starter| +|[java/service-control](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.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.49.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| +|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| +|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| +|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| +|[java/telcoautomation](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/telcoautomation/README.md)|com.google.cloud:google-cloud-telcoautomation-spring-starter| +|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| +|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| +|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| +|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/translate/README.md)|com.google.cloud:google-cloud-translate-spring-starter| +|[java/valkey](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/valkey/README.md)|com.google.cloud:google-cloud-valkey-spring-starter| +|[java/video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| +|[java/video-stitcher](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/video-stitcher/README.md)|com.google.cloud:google-cloud-video-stitcher-spring-starter| +|[java/video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| +|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| +|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| +|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.49.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.49.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.49.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java/workstations](https://github.com/googleapis/google-cloud-java/blob/v1.49.0/java/workstations/README.md)|com.google.cloud:google-cloud-workstations-spring-starter| diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..fb003a9c92 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringAutoConfiguration.java @@ -0,0 +1,338 @@ +/* + * 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.VertexRagDataServiceClient; +import com.google.cloud.aiplatform.v1.VertexRagDataServiceSettings; +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 VertexRagDataServiceClient}. + * + *

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(VertexRagDataServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.vertex-rag-data-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(VertexRagDataServiceSpringProperties.class) +public class VertexRagDataServiceSpringAutoConfiguration { + private final VertexRagDataServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(VertexRagDataServiceSpringAutoConfiguration.class); + + protected VertexRagDataServiceSpringAutoConfiguration( + VertexRagDataServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from VertexRagDataService-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 = "defaultVertexRagDataServiceTransportChannelProvider") + public TransportChannelProvider defaultVertexRagDataServiceTransportChannelProvider() { + return VertexRagDataServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a VertexRagDataServiceSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultVertexRagDataServiceTransportChannelProvider()). 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 VertexRagDataServiceSpringProperties. 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 VertexRagDataServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public VertexRagDataServiceSettings vertexRagDataServiceSettings( + @Qualifier("defaultVertexRagDataServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + VertexRagDataServiceSettings.Builder clientSettingsBuilder = + VertexRagDataServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VertexRagDataServiceSettings.getDefaultEndpoint()) + .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 = + VertexRagDataServiceSettings.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 getRagCorpusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRagCorpusSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRagCorpusSettings().setRetrySettings(getRagCorpusRetrySettings); + + RetrySettings listRagCorporaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRagCorporaSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRagCorporaSettings().setRetrySettings(listRagCorporaRetrySettings); + + RetrySettings uploadRagFileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.uploadRagFileSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.uploadRagFileSettings().setRetrySettings(uploadRagFileRetrySettings); + + RetrySettings getRagFileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRagFileSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRagFileSettings().setRetrySettings(getRagFileRetrySettings); + + RetrySettings listRagFilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRagFilesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRagFilesSettings().setRetrySettings(listRagFilesRetrySettings); + + 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 getRagCorpusRetry = clientProperties.getGetRagCorpusRetry(); + if (getRagCorpusRetry != null) { + RetrySettings getRagCorpusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRagCorpusSettings().getRetrySettings(), getRagCorpusRetry); + clientSettingsBuilder.getRagCorpusSettings().setRetrySettings(getRagCorpusRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRagCorpus from properties."); + } + } + Retry listRagCorporaRetry = clientProperties.getListRagCorporaRetry(); + if (listRagCorporaRetry != null) { + RetrySettings listRagCorporaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRagCorporaSettings().getRetrySettings(), + listRagCorporaRetry); + clientSettingsBuilder.listRagCorporaSettings().setRetrySettings(listRagCorporaRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRagCorpora from properties."); + } + } + Retry uploadRagFileRetry = clientProperties.getUploadRagFileRetry(); + if (uploadRagFileRetry != null) { + RetrySettings uploadRagFileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.uploadRagFileSettings().getRetrySettings(), uploadRagFileRetry); + clientSettingsBuilder.uploadRagFileSettings().setRetrySettings(uploadRagFileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for uploadRagFile from properties."); + } + } + Retry getRagFileRetry = clientProperties.getGetRagFileRetry(); + if (getRagFileRetry != null) { + RetrySettings getRagFileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRagFileSettings().getRetrySettings(), getRagFileRetry); + clientSettingsBuilder.getRagFileSettings().setRetrySettings(getRagFileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRagFile from properties."); + } + } + Retry listRagFilesRetry = clientProperties.getListRagFilesRetry(); + if (listRagFilesRetry != null) { + RetrySettings listRagFilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRagFilesSettings().getRetrySettings(), listRagFilesRetry); + clientSettingsBuilder.listRagFilesSettings().setRetrySettings(listRagFilesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRagFiles 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 VertexRagDataServiceClient bean configured with VertexRagDataServiceSettings. + * + * @param vertexRagDataServiceSettings settings to configure an instance of client bean. + * @return a {@link VertexRagDataServiceClient} bean configured with {@link + * VertexRagDataServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public VertexRagDataServiceClient vertexRagDataServiceClient( + VertexRagDataServiceSettings vertexRagDataServiceSettings) throws IOException { + return VertexRagDataServiceClient.create(vertexRagDataServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-vertex-rag-data-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/VertexRagDataServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringProperties.java new file mode 100644 index 0000000000..593e1f5ce9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagDataServiceSpringProperties.java @@ -0,0 +1,202 @@ +/* + * 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 VertexRagDataService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.vertex-rag-data-service") +public class VertexRagDataServiceSpringProperties 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 getRagCorpus. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRagCorpusRetry; + /** + * Allow override of retry settings at method-level for listRagCorpora. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRagCorporaRetry; + /** + * Allow override of retry settings at method-level for uploadRagFile. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry uploadRagFileRetry; + /** + * Allow override of retry settings at method-level for getRagFile. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRagFileRetry; + /** + * Allow override of retry settings at method-level for listRagFiles. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRagFilesRetry; + /** + * 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 getGetRagCorpusRetry() { + return this.getRagCorpusRetry; + } + + public void setGetRagCorpusRetry(Retry getRagCorpusRetry) { + this.getRagCorpusRetry = getRagCorpusRetry; + } + + public Retry getListRagCorporaRetry() { + return this.listRagCorporaRetry; + } + + public void setListRagCorporaRetry(Retry listRagCorporaRetry) { + this.listRagCorporaRetry = listRagCorporaRetry; + } + + public Retry getUploadRagFileRetry() { + return this.uploadRagFileRetry; + } + + public void setUploadRagFileRetry(Retry uploadRagFileRetry) { + this.uploadRagFileRetry = uploadRagFileRetry; + } + + public Retry getGetRagFileRetry() { + return this.getRagFileRetry; + } + + public void setGetRagFileRetry(Retry getRagFileRetry) { + this.getRagFileRetry = getRagFileRetry; + } + + public Retry getListRagFilesRetry() { + return this.listRagFilesRetry; + } + + public void setListRagFilesRetry(Retry listRagFilesRetry) { + this.listRagFilesRetry = listRagFilesRetry; + } + + 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/VertexRagServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..ca02ee9cc7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringAutoConfiguration.java @@ -0,0 +1,316 @@ +/* + * 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.VertexRagServiceClient; +import com.google.cloud.aiplatform.v1.VertexRagServiceSettings; +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 VertexRagServiceClient}. + * + *

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(VertexRagServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.vertex-rag-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(VertexRagServiceSpringProperties.class) +public class VertexRagServiceSpringAutoConfiguration { + private final VertexRagServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(VertexRagServiceSpringAutoConfiguration.class); + + protected VertexRagServiceSpringAutoConfiguration( + VertexRagServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from VertexRagService-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 = "defaultVertexRagServiceTransportChannelProvider") + public TransportChannelProvider defaultVertexRagServiceTransportChannelProvider() { + return VertexRagServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a VertexRagServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultVertexRagServiceTransportChannelProvider()). 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 VertexRagServiceSpringProperties. 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 VertexRagServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public VertexRagServiceSettings vertexRagServiceSettings( + @Qualifier("defaultVertexRagServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + VertexRagServiceSettings.Builder clientSettingsBuilder = VertexRagServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VertexRagServiceSettings.getDefaultEndpoint()) + .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 = + VertexRagServiceSettings.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 retrieveContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveContextsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .retrieveContextsSettings() + .setRetrySettings(retrieveContextsRetrySettings); + + RetrySettings augmentPromptRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.augmentPromptSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.augmentPromptSettings().setRetrySettings(augmentPromptRetrySettings); + + RetrySettings corroborateContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.corroborateContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .corroborateContentSettings() + .setRetrySettings(corroborateContentRetrySettings); + + 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 retrieveContextsRetry = clientProperties.getRetrieveContextsRetry(); + if (retrieveContextsRetry != null) { + RetrySettings retrieveContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveContextsSettings().getRetrySettings(), + retrieveContextsRetry); + clientSettingsBuilder + .retrieveContextsSettings() + .setRetrySettings(retrieveContextsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for retrieveContexts from properties."); + } + } + Retry augmentPromptRetry = clientProperties.getAugmentPromptRetry(); + if (augmentPromptRetry != null) { + RetrySettings augmentPromptRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.augmentPromptSettings().getRetrySettings(), augmentPromptRetry); + clientSettingsBuilder.augmentPromptSettings().setRetrySettings(augmentPromptRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for augmentPrompt from properties."); + } + } + Retry corroborateContentRetry = clientProperties.getCorroborateContentRetry(); + if (corroborateContentRetry != null) { + RetrySettings corroborateContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.corroborateContentSettings().getRetrySettings(), + corroborateContentRetry); + clientSettingsBuilder + .corroborateContentSettings() + .setRetrySettings(corroborateContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for corroborateContent 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 VertexRagServiceClient bean configured with VertexRagServiceSettings. + * + * @param vertexRagServiceSettings settings to configure an instance of client bean. + * @return a {@link VertexRagServiceClient} bean configured with {@link VertexRagServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public VertexRagServiceClient vertexRagServiceClient( + VertexRagServiceSettings vertexRagServiceSettings) throws IOException { + return VertexRagServiceClient.create(vertexRagServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-vertex-rag-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/VertexRagServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringProperties.java new file mode 100644 index 0000000000..3e7d10e709 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VertexRagServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * 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 VertexRagService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.vertex-rag-service") +public class VertexRagServiceSpringProperties 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 retrieveContexts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry retrieveContextsRetry; + /** + * Allow override of retry settings at method-level for augmentPrompt. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry augmentPromptRetry; + /** + * Allow override of retry settings at method-level for corroborateContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry corroborateContentRetry; + /** + * 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 getRetrieveContextsRetry() { + return this.retrieveContextsRetry; + } + + public void setRetrieveContextsRetry(Retry retrieveContextsRetry) { + this.retrieveContextsRetry = retrieveContextsRetry; + } + + public Retry getAugmentPromptRetry() { + return this.augmentPromptRetry; + } + + public void setAugmentPromptRetry(Retry augmentPromptRetry) { + this.augmentPromptRetry = augmentPromptRetry; + } + + public Retry getCorroborateContentRetry() { + return this.corroborateContentRetry; + } + + public void setCorroborateContentRetry(Retry corroborateContentRetry) { + this.corroborateContentRetry = corroborateContentRetry; + } + + 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 cc5fc3086d..618cb18bb3 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 @@ -156,6 +156,18 @@ "description": "Auto-configure Google Cloud aiplatform/TensorboardService components.", "defaultValue": true }, + { + "name": "com.google.cloud.aiplatform.v1.vertex-rag-data-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/VertexRagDataService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.aiplatform.v1.vertex-rag-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/VertexRagService components.", + "defaultValue": true + }, { "name": "com.google.cloud.aiplatform.v1.vizier-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 a386101016..c538f1847a 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 @@ -24,4 +24,6 @@ com.google.cloud.aiplatform.v1.spring.PredictionServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.ScheduleServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.SpecialistPoolServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.TensorboardServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.VertexRagDataServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.VertexRagServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.VizierServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringAutoConfiguration.java index 3a999c799f..1373993934 100644 --- a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringAutoConfiguration.java @@ -194,6 +194,13 @@ public ReservationServiceSettings reservationServiceSettings( .updateReservationSettings() .setRetrySettings(updateReservationRetrySettings); + RetrySettings failoverReservationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.failoverReservationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .failoverReservationSettings() + .setRetrySettings(failoverReservationRetrySettings); + RetrySettings createCapacityCommitmentRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.createCapacityCommitmentSettings().getRetrySettings(), @@ -383,6 +390,20 @@ public ReservationServiceSettings reservationServiceSettings( "Configured method-level retry settings for updateReservation from properties."); } } + Retry failoverReservationRetry = clientProperties.getFailoverReservationRetry(); + if (failoverReservationRetry != null) { + RetrySettings failoverReservationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.failoverReservationSettings().getRetrySettings(), + failoverReservationRetry); + clientSettingsBuilder + .failoverReservationSettings() + .setRetrySettings(failoverReservationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for failoverReservation from properties."); + } + } Retry createCapacityCommitmentRetry = clientProperties.getCreateCapacityCommitmentRetry(); if (createCapacityCommitmentRetry != null) { RetrySettings createCapacityCommitmentRetrySettings = diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java index 5428ff3dc3..782ced79c0 100644 --- a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java +++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java @@ -69,6 +69,11 @@ public class ReservationServiceSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry updateReservationRetry; + /** + * Allow override of retry settings at method-level for failoverReservation. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry failoverReservationRetry; /** * Allow override of retry settings at method-level for createCapacityCommitment. If defined, this * takes precedence over service-level retry configurations for that RPC method. @@ -227,6 +232,14 @@ public void setUpdateReservationRetry(Retry updateReservationRetry) { this.updateReservationRetry = updateReservationRetry; } + public Retry getFailoverReservationRetry() { + return this.failoverReservationRetry; + } + + public void setFailoverReservationRetry(Retry failoverReservationRetry) { + this.failoverReservationRetry = failoverReservationRetry; + } + public Retry getCreateCapacityCommitmentRetry() { return this.createCapacityCommitmentRetry; } diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringAutoConfiguration.java new file mode 100644 index 0000000000..444e110df3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringAutoConfiguration.java @@ -0,0 +1,207 @@ +/* + * 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.compute.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.compute.v1.NetworkProfilesClient; +import com.google.cloud.compute.v1.NetworkProfilesSettings; +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 NetworkProfilesClient}. + * + *

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(NetworkProfilesClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.compute.v1.network-profiles.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(NetworkProfilesSpringProperties.class) +public class NetworkProfilesSpringAutoConfiguration { + private final NetworkProfilesSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(NetworkProfilesSpringAutoConfiguration.class); + + protected NetworkProfilesSpringAutoConfiguration( + NetworkProfilesSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from NetworkProfiles-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 = "defaultNetworkProfilesTransportChannelProvider") + public TransportChannelProvider defaultNetworkProfilesTransportChannelProvider() { + return NetworkProfilesSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a NetworkProfilesSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultNetworkProfilesTransportChannelProvider()). 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 NetworkProfilesSpringProperties. 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 NetworkProfilesSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public NetworkProfilesSettings networkProfilesSettings( + @Qualifier("defaultNetworkProfilesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + NetworkProfilesSettings.Builder clientSettingsBuilder = NetworkProfilesSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkProfilesSettings.getDefaultEndpoint()) + .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 = + NetworkProfilesSettings.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 getRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + + RetrySettings listRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getRetry = clientProperties.getGetRetry(); + if (getRetry != null) { + RetrySettings getRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettings().getRetrySettings(), getRetry); + clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for get from properties."); + } + } + Retry listRetry = clientProperties.getListRetry(); + if (listRetry != null) { + RetrySettings listRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSettings().getRetrySettings(), listRetry); + clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for list from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a NetworkProfilesClient bean configured with NetworkProfilesSettings. + * + * @param networkProfilesSettings settings to configure an instance of client bean. + * @return a {@link NetworkProfilesClient} bean configured with {@link NetworkProfilesSettings} + */ + @Bean + @ConditionalOnMissingBean + public NetworkProfilesClient networkProfilesClient( + NetworkProfilesSettings networkProfilesSettings) throws IOException { + return NetworkProfilesClient.create(networkProfilesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-network-profiles"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringProperties.java new file mode 100644 index 0000000000..eed67b258a --- /dev/null +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkProfilesSpringProperties.java @@ -0,0 +1,101 @@ +/* + * 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.compute.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 NetworkProfiles client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.compute.v1.network-profiles") +public class NetworkProfilesSpringProperties 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/compute.readonly", + "https://www.googleapis.com/auth/compute", + "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 get. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRetry; + /** + * Allow override of retry settings at method-level for list. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRetry; + + @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 getGetRetry() { + return this.getRetry; + } + + public void setGetRetry(Retry getRetry) { + this.getRetry = getRetry; + } + + public Retry getListRetry() { + return this.listRetry; + } + + public void setListRetry(Retry listRetry) { + this.listRetry = listRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 59ef0e549a..61a9897b92 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -234,6 +234,12 @@ "description": "Auto-configure Google Cloud compute/NetworkFirewallPolicies components.", "defaultValue": true }, + { + "name": "com.google.cloud.compute.v1.network-profiles.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud compute/NetworkProfiles components.", + "defaultValue": true + }, { "name": "com.google.cloud.compute.v1.networks.enabled", "type": "java.lang.Boolean", diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 53544b2a8d..99e3a4ac44 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -37,6 +37,7 @@ com.google.cloud.compute.v1.spring.NetworkAttachmentsSpringAutoConfiguration com.google.cloud.compute.v1.spring.NetworkEdgeSecurityServicesSpringAutoConfiguration com.google.cloud.compute.v1.spring.NetworkEndpointGroupsSpringAutoConfiguration com.google.cloud.compute.v1.spring.NetworkFirewallPoliciesSpringAutoConfiguration +com.google.cloud.compute.v1.spring.NetworkProfilesSpringAutoConfiguration com.google.cloud.compute.v1.spring.NetworksSpringAutoConfiguration com.google.cloud.compute.v1.spring.NodeGroupsSpringAutoConfiguration com.google.cloud.compute.v1.spring.NodeTemplatesSpringAutoConfiguration diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringAutoConfiguration.java index 87fb247491..bc3ecbcfbe 100644 --- a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringAutoConfiguration.java @@ -354,6 +354,24 @@ public DataCatalogSettings dataCatalogSettings( .testIamPermissionsSettings() .setRetrySettings(testIamPermissionsRetrySettings); + RetrySettings setConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setConfigSettings().setRetrySettings(setConfigRetrySettings); + + RetrySettings retrieveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.retrieveConfigSettings().setRetrySettings(retrieveConfigRetrySettings); + + RetrySettings retrieveEffectiveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveEffectiveConfigSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .retrieveEffectiveConfigSettings() + .setRetrySettings(retrieveEffectiveConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { LOGGER.trace("Configured service-level retry settings from properties."); } @@ -739,6 +757,41 @@ public DataCatalogSettings dataCatalogSettings( "Configured method-level retry settings for testIamPermissions from properties."); } } + Retry setConfigRetry = clientProperties.getSetConfigRetry(); + if (setConfigRetry != null) { + RetrySettings setConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setConfigSettings().getRetrySettings(), setConfigRetry); + clientSettingsBuilder.setConfigSettings().setRetrySettings(setConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setConfig from properties."); + } + } + Retry retrieveConfigRetry = clientProperties.getRetrieveConfigRetry(); + if (retrieveConfigRetry != null) { + RetrySettings retrieveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveConfigSettings().getRetrySettings(), + retrieveConfigRetry); + clientSettingsBuilder.retrieveConfigSettings().setRetrySettings(retrieveConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for retrieveConfig from properties."); + } + } + Retry retrieveEffectiveConfigRetry = clientProperties.getRetrieveEffectiveConfigRetry(); + if (retrieveEffectiveConfigRetry != null) { + RetrySettings retrieveEffectiveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.retrieveEffectiveConfigSettings().getRetrySettings(), + retrieveEffectiveConfigRetry); + clientSettingsBuilder + .retrieveEffectiveConfigSettings() + .setRetrySettings(retrieveEffectiveConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for retrieveEffectiveConfig from properties."); + } + } return clientSettingsBuilder.build(); } diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java index 1290c19918..d72faf165f 100644 --- a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java @@ -202,6 +202,21 @@ public class DataCatalogSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry testIamPermissionsRetry; + /** + * Allow override of retry settings at method-level for setConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setConfigRetry; + /** + * Allow override of retry settings at method-level for retrieveConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry retrieveConfigRetry; + /** + * Allow override of retry settings at method-level for retrieveEffectiveConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry retrieveEffectiveConfigRetry; @Override public Credentials getCredentials() { @@ -495,4 +510,28 @@ public Retry getTestIamPermissionsRetry() { public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { this.testIamPermissionsRetry = testIamPermissionsRetry; } + + public Retry getSetConfigRetry() { + return this.setConfigRetry; + } + + public void setSetConfigRetry(Retry setConfigRetry) { + this.setConfigRetry = setConfigRetry; + } + + public Retry getRetrieveConfigRetry() { + return this.retrieveConfigRetry; + } + + public void setRetrieveConfigRetry(Retry retrieveConfigRetry) { + this.retrieveConfigRetry = retrieveConfigRetry; + } + + public Retry getRetrieveEffectiveConfigRetry() { + return this.retrieveEffectiveConfigRetry; + } + + public void setRetrieveEffectiveConfigRetry(Retry retrieveEffectiveConfigRetry) { + this.retrieveEffectiveConfigRetry = retrieveEffectiveConfigRetry; + } } diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringAutoConfiguration.java index 618886c9e3..811a866762 100644 --- a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringAutoConfiguration.java @@ -163,6 +163,11 @@ public HubServiceSettings hubServiceSettings( clientSettingsBuilder.listHubSpokesSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listHubSpokesSettings().setRetrySettings(listHubSpokesRetrySettings); + RetrySettings queryHubStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryHubStatusSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.queryHubStatusSettings().setRetrySettings(queryHubStatusRetrySettings); + RetrySettings listSpokesRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listSpokesSettings().getRetrySettings(), serviceRetry); @@ -266,6 +271,17 @@ public HubServiceSettings hubServiceSettings( LOGGER.trace("Configured method-level retry settings for listHubSpokes from properties."); } } + Retry queryHubStatusRetry = clientProperties.getQueryHubStatusRetry(); + if (queryHubStatusRetry != null) { + RetrySettings queryHubStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryHubStatusSettings().getRetrySettings(), + queryHubStatusRetry); + clientSettingsBuilder.queryHubStatusSettings().setRetrySettings(queryHubStatusRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for queryHubStatus from properties."); + } + } Retry listSpokesRetry = clientProperties.getListSpokesRetry(); if (listSpokesRetry != null) { RetrySettings listSpokesRetrySettings = diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java index cb3c134ff4..6aa6e5c6fb 100644 --- a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java +++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java @@ -55,6 +55,11 @@ public class HubServiceSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listHubSpokesRetry; + /** + * Allow override of retry settings at method-level for queryHubStatus. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry queryHubStatusRetry; /** * Allow override of retry settings at method-level for listSpokes. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -174,6 +179,14 @@ public void setListHubSpokesRetry(Retry listHubSpokesRetry) { this.listHubSpokesRetry = listHubSpokesRetry; } + public Retry getQueryHubStatusRetry() { + return this.queryHubStatusRetry; + } + + public void setQueryHubStatusRetry(Retry queryHubStatusRetry) { + this.queryHubStatusRetry = queryHubStatusRetry; + } + public Retry getListSpokesRetry() { return this.listSpokesRetry; } diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-valkey-spring-starter/pom.xml new file mode 100644 index 0000000000..e4a06e32b0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.9.1-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-valkey-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - memorystore + Spring Boot Starter with AutoConfiguration for memorystore + + + + + com.google.cloud + google-cloud-valkey + + + + org.springframework.boot + spring-boot-starter + + + + com.google.cloud + spring-cloud-gcp-autoconfigure + + + + \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringAutoConfiguration.java new file mode 100644 index 0000000000..e3c9c8a1d3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringAutoConfiguration.java @@ -0,0 +1,258 @@ +/* + * 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.memorystore.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.memorystore.v1.MemorystoreClient; +import com.google.cloud.memorystore.v1.MemorystoreSettings; +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 MemorystoreClient}. + * + *

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(MemorystoreClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.memorystore.v1.memorystore.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(MemorystoreSpringProperties.class) +public class MemorystoreSpringAutoConfiguration { + private final MemorystoreSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(MemorystoreSpringAutoConfiguration.class); + + protected MemorystoreSpringAutoConfiguration( + MemorystoreSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from Memorystore-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 = "defaultMemorystoreTransportChannelProvider") + public TransportChannelProvider defaultMemorystoreTransportChannelProvider() { + return MemorystoreSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a MemorystoreSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultMemorystoreTransportChannelProvider()). 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 MemorystoreSpringProperties. 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 MemorystoreSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public MemorystoreSettings memorystoreSettings( + @Qualifier("defaultMemorystoreTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + MemorystoreSettings.Builder clientSettingsBuilder = MemorystoreSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MemorystoreSettings.getDefaultEndpoint()) + .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 = + MemorystoreSettings.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 listInstancesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings); + + RetrySettings getInstanceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings); + + RetrySettings getCertificateAuthorityRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCertificateAuthoritySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getCertificateAuthoritySettings() + .setRetrySettings(getCertificateAuthorityRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listInstancesRetry = clientProperties.getListInstancesRetry(); + if (listInstancesRetry != null) { + RetrySettings listInstancesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry); + clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listInstances from properties."); + } + } + Retry getInstanceRetry = clientProperties.getGetInstanceRetry(); + if (getInstanceRetry != null) { + RetrySettings getInstanceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry); + clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getInstance from properties."); + } + } + Retry getCertificateAuthorityRetry = clientProperties.getGetCertificateAuthorityRetry(); + if (getCertificateAuthorityRetry != null) { + RetrySettings getCertificateAuthorityRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCertificateAuthoritySettings().getRetrySettings(), + getCertificateAuthorityRetry); + clientSettingsBuilder + .getCertificateAuthoritySettings() + .setRetrySettings(getCertificateAuthorityRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getCertificateAuthority 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."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a MemorystoreClient bean configured with MemorystoreSettings. + * + * @param memorystoreSettings settings to configure an instance of client bean. + * @return a {@link MemorystoreClient} bean configured with {@link MemorystoreSettings} + */ + @Bean + @ConditionalOnMissingBean + public MemorystoreClient memorystoreClient(MemorystoreSettings memorystoreSettings) + throws IOException { + return MemorystoreClient.create(memorystoreSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-memorystore"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringProperties.java b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringProperties.java new file mode 100644 index 0000000000..eec3e648fb --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/MemorystoreSpringProperties.java @@ -0,0 +1,137 @@ +/* + * 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.memorystore.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 Memorystore client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.memorystore.v1.memorystore") +public class MemorystoreSpringProperties 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 listInstances. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listInstancesRetry; + /** + * Allow override of retry settings at method-level for getInstance. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getInstanceRetry; + /** + * Allow override of retry settings at method-level for getCertificateAuthority. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCertificateAuthorityRetry; + /** + * 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; + + @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 getListInstancesRetry() { + return this.listInstancesRetry; + } + + public void setListInstancesRetry(Retry listInstancesRetry) { + this.listInstancesRetry = listInstancesRetry; + } + + public Retry getGetInstanceRetry() { + return this.getInstanceRetry; + } + + public void setGetInstanceRetry(Retry getInstanceRetry) { + this.getInstanceRetry = getInstanceRetry; + } + + public Retry getGetCertificateAuthorityRetry() { + return this.getCertificateAuthorityRetry; + } + + public void setGetCertificateAuthorityRetry(Retry getCertificateAuthorityRetry) { + this.getCertificateAuthorityRetry = getCertificateAuthorityRetry; + } + + 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; + } +} diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/package-info.java new file mode 100644 index 0000000000..29330a82df --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/java/com/google/cloud/memorystore/v1/spring/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** Spring Boot auto-configurations for memorystore. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.memorystore.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..398fd9aab8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.memorystore.v1.memorystore.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud memorystore/Memorystore components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..18322479ac --- /dev/null +++ b/spring-cloud-previews/google-cloud-valkey-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.memorystore.v1.spring.MemorystoreSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/pom.xml b/spring-cloud-previews/pom.xml index 7d420d49e5..b6e0194746 100644 --- a/spring-cloud-previews/pom.xml +++ b/spring-cloud-previews/pom.xml @@ -61,6 +61,7 @@ google-cloud-network-security-spring-starter google-cloud-network-management-spring-starter google-cloud-monitoring-dashboard-spring-starter + google-cloud-valkey-spring-starter google-cloud-memcache-spring-starter google-cloud-managed-identities-spring-starter google-cloud-language-spring-starter