diff --git a/spring-cloud-generator/scripts/generate-library-list.sh b/spring-cloud-generator/scripts/generate-library-list.sh index ea27a965e7..0cf722be30 100755 --- a/spring-cloud-generator/scripts/generate-library-list.sh +++ b/spring-cloud-generator/scripts/generate-library-list.sh @@ -29,7 +29,7 @@ echo "# library_name, googleapis_location, coordinates_version, monorepo_folder" # Note that this logic will not work for non-cloud APIs count=0 -configs=$(yq '.libraries[]' ./google-cloud-java/generation_config.yaml) +configs=$(yq eval '.libraries[]' -o=json ./google-cloud-java/generation_config.yaml) # Properly format the configs as a JSON array # This includes adding commas between objects and wrapping everything in square brackets json_array="[ $(echo "$configs" | tr '\n' ' ' | sed 's/} {/}, {/g') ]" diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md index c26b18775a..19e3e85ae9 100644 --- a/spring-cloud-previews/README.md +++ b/spring-cloud-previews/README.md @@ -16,92 +16,112 @@ add the following dependency to your `pom.xml`: | Client Library | Starter Maven Artifact | |----------------| -----------------------| -|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| -|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| -|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| -|[java/api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.0/java/apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| -|[java/appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.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.38.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.38.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| -|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| -|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| -|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| -|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| -|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| -|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| -|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| -|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| -|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| -|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| -|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| -|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| -|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| -|[java/essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| -|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| -|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| -|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.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.38.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| -|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| -|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| -|[java/iot](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| -|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.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.38.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.38.0/java/network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| -|[java/networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| -|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| -|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.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.38.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.38.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.38.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.38.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| -|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| -|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| -|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| -|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| -|[java/security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| -|[java/service-control](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.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.38.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| -|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| -|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| -|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| -|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| -|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| -|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| -|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.0/java/video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| -|[java/video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| -|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| -|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.38.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| -|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.38.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.38.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.38.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| +|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| +|[java/advisorynotifications](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/advisorynotifications/README.md)|com.google.cloud:google-cloud-advisorynotifications-spring-starter| +|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| +|[java/analyticshub](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.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.40.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.40.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.40.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.40.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.40.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| +|[java/backupdr](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/backupdr/README.md)|com.google.cloud:google-cloud-backupdr-spring-starter| +|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| +|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| +|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| +|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| +|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| +|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| +|[java/cloudcontrolspartner](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/cloudcontrolspartner/README.md)|com.google.cloud:google-cloud-cloudcontrolspartner-spring-starter| +|[java/cloudquotas](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/cloudquotas/README.md)|com.google.cloud:google-cloud-cloudquotas-spring-starter| +|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| +|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| +|[java/datalineage](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/datalineage/README.md)|com.google.cloud:google-cloud-datalineage-spring-starter| +|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| +|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| +|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| +|[java/discoveryengine](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/discoveryengine/README.md)|com.google.cloud:google-cloud-discoveryengine-spring-starter| +|[java/distributedcloudedge](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/distributedcloudedge/README.md)|com.google.cloud:google-cloud-distributedcloudedge-spring-starter| +|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| +|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| +|[java/edgenetwork](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| +|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| +|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| +|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| +|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| +|[java/iap](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/iap/README.md)|com.google.cloud:google-cloud-iap-spring-starter| +|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| +|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.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.40.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.40.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.40.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| +|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| +|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.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.40.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.40.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.40.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| +|[java/publicca](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/publicca/README.md)|com.google.cloud:google-cloud-publicca-spring-starter| +|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| +|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| +|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| +|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| +|[java/securesourcemanager](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| +|[java/securitycentermanagement](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/securitycentermanagement/README.md)|com.google.cloud:google-cloud-securitycentermanagement-spring-starter| +|[java/securityposture](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.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.40.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| +|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| +|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| +|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| +|[java/telcoautomation](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/telcoautomation/README.md)|com.google.cloud:google-cloud-telcoautomation-spring-starter| +|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| +|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| +|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| +|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.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.40.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.40.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| +|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| +|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| +|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.40.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.40.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.40.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java/workstations](https://github.com/googleapis/google-cloud-java/blob/v1.40.0/java/workstations/README.md)|com.google.cloud:google-cloud-workstations-spring-starter| diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringAutoConfiguration.java index 39e54143cc..927411c481 100644 --- a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public AccessApprovalAdminSettings accessApprovalSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AccessApprovalAdminSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/pom.xml new file mode 100644 index 0000000000..97f8170e7e --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-advisorynotifications-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - advisorynotifications + Spring Boot Starter with AutoConfiguration for advisorynotifications + + + + + com.google.cloud + google-cloud-advisorynotifications + + + + 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-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..087cb3ed89 --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringAutoConfiguration.java @@ -0,0 +1,265 @@ +/* + * 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.advisorynotifications.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.advisorynotifications.v1.AdvisoryNotificationsServiceClient; +import com.google.cloud.advisorynotifications.v1.AdvisoryNotificationsServiceSettings; +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 AdvisoryNotificationsServiceClient}. + * + *

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(AdvisoryNotificationsServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.advisorynotifications.v1.advisory-notifications-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(AdvisoryNotificationsServiceSpringProperties.class) +public class AdvisoryNotificationsServiceSpringAutoConfiguration { + private final AdvisoryNotificationsServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(AdvisoryNotificationsServiceSpringAutoConfiguration.class); + + protected AdvisoryNotificationsServiceSpringAutoConfiguration( + AdvisoryNotificationsServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from AdvisoryNotificationsService-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 = "defaultAdvisoryNotificationsServiceTransportChannelProvider") + public TransportChannelProvider defaultAdvisoryNotificationsServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return AdvisoryNotificationsServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return AdvisoryNotificationsServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a AdvisoryNotificationsServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultAdvisoryNotificationsServiceTransportChannelProvider()). 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 AdvisoryNotificationsServiceSpringProperties. 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 AdvisoryNotificationsServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AdvisoryNotificationsServiceSettings advisoryNotificationsServiceSettings( + @Qualifier("defaultAdvisoryNotificationsServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AdvisoryNotificationsServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AdvisoryNotificationsServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AdvisoryNotificationsServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AdvisoryNotificationsServiceSettings.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 = + AdvisoryNotificationsServiceSettings.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 listNotificationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotificationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listNotificationsSettings() + .setRetrySettings(listNotificationsRetrySettings); + + RetrySettings getNotificationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotificationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getNotificationSettings() + .setRetrySettings(getNotificationRetrySettings); + + RetrySettings getSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSettingsSettings().setRetrySettings(getSettingsRetrySettings); + + RetrySettings updateSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSettingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateSettingsSettings().setRetrySettings(updateSettingsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listNotificationsRetry = clientProperties.getListNotificationsRetry(); + if (listNotificationsRetry != null) { + RetrySettings listNotificationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNotificationsSettings().getRetrySettings(), + listNotificationsRetry); + clientSettingsBuilder + .listNotificationsSettings() + .setRetrySettings(listNotificationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listNotifications from properties."); + } + } + Retry getNotificationRetry = clientProperties.getGetNotificationRetry(); + if (getNotificationRetry != null) { + RetrySettings getNotificationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNotificationSettings().getRetrySettings(), + getNotificationRetry); + clientSettingsBuilder + .getNotificationSettings() + .setRetrySettings(getNotificationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getNotification from properties."); + } + } + Retry getSettingsRetry = clientProperties.getGetSettingsRetry(); + if (getSettingsRetry != null) { + RetrySettings getSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettingsSettings().getRetrySettings(), getSettingsRetry); + clientSettingsBuilder.getSettingsSettings().setRetrySettings(getSettingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSettings from properties."); + } + } + Retry updateSettingsRetry = clientProperties.getUpdateSettingsRetry(); + if (updateSettingsRetry != null) { + RetrySettings updateSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSettingsSettings().getRetrySettings(), + updateSettingsRetry); + clientSettingsBuilder.updateSettingsSettings().setRetrySettings(updateSettingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateSettings from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AdvisoryNotificationsServiceClient bean configured with + * AdvisoryNotificationsServiceSettings. + * + * @param advisoryNotificationsServiceSettings settings to configure an instance of client bean. + * @return a {@link AdvisoryNotificationsServiceClient} bean configured with {@link + * AdvisoryNotificationsServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient( + AdvisoryNotificationsServiceSettings advisoryNotificationsServiceSettings) + throws IOException { + return AdvisoryNotificationsServiceClient.create(advisoryNotificationsServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-advisory-notifications-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringProperties.java new file mode 100644 index 0000000000..44c281d4c5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/AdvisoryNotificationsServiceSpringProperties.java @@ -0,0 +1,134 @@ +/* + * 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.advisorynotifications.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 AdvisoryNotificationsService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.advisorynotifications.v1.advisory-notifications-service") +public class AdvisoryNotificationsServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listNotifications. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNotificationsRetry; + /** + * Allow override of retry settings at method-level for getNotification. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNotificationRetry; + /** + * Allow override of retry settings at method-level for getSettings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSettingsRetry; + /** + * Allow override of retry settings at method-level for updateSettings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateSettingsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListNotificationsRetry() { + return this.listNotificationsRetry; + } + + public void setListNotificationsRetry(Retry listNotificationsRetry) { + this.listNotificationsRetry = listNotificationsRetry; + } + + public Retry getGetNotificationRetry() { + return this.getNotificationRetry; + } + + public void setGetNotificationRetry(Retry getNotificationRetry) { + this.getNotificationRetry = getNotificationRetry; + } + + public Retry getGetSettingsRetry() { + return this.getSettingsRetry; + } + + public void setGetSettingsRetry(Retry getSettingsRetry) { + this.getSettingsRetry = getSettingsRetry; + } + + public Retry getUpdateSettingsRetry() { + return this.updateSettingsRetry; + } + + public void setUpdateSettingsRetry(Retry updateSettingsRetry) { + this.updateSettingsRetry = updateSettingsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/v1/spring/package-info.java new file mode 100644 index 0000000000..942b033630 --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/java/com/google/cloud/advisorynotifications/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 advisorynotifications. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.advisorynotifications.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..03558ae622 --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.advisorynotifications.v1.advisory-notifications-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud advisorynotifications/AdvisoryNotificationsService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..796d2aafab --- /dev/null +++ b/spring-cloud-previews/google-cloud-advisorynotifications-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.advisorynotifications.v1.spring.AdvisoryNotificationsServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringAutoConfiguration.java index 1620c065f0..ec2364a9cc 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public DatasetServiceSettings datasetServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DatasetServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); @@ -163,6 +164,14 @@ public DatasetServiceSettings datasetServiceSettings( clientSettingsBuilder.listDatasetsSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listDatasetsSettings().setRetrySettings(listDatasetsRetrySettings); + RetrySettings updateDatasetVersionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetVersionSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateDatasetVersionSettings() + .setRetrySettings(updateDatasetVersionRetrySettings); + RetrySettings getDatasetVersionRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.getDatasetVersionSettings().getRetrySettings(), serviceRetry); @@ -271,6 +280,20 @@ public DatasetServiceSettings datasetServiceSettings( LOGGER.trace("Configured method-level retry settings for listDatasets from properties."); } } + Retry updateDatasetVersionRetry = clientProperties.getUpdateDatasetVersionRetry(); + if (updateDatasetVersionRetry != null) { + RetrySettings updateDatasetVersionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetVersionSettings().getRetrySettings(), + updateDatasetVersionRetry); + clientSettingsBuilder + .updateDatasetVersionSettings() + .setRetrySettings(updateDatasetVersionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateDatasetVersion from properties."); + } + } Retry getDatasetVersionRetry = clientProperties.getGetDatasetVersionRetry(); if (getDatasetVersionRetry != null) { RetrySettings getDatasetVersionRetrySettings = diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java index 0873b62751..1fceb01eed 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java @@ -55,6 +55,11 @@ public class DatasetServiceSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listDatasetsRetry; + /** + * Allow override of retry settings at method-level for updateDatasetVersion. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDatasetVersionRetry; /** * Allow override of retry settings at method-level for getDatasetVersion. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -169,6 +174,14 @@ public void setListDatasetsRetry(Retry listDatasetsRetry) { this.listDatasetsRetry = listDatasetsRetry; } + public Retry getUpdateDatasetVersionRetry() { + return this.updateDatasetVersionRetry; + } + + public void setUpdateDatasetVersionRetry(Retry updateDatasetVersionRetry) { + this.updateDatasetVersionRetry = updateDatasetVersionRetry; + } + public Retry getGetDatasetVersionRetry() { return this.getDatasetVersionRetry; } diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java index f02167d209..0103267c1d 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettin clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DeploymentResourcePoolServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java index a7b909c92b..9b8497ebe0 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public EndpointServiceSettings endpointServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EndpointServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreAdminServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreAdminServiceSpringAutoConfiguration.java index b35769ef74..b1a6a84f32 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreAdminServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreAdminServiceSpringAutoConfiguration.java @@ -128,6 +128,7 @@ public FeatureOnlineStoreAdminServiceSettings featureOnlineStoreAdminServiceSett clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FeatureOnlineStoreAdminServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreServiceSpringAutoConfiguration.java index b382d164ef..bea7b5ee4c 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureOnlineStoreServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public FeatureOnlineStoreServiceSettings featureOnlineStoreServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FeatureOnlineStoreServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureRegistryServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureRegistryServiceSpringAutoConfiguration.java index 4ad697b71c..a6562a6739 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureRegistryServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeatureRegistryServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public FeatureRegistryServiceSettings featureRegistryServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FeatureRegistryServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java index 1f3d9bd192..f34f7b9b98 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingService clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FeaturestoreOnlineServingServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java index 6cbf42cafa..b350631e39 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public FeaturestoreServiceSettings featurestoreServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FeaturestoreServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java index 8dddccb3e1..50d11f902a 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/GenAiTuningServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public GenAiTuningServiceSettings genAiTuningServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GenAiTuningServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java index 3f84a7937c..3eb4cecfe5 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public IndexEndpointServiceSettings indexEndpointServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IndexEndpointServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java index 414a581d87..afa3dd1ed6 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public IndexServiceSettings indexServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IndexServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java index ac00a3b65c..d64d5f7eac 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public JobServiceSettings jobServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(JobServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/LlmUtilityServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/LlmUtilityServiceSpringAutoConfiguration.java index 97a58162b4..e4564dc71d 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/LlmUtilityServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/LlmUtilityServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public LlmUtilityServiceSettings llmUtilityServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LlmUtilityServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MatchServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MatchServiceSpringAutoConfiguration.java index 16f16952de..1208222605 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MatchServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MatchServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public MatchServiceSettings matchServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MatchServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java index 233c220b28..e4544012fd 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public MetadataServiceSettings metadataServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MetadataServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java index dea311d450..48f5eebd3a 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public MigrationServiceSettings migrationServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MigrationServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelGardenServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelGardenServiceSpringAutoConfiguration.java index 4bcf62a578..dd43a44765 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelGardenServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelGardenServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public ModelGardenServiceSettings modelGardenServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ModelGardenServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java index 0b387ee6e9..a1acd605e2 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public ModelServiceSettings modelServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ModelServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java index 11b6f673da..922befc273 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public NotebookServiceSettings notebookServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NotebookServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); @@ -164,6 +165,14 @@ public NotebookServiceSettings notebookServiceSettings( .listNotebookRuntimeTemplatesSettings() .setRetrySettings(listNotebookRuntimeTemplatesRetrySettings); + RetrySettings updateNotebookRuntimeTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateNotebookRuntimeTemplateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateNotebookRuntimeTemplateSettings() + .setRetrySettings(updateNotebookRuntimeTemplateRetrySettings); + RetrySettings getNotebookRuntimeRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.getNotebookRuntimeSettings().getRetrySettings(), serviceRetry); @@ -239,6 +248,21 @@ public NotebookServiceSettings notebookServiceSettings( "Configured method-level retry settings for listNotebookRuntimeTemplates from properties."); } } + Retry updateNotebookRuntimeTemplateRetry = + clientProperties.getUpdateNotebookRuntimeTemplateRetry(); + if (updateNotebookRuntimeTemplateRetry != null) { + RetrySettings updateNotebookRuntimeTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateNotebookRuntimeTemplateSettings().getRetrySettings(), + updateNotebookRuntimeTemplateRetry); + clientSettingsBuilder + .updateNotebookRuntimeTemplateSettings() + .setRetrySettings(updateNotebookRuntimeTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateNotebookRuntimeTemplate from properties."); + } + } Retry getNotebookRuntimeRetry = clientProperties.getGetNotebookRuntimeRetry(); if (getNotebookRuntimeRetry != null) { RetrySettings getNotebookRuntimeRetrySettings = diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java index d0006f0223..cd39341297 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/NotebookServiceSpringProperties.java @@ -50,6 +50,11 @@ public class NotebookServiceSpringProperties implements CredentialsSupplier { * this takes precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listNotebookRuntimeTemplatesRetry; + /** + * Allow override of retry settings at method-level for updateNotebookRuntimeTemplate. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateNotebookRuntimeTemplateRetry; /** * Allow override of retry settings at method-level for getNotebookRuntime. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -131,6 +136,14 @@ public void setListNotebookRuntimeTemplatesRetry(Retry listNotebookRuntimeTempla this.listNotebookRuntimeTemplatesRetry = listNotebookRuntimeTemplatesRetry; } + public Retry getUpdateNotebookRuntimeTemplateRetry() { + return this.updateNotebookRuntimeTemplateRetry; + } + + public void setUpdateNotebookRuntimeTemplateRetry(Retry updateNotebookRuntimeTemplateRetry) { + this.updateNotebookRuntimeTemplateRetry = updateNotebookRuntimeTemplateRetry; + } + public Retry getGetNotebookRuntimeRetry() { return this.getNotebookRuntimeRetry; } diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java index 4107b2627d..7a30a0f3b8 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PersistentResourceServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public PersistentResourceServiceSettings persistentResourceServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PersistentResourceServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java index 4a8e9ad8f5..cd5e5e031b 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public PipelineServiceSettings pipelineServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PipelineServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java index 159043fb7d..0ba59c7f32 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public PredictionServiceSettings predictionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PredictionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java index 7fe2e91d66..bdea9143b7 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java @@ -33,7 +33,9 @@ public class PredictionServiceSpringProperties 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"); + new Credentials( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); /** Quota project to use for billing. */ private String quotaProjectId; /** Number of threads used for executors. */ diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ScheduleServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ScheduleServiceSpringAutoConfiguration.java index 1b993e0c77..9d12e182cd 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ScheduleServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ScheduleServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public ScheduleServiceSettings scheduleServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ScheduleServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java index 2eac2a9c2d..9640667263 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public SpecialistPoolServiceSettings specialistPoolServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SpecialistPoolServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java index 9c55437f8f..01c9b4e8ed 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public TensorboardServiceSettings tensorboardServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TensorboardServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java index 3ed8a3bf91..c9a7febac7 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public VizierServiceSettings vizierServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VizierServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-analyticshub-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/pom.xml new file mode 100644 index 0000000000..6005545e2b --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-analyticshub-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - analyticshub + Spring Boot Starter with AutoConfiguration for analyticshub + + + + + com.google.cloud + google-cloud-analyticshub + + + + 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-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..5a46db7ac0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringAutoConfiguration.java @@ -0,0 +1,548 @@ +/* + * 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.bigquery.analyticshub.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.bigquery.analyticshub.v1.AnalyticsHubServiceClient; +import com.google.cloud.bigquery.analyticshub.v1.AnalyticsHubServiceSettings; +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 AnalyticsHubServiceClient}. + * + *

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(AnalyticsHubServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.bigquery.analyticshub.v1.analytics-hub-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(AnalyticsHubServiceSpringProperties.class) +public class AnalyticsHubServiceSpringAutoConfiguration { + private final AnalyticsHubServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(AnalyticsHubServiceSpringAutoConfiguration.class); + + protected AnalyticsHubServiceSpringAutoConfiguration( + AnalyticsHubServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from AnalyticsHubService-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 = "defaultAnalyticsHubServiceTransportChannelProvider") + public TransportChannelProvider defaultAnalyticsHubServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return AnalyticsHubServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return AnalyticsHubServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a AnalyticsHubServiceSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultAnalyticsHubServiceTransportChannelProvider()). 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 AnalyticsHubServiceSpringProperties. 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 AnalyticsHubServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AnalyticsHubServiceSettings analyticsHubServiceSettings( + @Qualifier("defaultAnalyticsHubServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AnalyticsHubServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AnalyticsHubServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AnalyticsHubServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AnalyticsHubServiceSettings.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 = + AnalyticsHubServiceSettings.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 listDataExchangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataExchangesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDataExchangesSettings() + .setRetrySettings(listDataExchangesRetrySettings); + + RetrySettings listOrgDataExchangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listOrgDataExchangesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listOrgDataExchangesSettings() + .setRetrySettings(listOrgDataExchangesRetrySettings); + + RetrySettings getDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataExchangeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getDataExchangeSettings() + .setRetrySettings(getDataExchangeRetrySettings); + + RetrySettings createDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDataExchangeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createDataExchangeSettings() + .setRetrySettings(createDataExchangeRetrySettings); + + RetrySettings updateDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDataExchangeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateDataExchangeSettings() + .setRetrySettings(updateDataExchangeRetrySettings); + + RetrySettings deleteDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteDataExchangeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteDataExchangeSettings() + .setRetrySettings(deleteDataExchangeRetrySettings); + + RetrySettings listListingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listListingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listListingsSettings().setRetrySettings(listListingsRetrySettings); + + RetrySettings getListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getListingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getListingSettings().setRetrySettings(getListingRetrySettings); + + RetrySettings createListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createListingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createListingSettings().setRetrySettings(createListingRetrySettings); + + RetrySettings updateListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateListingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateListingSettings().setRetrySettings(updateListingRetrySettings); + + RetrySettings deleteListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteListingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteListingSettings().setRetrySettings(deleteListingRetrySettings); + + RetrySettings subscribeListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.subscribeListingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .subscribeListingSettings() + .setRetrySettings(subscribeListingRetrySettings); + + RetrySettings getSubscriptionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSubscriptionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getSubscriptionSettings() + .setRetrySettings(getSubscriptionRetrySettings); + + RetrySettings listSubscriptionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSubscriptionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listSubscriptionsSettings() + .setRetrySettings(listSubscriptionsRetrySettings); + + RetrySettings listSharedResourceSubscriptionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSharedResourceSubscriptionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listSharedResourceSubscriptionsSettings() + .setRetrySettings(listSharedResourceSubscriptionsRetrySettings); + + RetrySettings revokeSubscriptionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.revokeSubscriptionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .revokeSubscriptionSettings() + .setRetrySettings(revokeSubscriptionRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + 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 listDataExchangesRetry = clientProperties.getListDataExchangesRetry(); + if (listDataExchangesRetry != null) { + RetrySettings listDataExchangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataExchangesSettings().getRetrySettings(), + listDataExchangesRetry); + clientSettingsBuilder + .listDataExchangesSettings() + .setRetrySettings(listDataExchangesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDataExchanges from properties."); + } + } + Retry listOrgDataExchangesRetry = clientProperties.getListOrgDataExchangesRetry(); + if (listOrgDataExchangesRetry != null) { + RetrySettings listOrgDataExchangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listOrgDataExchangesSettings().getRetrySettings(), + listOrgDataExchangesRetry); + clientSettingsBuilder + .listOrgDataExchangesSettings() + .setRetrySettings(listOrgDataExchangesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listOrgDataExchanges from properties."); + } + } + Retry getDataExchangeRetry = clientProperties.getGetDataExchangeRetry(); + if (getDataExchangeRetry != null) { + RetrySettings getDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataExchangeSettings().getRetrySettings(), + getDataExchangeRetry); + clientSettingsBuilder + .getDataExchangeSettings() + .setRetrySettings(getDataExchangeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataExchange from properties."); + } + } + Retry createDataExchangeRetry = clientProperties.getCreateDataExchangeRetry(); + if (createDataExchangeRetry != null) { + RetrySettings createDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDataExchangeSettings().getRetrySettings(), + createDataExchangeRetry); + clientSettingsBuilder + .createDataExchangeSettings() + .setRetrySettings(createDataExchangeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createDataExchange from properties."); + } + } + Retry updateDataExchangeRetry = clientProperties.getUpdateDataExchangeRetry(); + if (updateDataExchangeRetry != null) { + RetrySettings updateDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDataExchangeSettings().getRetrySettings(), + updateDataExchangeRetry); + clientSettingsBuilder + .updateDataExchangeSettings() + .setRetrySettings(updateDataExchangeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateDataExchange from properties."); + } + } + Retry deleteDataExchangeRetry = clientProperties.getDeleteDataExchangeRetry(); + if (deleteDataExchangeRetry != null) { + RetrySettings deleteDataExchangeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteDataExchangeSettings().getRetrySettings(), + deleteDataExchangeRetry); + clientSettingsBuilder + .deleteDataExchangeSettings() + .setRetrySettings(deleteDataExchangeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteDataExchange from properties."); + } + } + Retry listListingsRetry = clientProperties.getListListingsRetry(); + if (listListingsRetry != null) { + RetrySettings listListingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listListingsSettings().getRetrySettings(), listListingsRetry); + clientSettingsBuilder.listListingsSettings().setRetrySettings(listListingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listListings from properties."); + } + } + Retry getListingRetry = clientProperties.getGetListingRetry(); + if (getListingRetry != null) { + RetrySettings getListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getListingSettings().getRetrySettings(), getListingRetry); + clientSettingsBuilder.getListingSettings().setRetrySettings(getListingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getListing from properties."); + } + } + Retry createListingRetry = clientProperties.getCreateListingRetry(); + if (createListingRetry != null) { + RetrySettings createListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createListingSettings().getRetrySettings(), createListingRetry); + clientSettingsBuilder.createListingSettings().setRetrySettings(createListingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createListing from properties."); + } + } + Retry updateListingRetry = clientProperties.getUpdateListingRetry(); + if (updateListingRetry != null) { + RetrySettings updateListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateListingSettings().getRetrySettings(), updateListingRetry); + clientSettingsBuilder.updateListingSettings().setRetrySettings(updateListingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateListing from properties."); + } + } + Retry deleteListingRetry = clientProperties.getDeleteListingRetry(); + if (deleteListingRetry != null) { + RetrySettings deleteListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteListingSettings().getRetrySettings(), deleteListingRetry); + clientSettingsBuilder.deleteListingSettings().setRetrySettings(deleteListingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteListing from properties."); + } + } + Retry subscribeListingRetry = clientProperties.getSubscribeListingRetry(); + if (subscribeListingRetry != null) { + RetrySettings subscribeListingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.subscribeListingSettings().getRetrySettings(), + subscribeListingRetry); + clientSettingsBuilder + .subscribeListingSettings() + .setRetrySettings(subscribeListingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for subscribeListing from properties."); + } + } + Retry getSubscriptionRetry = clientProperties.getGetSubscriptionRetry(); + if (getSubscriptionRetry != null) { + RetrySettings getSubscriptionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSubscriptionSettings().getRetrySettings(), + getSubscriptionRetry); + clientSettingsBuilder + .getSubscriptionSettings() + .setRetrySettings(getSubscriptionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSubscription from properties."); + } + } + Retry listSubscriptionsRetry = clientProperties.getListSubscriptionsRetry(); + if (listSubscriptionsRetry != null) { + RetrySettings listSubscriptionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSubscriptionsSettings().getRetrySettings(), + listSubscriptionsRetry); + clientSettingsBuilder + .listSubscriptionsSettings() + .setRetrySettings(listSubscriptionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSubscriptions from properties."); + } + } + Retry listSharedResourceSubscriptionsRetry = + clientProperties.getListSharedResourceSubscriptionsRetry(); + if (listSharedResourceSubscriptionsRetry != null) { + RetrySettings listSharedResourceSubscriptionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSharedResourceSubscriptionsSettings().getRetrySettings(), + listSharedResourceSubscriptionsRetry); + clientSettingsBuilder + .listSharedResourceSubscriptionsSettings() + .setRetrySettings(listSharedResourceSubscriptionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSharedResourceSubscriptions from properties."); + } + } + Retry revokeSubscriptionRetry = clientProperties.getRevokeSubscriptionRetry(); + if (revokeSubscriptionRetry != null) { + RetrySettings revokeSubscriptionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.revokeSubscriptionSettings().getRetrySettings(), + revokeSubscriptionRetry); + clientSettingsBuilder + .revokeSubscriptionSettings() + .setRetrySettings(revokeSubscriptionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for revokeSubscription 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 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 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 AnalyticsHubServiceClient bean configured with AnalyticsHubServiceSettings. + * + * @param analyticsHubServiceSettings settings to configure an instance of client bean. + * @return a {@link AnalyticsHubServiceClient} bean configured with {@link + * AnalyticsHubServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public AnalyticsHubServiceClient analyticsHubServiceClient( + AnalyticsHubServiceSettings analyticsHubServiceSettings) throws IOException { + return AnalyticsHubServiceClient.create(analyticsHubServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-analytics-hub-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringProperties.java b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringProperties.java new file mode 100644 index 0000000000..fbaf6bcd39 --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/AnalyticsHubServiceSpringProperties.java @@ -0,0 +1,331 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.analyticshub.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 AnalyticsHubService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.bigquery.analyticshub.v1.analytics-hub-service") +public class AnalyticsHubServiceSpringProperties 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/bigquery", + "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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listDataExchanges. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataExchangesRetry; + /** + * Allow override of retry settings at method-level for listOrgDataExchanges. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listOrgDataExchangesRetry; + /** + * Allow override of retry settings at method-level for getDataExchange. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDataExchangeRetry; + /** + * Allow override of retry settings at method-level for createDataExchange. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createDataExchangeRetry; + /** + * Allow override of retry settings at method-level for updateDataExchange. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDataExchangeRetry; + /** + * Allow override of retry settings at method-level for deleteDataExchange. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteDataExchangeRetry; + /** + * Allow override of retry settings at method-level for listListings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listListingsRetry; + /** + * Allow override of retry settings at method-level for getListing. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getListingRetry; + /** + * Allow override of retry settings at method-level for createListing. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createListingRetry; + /** + * Allow override of retry settings at method-level for updateListing. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateListingRetry; + /** + * Allow override of retry settings at method-level for deleteListing. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteListingRetry; + /** + * Allow override of retry settings at method-level for subscribeListing. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry subscribeListingRetry; + /** + * Allow override of retry settings at method-level for getSubscription. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSubscriptionRetry; + /** + * Allow override of retry settings at method-level for listSubscriptions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSubscriptionsRetry; + /** + * Allow override of retry settings at method-level for listSharedResourceSubscriptions. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSharedResourceSubscriptionsRetry; + /** + * Allow override of retry settings at method-level for revokeSubscription. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry revokeSubscriptionRetry; + /** + * 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 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 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListDataExchangesRetry() { + return this.listDataExchangesRetry; + } + + public void setListDataExchangesRetry(Retry listDataExchangesRetry) { + this.listDataExchangesRetry = listDataExchangesRetry; + } + + public Retry getListOrgDataExchangesRetry() { + return this.listOrgDataExchangesRetry; + } + + public void setListOrgDataExchangesRetry(Retry listOrgDataExchangesRetry) { + this.listOrgDataExchangesRetry = listOrgDataExchangesRetry; + } + + public Retry getGetDataExchangeRetry() { + return this.getDataExchangeRetry; + } + + public void setGetDataExchangeRetry(Retry getDataExchangeRetry) { + this.getDataExchangeRetry = getDataExchangeRetry; + } + + public Retry getCreateDataExchangeRetry() { + return this.createDataExchangeRetry; + } + + public void setCreateDataExchangeRetry(Retry createDataExchangeRetry) { + this.createDataExchangeRetry = createDataExchangeRetry; + } + + public Retry getUpdateDataExchangeRetry() { + return this.updateDataExchangeRetry; + } + + public void setUpdateDataExchangeRetry(Retry updateDataExchangeRetry) { + this.updateDataExchangeRetry = updateDataExchangeRetry; + } + + public Retry getDeleteDataExchangeRetry() { + return this.deleteDataExchangeRetry; + } + + public void setDeleteDataExchangeRetry(Retry deleteDataExchangeRetry) { + this.deleteDataExchangeRetry = deleteDataExchangeRetry; + } + + public Retry getListListingsRetry() { + return this.listListingsRetry; + } + + public void setListListingsRetry(Retry listListingsRetry) { + this.listListingsRetry = listListingsRetry; + } + + public Retry getGetListingRetry() { + return this.getListingRetry; + } + + public void setGetListingRetry(Retry getListingRetry) { + this.getListingRetry = getListingRetry; + } + + public Retry getCreateListingRetry() { + return this.createListingRetry; + } + + public void setCreateListingRetry(Retry createListingRetry) { + this.createListingRetry = createListingRetry; + } + + public Retry getUpdateListingRetry() { + return this.updateListingRetry; + } + + public void setUpdateListingRetry(Retry updateListingRetry) { + this.updateListingRetry = updateListingRetry; + } + + public Retry getDeleteListingRetry() { + return this.deleteListingRetry; + } + + public void setDeleteListingRetry(Retry deleteListingRetry) { + this.deleteListingRetry = deleteListingRetry; + } + + public Retry getSubscribeListingRetry() { + return this.subscribeListingRetry; + } + + public void setSubscribeListingRetry(Retry subscribeListingRetry) { + this.subscribeListingRetry = subscribeListingRetry; + } + + public Retry getGetSubscriptionRetry() { + return this.getSubscriptionRetry; + } + + public void setGetSubscriptionRetry(Retry getSubscriptionRetry) { + this.getSubscriptionRetry = getSubscriptionRetry; + } + + public Retry getListSubscriptionsRetry() { + return this.listSubscriptionsRetry; + } + + public void setListSubscriptionsRetry(Retry listSubscriptionsRetry) { + this.listSubscriptionsRetry = listSubscriptionsRetry; + } + + public Retry getListSharedResourceSubscriptionsRetry() { + return this.listSharedResourceSubscriptionsRetry; + } + + public void setListSharedResourceSubscriptionsRetry(Retry listSharedResourceSubscriptionsRetry) { + this.listSharedResourceSubscriptionsRetry = listSharedResourceSubscriptionsRetry; + } + + public Retry getRevokeSubscriptionRetry() { + return this.revokeSubscriptionRetry; + } + + public void setRevokeSubscriptionRetry(Retry revokeSubscriptionRetry) { + this.revokeSubscriptionRetry = revokeSubscriptionRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/v1/spring/package-info.java new file mode 100644 index 0000000000..97b3b20b30 --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/java/com/google/cloud/bigquery/analyticshub/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 analyticshub. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.bigquery.analyticshub.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..b7cfec0281 --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.bigquery.analyticshub.v1.analytics-hub-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud analyticshub/AnalyticsHubService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..a267735ac7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-analyticshub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.bigquery.analyticshub.v1.spring.AnalyticsHubServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringAutoConfiguration.java index aae05250b0..63eda06f59 100644 --- a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ApiGatewayServiceSettings apiGatewayServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ApiGatewayServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringAutoConfiguration.java index 36e638d7b3..b1ca245e6c 100644 --- a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ConnectionServiceSettings connectionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConnectionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java index 9c6d21fb5b..51e6eba909 100644 --- a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public TetherSettings tetherSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TetherSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-apikeys-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-apikeys-spring-starter/pom.xml new file mode 100644 index 0000000000..bd5558faaa --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-apikeys-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - apikeys + Spring Boot Starter with AutoConfiguration for apikeys + + + + + com.google.cloud + google-cloud-apikeys + + + + 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-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringAutoConfiguration.java new file mode 100644 index 0000000000..0eda23ae4f --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringAutoConfiguration.java @@ -0,0 +1,242 @@ +/* + * 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.api.apikeys.v2.spring; + +import com.google.api.apikeys.v2.ApiKeysClient; +import com.google.api.apikeys.v2.ApiKeysSettings; +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.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 ApiKeysClient}. + * + *

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(ApiKeysClient.class) +@ConditionalOnProperty(value = "com.google.api.apikeys.v2.api-keys.enabled", matchIfMissing = true) +@EnableConfigurationProperties(ApiKeysSpringProperties.class) +public class ApiKeysSpringAutoConfiguration { + private final ApiKeysSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(ApiKeysSpringAutoConfiguration.class); + + protected ApiKeysSpringAutoConfiguration( + ApiKeysSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from ApiKeys-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 = "defaultApiKeysTransportChannelProvider") + public TransportChannelProvider defaultApiKeysTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ApiKeysSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ApiKeysSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ApiKeysSettings bean configured to use a DefaultCredentialsProvider and the client + * library's default transport channel provider (defaultApiKeysTransportChannelProvider()). 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 ApiKeysSpringProperties. 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 ApiKeysSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ApiKeysSettings apiKeysSettings( + @Qualifier("defaultApiKeysTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ApiKeysSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ApiKeysSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ApiKeysSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ApiKeysSettings.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 = + ApiKeysSettings.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 listKeysRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listKeysSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listKeysSettings().setRetrySettings(listKeysRetrySettings); + + RetrySettings getKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKeySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getKeySettings().setRetrySettings(getKeyRetrySettings); + + RetrySettings getKeyStringRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKeyStringSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getKeyStringSettings().setRetrySettings(getKeyStringRetrySettings); + + RetrySettings lookupKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.lookupKeySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.lookupKeySettings().setRetrySettings(lookupKeyRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listKeysRetry = clientProperties.getListKeysRetry(); + if (listKeysRetry != null) { + RetrySettings listKeysRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listKeysSettings().getRetrySettings(), listKeysRetry); + clientSettingsBuilder.listKeysSettings().setRetrySettings(listKeysRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listKeys from properties."); + } + } + Retry getKeyRetry = clientProperties.getGetKeyRetry(); + if (getKeyRetry != null) { + RetrySettings getKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKeySettings().getRetrySettings(), getKeyRetry); + clientSettingsBuilder.getKeySettings().setRetrySettings(getKeyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getKey from properties."); + } + } + Retry getKeyStringRetry = clientProperties.getGetKeyStringRetry(); + if (getKeyStringRetry != null) { + RetrySettings getKeyStringRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKeyStringSettings().getRetrySettings(), getKeyStringRetry); + clientSettingsBuilder.getKeyStringSettings().setRetrySettings(getKeyStringRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getKeyString from properties."); + } + } + Retry lookupKeyRetry = clientProperties.getLookupKeyRetry(); + if (lookupKeyRetry != null) { + RetrySettings lookupKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.lookupKeySettings().getRetrySettings(), lookupKeyRetry); + clientSettingsBuilder.lookupKeySettings().setRetrySettings(lookupKeyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for lookupKey from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ApiKeysClient bean configured with ApiKeysSettings. + * + * @param apiKeysSettings settings to configure an instance of client bean. + * @return a {@link ApiKeysClient} bean configured with {@link ApiKeysSettings} + */ + @Bean + @ConditionalOnMissingBean + public ApiKeysClient apiKeysClient(ApiKeysSettings apiKeysSettings) throws IOException { + return ApiKeysClient.create(apiKeysSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-api-keys"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringProperties.java b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringProperties.java new file mode 100644 index 0000000000..974b138fbb --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/ApiKeysSpringProperties.java @@ -0,0 +1,136 @@ +/* + * 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.api.apikeys.v2.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 ApiKeys client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.api.apikeys.v2.api-keys") +public class ApiKeysSpringProperties 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", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listKeys. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listKeysRetry; + /** + * Allow override of retry settings at method-level for getKey. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getKeyRetry; + /** + * Allow override of retry settings at method-level for getKeyString. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getKeyStringRetry; + /** + * Allow override of retry settings at method-level for lookupKey. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry lookupKeyRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListKeysRetry() { + return this.listKeysRetry; + } + + public void setListKeysRetry(Retry listKeysRetry) { + this.listKeysRetry = listKeysRetry; + } + + public Retry getGetKeyRetry() { + return this.getKeyRetry; + } + + public void setGetKeyRetry(Retry getKeyRetry) { + this.getKeyRetry = getKeyRetry; + } + + public Retry getGetKeyStringRetry() { + return this.getKeyStringRetry; + } + + public void setGetKeyStringRetry(Retry getKeyStringRetry) { + this.getKeyStringRetry = getKeyStringRetry; + } + + public Retry getLookupKeyRetry() { + return this.lookupKeyRetry; + } + + public void setLookupKeyRetry(Retry lookupKeyRetry) { + this.lookupKeyRetry = lookupKeyRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/spring/package-info.java new file mode 100644 index 0000000000..851086a401 --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/java/com/google/api/apikeys/v2/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 apikeys. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.api.apikeys.v2.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..42a8af011c --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.api.apikeys.v2.api-keys.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud apikeys/ApiKeys components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..bed87340e9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-apikeys-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.api.apikeys.v2.spring.ApiKeysSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringAutoConfiguration.java index 7a07361cb2..b625568eba 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ApplicationsSettings applicationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ApplicationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java index 59b051319e..3681275d60 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public AuthorizedCertificatesSettings authorizedCertificatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AuthorizedCertificatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java index e51b6ae9ec..0f0e8fa6c0 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public AuthorizedDomainsSettings authorizedDomainsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AuthorizedDomainsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java index 71c2f3ee4d..a414ba21b8 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public DomainMappingsSettings domainMappingsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DomainMappingsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java index a015169748..202accbff1 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public FirewallSettings firewallSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FirewallSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java index 4c6ef72076..7113978dde 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public InstancesSettings instancesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstancesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java index f621327b10..794f50ff7a 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public ServicesSettings servicesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServicesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java index bf1542c814..20a80bd8ac 100644 --- a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public VersionsSettings versionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VersionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringAutoConfiguration.java index cce6f577cf..6f571264e1 100644 --- a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ArtifactRegistrySettings artifactRegistrySettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ArtifactRegistrySettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringAutoConfiguration.java index fbad047534..8e90e010ad 100644 --- a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public AssetServiceSettings assetServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AssetServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringAutoConfiguration.java index a643ef17e6..7916ae2e71 100644 --- a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AssuredWorkloadsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringAutoConfiguration.java index 7b61151737..33c9f164d5 100644 --- a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public AutoMlSettings autoMlSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AutoMlSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java index 965b8bd919..61f023c428 100644 --- a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public PredictionServiceSettings predictionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PredictionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-backupdr-spring-starter/pom.xml new file mode 100644 index 0000000000..a5289379ae --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-backupdr-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - backupdr + Spring Boot Starter with AutoConfiguration for backupdr + + + + + com.google.cloud + google-cloud-backupdr + + + + 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-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java new file mode 100644 index 0000000000..3e28c9c9cb --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java @@ -0,0 +1,308 @@ +/* + * 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.backupdr.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.backupdr.v1.BackupDRClient; +import com.google.cloud.backupdr.v1.BackupDRSettings; +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 BackupDRClient}. + * + *

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(BackupDRClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.backupdr.v1.backup-d-r.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(BackupDRSpringProperties.class) +public class BackupDRSpringAutoConfiguration { + private final BackupDRSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(BackupDRSpringAutoConfiguration.class); + + protected BackupDRSpringAutoConfiguration( + BackupDRSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from BackupDR-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 = "defaultBackupDRTransportChannelProvider") + public TransportChannelProvider defaultBackupDRTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return BackupDRSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return BackupDRSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a BackupDRSettings bean configured to use a DefaultCredentialsProvider and the client + * library's default transport channel provider (defaultBackupDRTransportChannelProvider()). 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 BackupDRSpringProperties. 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 BackupDRSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public BackupDRSettings backupDRSettings( + @Qualifier("defaultBackupDRTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + BackupDRSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = BackupDRSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = BackupDRSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BackupDRSettings.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 = + BackupDRSettings.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 listManagementServersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listManagementServersSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listManagementServersSettings() + .setRetrySettings(listManagementServersRetrySettings); + + RetrySettings getManagementServerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getManagementServerSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getManagementServerSettings() + .setRetrySettings(getManagementServerRetrySettings); + + 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 listManagementServersRetry = clientProperties.getListManagementServersRetry(); + if (listManagementServersRetry != null) { + RetrySettings listManagementServersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listManagementServersSettings().getRetrySettings(), + listManagementServersRetry); + clientSettingsBuilder + .listManagementServersSettings() + .setRetrySettings(listManagementServersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listManagementServers from properties."); + } + } + Retry getManagementServerRetry = clientProperties.getGetManagementServerRetry(); + if (getManagementServerRetry != null) { + RetrySettings getManagementServerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getManagementServerSettings().getRetrySettings(), + getManagementServerRetry); + clientSettingsBuilder + .getManagementServerSettings() + .setRetrySettings(getManagementServerRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getManagementServer 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 BackupDRClient bean configured with BackupDRSettings. + * + * @param backupDRSettings settings to configure an instance of client bean. + * @return a {@link BackupDRClient} bean configured with {@link BackupDRSettings} + */ + @Bean + @ConditionalOnMissingBean + public BackupDRClient backupDRClient(BackupDRSettings backupDRSettings) throws IOException { + return BackupDRClient.create(backupDRSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-backup-d-r"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java new file mode 100644 index 0000000000..2c45f6ef29 --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java @@ -0,0 +1,173 @@ +/* + * 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.backupdr.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 BackupDR client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.backupdr.v1.backup-d-r") +public class BackupDRSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listManagementServers. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listManagementServersRetry; + /** + * Allow override of retry settings at method-level for getManagementServer. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getManagementServerRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListManagementServersRetry() { + return this.listManagementServersRetry; + } + + public void setListManagementServersRetry(Retry listManagementServersRetry) { + this.listManagementServersRetry = listManagementServersRetry; + } + + public Retry getGetManagementServerRetry() { + return this.getManagementServerRetry; + } + + public void setGetManagementServerRetry(Retry getManagementServerRetry) { + this.getManagementServerRetry = getManagementServerRetry; + } + + 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-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/package-info.java new file mode 100644 index 0000000000..96402160c1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/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 backupdr. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.backupdr.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..6e9a767bc9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.backupdr.v1.backup-d-r.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud backupdr/BackupDR components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..0a9b8e6454 --- /dev/null +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.backupdr.v1.spring.BackupDRSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringAutoConfiguration.java index 46fbb0100c..9ea36c1f9d 100644 --- a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ConnectionServiceSettings connectionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConnectionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringAutoConfiguration.java index a9560d8637..9b7d21480b 100644 --- a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public DataTransferServiceSettings dataTransferServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataTransferServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); 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 537259e4e7..3a999c799f 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 @@ -136,6 +136,7 @@ public ReservationServiceSettings reservationServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ReservationServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringAutoConfiguration.java index 61b8361b38..8ce602f3bb 100644 --- a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CloudBillingSettings cloudBillingSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudBillingSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java index 75a48e7343..36db18c0f1 100644 --- a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CloudCatalogSettings cloudCatalogSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudCatalogSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringAutoConfiguration.java index e05244483f..921aab2282 100644 --- a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public BudgetServiceSettings budgetServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BudgetServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringAutoConfiguration.java index 5d8298bf92..d70a35c2a6 100644 --- a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringAutoConfiguration.java @@ -138,6 +138,7 @@ public BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BinauthzManagementServiceV1Settings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java index ad26ff4066..95105b4e9a 100644 --- a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java @@ -135,6 +135,7 @@ public SystemPolicyV1Settings systemPolicyV1Settings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SystemPolicyV1Settings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java index 01ee22efa9..9683a6d74c 100644 --- a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ValidationHelperV1Settings validationHelperV1Settings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ValidationHelperV1Settings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v2/spring/RepositoryManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v2/spring/RepositoryManagerSpringAutoConfiguration.java index 995a98719b..eb664cb995 100644 --- a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v2/spring/RepositoryManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v2/spring/RepositoryManagerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public RepositoryManagerSettings repositoryManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RepositoryManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringAutoConfiguration.java index 5d19fcb4d3..f56d631417 100644 --- a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public CloudChannelReportsServiceSettings cloudChannelReportsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudChannelReportsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java index 13a1a2fed6..4308e068a6 100644 --- a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public CloudChannelServiceSettings cloudChannelServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudChannelServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/pom.xml new file mode 100644 index 0000000000..e2b227d531 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-cloudcontrolspartner-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - cloudcontrolspartner + Spring Boot Starter with AutoConfiguration for cloudcontrolspartner + + + + + com.google.cloud + google-cloud-cloudcontrolspartner + + + + 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-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringAutoConfiguration.java new file mode 100644 index 0000000000..1fb69ac4db --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringAutoConfiguration.java @@ -0,0 +1,332 @@ +/* + * 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.cloudcontrolspartner.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.cloudcontrolspartner.v1.CloudControlsPartnerCoreClient; +import com.google.cloud.cloudcontrolspartner.v1.CloudControlsPartnerCoreSettings; +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 CloudControlsPartnerCoreClient}. + * + *

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(CloudControlsPartnerCoreClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-core.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(CloudControlsPartnerCoreSpringProperties.class) +public class CloudControlsPartnerCoreSpringAutoConfiguration { + private final CloudControlsPartnerCoreSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(CloudControlsPartnerCoreSpringAutoConfiguration.class); + + protected CloudControlsPartnerCoreSpringAutoConfiguration( + CloudControlsPartnerCoreSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from CloudControlsPartnerCore-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 = "defaultCloudControlsPartnerCoreTransportChannelProvider") + public TransportChannelProvider defaultCloudControlsPartnerCoreTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return CloudControlsPartnerCoreSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return CloudControlsPartnerCoreSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a CloudControlsPartnerCoreSettings bean configured to use a DefaultCredentialsProvider + * and the client library's default transport channel provider + * (defaultCloudControlsPartnerCoreTransportChannelProvider()). 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 CloudControlsPartnerCoreSpringProperties. 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 CloudControlsPartnerCoreSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public CloudControlsPartnerCoreSettings cloudControlsPartnerCoreSettings( + @Qualifier("defaultCloudControlsPartnerCoreTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CloudControlsPartnerCoreSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CloudControlsPartnerCoreSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CloudControlsPartnerCoreSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudControlsPartnerCoreSettings.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 = + CloudControlsPartnerCoreSettings.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 getWorkloadRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkloadSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getWorkloadSettings().setRetrySettings(getWorkloadRetrySettings); + + RetrySettings listWorkloadsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings); + + RetrySettings getCustomerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomerSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getCustomerSettings().setRetrySettings(getCustomerRetrySettings); + + RetrySettings listCustomersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomersSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listCustomersSettings().setRetrySettings(listCustomersRetrySettings); + + RetrySettings getEkmConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEkmConnectionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getEkmConnectionsSettings() + .setRetrySettings(getEkmConnectionsRetrySettings); + + RetrySettings getPartnerPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPartnerPermissionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getPartnerPermissionsSettings() + .setRetrySettings(getPartnerPermissionsRetrySettings); + + RetrySettings listAccessApprovalRequestsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAccessApprovalRequestsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listAccessApprovalRequestsSettings() + .setRetrySettings(listAccessApprovalRequestsRetrySettings); + + RetrySettings getPartnerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPartnerSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPartnerSettings().setRetrySettings(getPartnerRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getWorkloadRetry = clientProperties.getGetWorkloadRetry(); + if (getWorkloadRetry != null) { + RetrySettings getWorkloadRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkloadSettings().getRetrySettings(), getWorkloadRetry); + clientSettingsBuilder.getWorkloadSettings().setRetrySettings(getWorkloadRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getWorkload from properties."); + } + } + Retry listWorkloadsRetry = clientProperties.getListWorkloadsRetry(); + if (listWorkloadsRetry != null) { + RetrySettings listWorkloadsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), listWorkloadsRetry); + clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listWorkloads from properties."); + } + } + Retry getCustomerRetry = clientProperties.getGetCustomerRetry(); + if (getCustomerRetry != null) { + RetrySettings getCustomerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomerSettings().getRetrySettings(), getCustomerRetry); + clientSettingsBuilder.getCustomerSettings().setRetrySettings(getCustomerRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCustomer from properties."); + } + } + Retry listCustomersRetry = clientProperties.getListCustomersRetry(); + if (listCustomersRetry != null) { + RetrySettings listCustomersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomersSettings().getRetrySettings(), listCustomersRetry); + clientSettingsBuilder.listCustomersSettings().setRetrySettings(listCustomersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listCustomers from properties."); + } + } + Retry getEkmConnectionsRetry = clientProperties.getGetEkmConnectionsRetry(); + if (getEkmConnectionsRetry != null) { + RetrySettings getEkmConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEkmConnectionsSettings().getRetrySettings(), + getEkmConnectionsRetry); + clientSettingsBuilder + .getEkmConnectionsSettings() + .setRetrySettings(getEkmConnectionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEkmConnections from properties."); + } + } + Retry getPartnerPermissionsRetry = clientProperties.getGetPartnerPermissionsRetry(); + if (getPartnerPermissionsRetry != null) { + RetrySettings getPartnerPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPartnerPermissionsSettings().getRetrySettings(), + getPartnerPermissionsRetry); + clientSettingsBuilder + .getPartnerPermissionsSettings() + .setRetrySettings(getPartnerPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPartnerPermissions from properties."); + } + } + Retry listAccessApprovalRequestsRetry = clientProperties.getListAccessApprovalRequestsRetry(); + if (listAccessApprovalRequestsRetry != null) { + RetrySettings listAccessApprovalRequestsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAccessApprovalRequestsSettings().getRetrySettings(), + listAccessApprovalRequestsRetry); + clientSettingsBuilder + .listAccessApprovalRequestsSettings() + .setRetrySettings(listAccessApprovalRequestsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAccessApprovalRequests from properties."); + } + } + Retry getPartnerRetry = clientProperties.getGetPartnerRetry(); + if (getPartnerRetry != null) { + RetrySettings getPartnerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPartnerSettings().getRetrySettings(), getPartnerRetry); + clientSettingsBuilder.getPartnerSettings().setRetrySettings(getPartnerRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPartner from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CloudControlsPartnerCoreClient bean configured with + * CloudControlsPartnerCoreSettings. + * + * @param cloudControlsPartnerCoreSettings settings to configure an instance of client bean. + * @return a {@link CloudControlsPartnerCoreClient} bean configured with {@link + * CloudControlsPartnerCoreSettings} + */ + @Bean + @ConditionalOnMissingBean + public CloudControlsPartnerCoreClient cloudControlsPartnerCoreClient( + CloudControlsPartnerCoreSettings cloudControlsPartnerCoreSettings) throws IOException { + return CloudControlsPartnerCoreClient.create(cloudControlsPartnerCoreSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cloud-controls-partner-core"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringProperties.java b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringProperties.java new file mode 100644 index 0000000000..9f2a45dc4a --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerCoreSpringProperties.java @@ -0,0 +1,186 @@ +/* + * 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.cloudcontrolspartner.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 CloudControlsPartnerCore client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-core") +public class CloudControlsPartnerCoreSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getWorkload. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getWorkloadRetry; + /** + * Allow override of retry settings at method-level for listWorkloads. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listWorkloadsRetry; + /** + * Allow override of retry settings at method-level for getCustomer. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCustomerRetry; + /** + * Allow override of retry settings at method-level for listCustomers. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCustomersRetry; + /** + * Allow override of retry settings at method-level for getEkmConnections. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEkmConnectionsRetry; + /** + * Allow override of retry settings at method-level for getPartnerPermissions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPartnerPermissionsRetry; + /** + * Allow override of retry settings at method-level for listAccessApprovalRequests. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAccessApprovalRequestsRetry; + /** + * Allow override of retry settings at method-level for getPartner. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPartnerRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetWorkloadRetry() { + return this.getWorkloadRetry; + } + + public void setGetWorkloadRetry(Retry getWorkloadRetry) { + this.getWorkloadRetry = getWorkloadRetry; + } + + public Retry getListWorkloadsRetry() { + return this.listWorkloadsRetry; + } + + public void setListWorkloadsRetry(Retry listWorkloadsRetry) { + this.listWorkloadsRetry = listWorkloadsRetry; + } + + public Retry getGetCustomerRetry() { + return this.getCustomerRetry; + } + + public void setGetCustomerRetry(Retry getCustomerRetry) { + this.getCustomerRetry = getCustomerRetry; + } + + public Retry getListCustomersRetry() { + return this.listCustomersRetry; + } + + public void setListCustomersRetry(Retry listCustomersRetry) { + this.listCustomersRetry = listCustomersRetry; + } + + public Retry getGetEkmConnectionsRetry() { + return this.getEkmConnectionsRetry; + } + + public void setGetEkmConnectionsRetry(Retry getEkmConnectionsRetry) { + this.getEkmConnectionsRetry = getEkmConnectionsRetry; + } + + public Retry getGetPartnerPermissionsRetry() { + return this.getPartnerPermissionsRetry; + } + + public void setGetPartnerPermissionsRetry(Retry getPartnerPermissionsRetry) { + this.getPartnerPermissionsRetry = getPartnerPermissionsRetry; + } + + public Retry getListAccessApprovalRequestsRetry() { + return this.listAccessApprovalRequestsRetry; + } + + public void setListAccessApprovalRequestsRetry(Retry listAccessApprovalRequestsRetry) { + this.listAccessApprovalRequestsRetry = listAccessApprovalRequestsRetry; + } + + public Retry getGetPartnerRetry() { + return this.getPartnerRetry; + } + + public void setGetPartnerRetry(Retry getPartnerRetry) { + this.getPartnerRetry = getPartnerRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringAutoConfiguration.java new file mode 100644 index 0000000000..502c4b65ff --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringAutoConfiguration.java @@ -0,0 +1,226 @@ +/* + * 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.cloudcontrolspartner.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.cloudcontrolspartner.v1.CloudControlsPartnerMonitoringClient; +import com.google.cloud.cloudcontrolspartner.v1.CloudControlsPartnerMonitoringSettings; +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 CloudControlsPartnerMonitoringClient}. + * + *

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(CloudControlsPartnerMonitoringClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-monitoring.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(CloudControlsPartnerMonitoringSpringProperties.class) +public class CloudControlsPartnerMonitoringSpringAutoConfiguration { + private final CloudControlsPartnerMonitoringSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(CloudControlsPartnerMonitoringSpringAutoConfiguration.class); + + protected CloudControlsPartnerMonitoringSpringAutoConfiguration( + CloudControlsPartnerMonitoringSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Using credentials from CloudControlsPartnerMonitoring-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 = "defaultCloudControlsPartnerMonitoringTransportChannelProvider") + public TransportChannelProvider defaultCloudControlsPartnerMonitoringTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return CloudControlsPartnerMonitoringSettings.defaultHttpJsonTransportProviderBuilder() + .build(); + } + return CloudControlsPartnerMonitoringSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a CloudControlsPartnerMonitoringSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultCloudControlsPartnerMonitoringTransportChannelProvider()). 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 CloudControlsPartnerMonitoringSpringProperties. 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 CloudControlsPartnerMonitoringSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public CloudControlsPartnerMonitoringSettings cloudControlsPartnerMonitoringSettings( + @Qualifier("defaultCloudControlsPartnerMonitoringTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CloudControlsPartnerMonitoringSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CloudControlsPartnerMonitoringSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CloudControlsPartnerMonitoringSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudControlsPartnerMonitoringSettings.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 = + CloudControlsPartnerMonitoringSettings.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 listViolationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listViolationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listViolationsSettings().setRetrySettings(listViolationsRetrySettings); + + RetrySettings getViolationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getViolationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getViolationSettings().setRetrySettings(getViolationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listViolationsRetry = clientProperties.getListViolationsRetry(); + if (listViolationsRetry != null) { + RetrySettings listViolationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listViolationsSettings().getRetrySettings(), + listViolationsRetry); + clientSettingsBuilder.listViolationsSettings().setRetrySettings(listViolationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listViolations from properties."); + } + } + Retry getViolationRetry = clientProperties.getGetViolationRetry(); + if (getViolationRetry != null) { + RetrySettings getViolationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getViolationSettings().getRetrySettings(), getViolationRetry); + clientSettingsBuilder.getViolationSettings().setRetrySettings(getViolationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getViolation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CloudControlsPartnerMonitoringClient bean configured with + * CloudControlsPartnerMonitoringSettings. + * + * @param cloudControlsPartnerMonitoringSettings settings to configure an instance of client bean. + * @return a {@link CloudControlsPartnerMonitoringClient} bean configured with {@link + * CloudControlsPartnerMonitoringSettings} + */ + @Bean + @ConditionalOnMissingBean + public CloudControlsPartnerMonitoringClient cloudControlsPartnerMonitoringClient( + CloudControlsPartnerMonitoringSettings cloudControlsPartnerMonitoringSettings) + throws IOException { + return CloudControlsPartnerMonitoringClient.create(cloudControlsPartnerMonitoringSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cloud-controls-partner-monitoring"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringProperties.java b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringProperties.java new file mode 100644 index 0000000000..4e61928b24 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/CloudControlsPartnerMonitoringSpringProperties.java @@ -0,0 +1,109 @@ +/* + * 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.cloudcontrolspartner.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 CloudControlsPartnerMonitoring client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties( + "com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-monitoring") +public class CloudControlsPartnerMonitoringSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listViolations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listViolationsRetry; + /** + * Allow override of retry settings at method-level for getViolation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getViolationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListViolationsRetry() { + return this.listViolationsRetry; + } + + public void setListViolationsRetry(Retry listViolationsRetry) { + this.listViolationsRetry = listViolationsRetry; + } + + public Retry getGetViolationRetry() { + return this.getViolationRetry; + } + + public void setGetViolationRetry(Retry getViolationRetry) { + this.getViolationRetry = getViolationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/v1/spring/package-info.java new file mode 100644 index 0000000000..1183dda97a --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/java/com/google/cloud/cloudcontrolspartner/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 cloudcontrolspartner. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.cloudcontrolspartner.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..f02f0c52ad --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "name": "com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-core.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud cloudcontrolspartner/CloudControlsPartnerCore components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.cloudcontrolspartner.v1.cloud-controls-partner-monitoring.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud cloudcontrolspartner/CloudControlsPartnerMonitoring components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..2f84d113ed --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudcontrolspartner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.google.cloud.cloudcontrolspartner.v1.spring.CloudControlsPartnerCoreSpringAutoConfiguration +com.google.cloud.cloudcontrolspartner.v1.spring.CloudControlsPartnerMonitoringSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/pom.xml new file mode 100644 index 0000000000..f4a51e3993 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-cloudquotas-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - cloudquotas + Spring Boot Starter with AutoConfiguration for cloudquotas + + + + + com.google.cloud + google-cloud-cloudquotas + + + + 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-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringAutoConfiguration.java new file mode 100644 index 0000000000..58a5aee963 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringAutoConfiguration.java @@ -0,0 +1,305 @@ +/* + * 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.api.cloudquotas.v1.spring; + +import com.google.api.cloudquotas.v1.CloudQuotasClient; +import com.google.api.cloudquotas.v1.CloudQuotasSettings; +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.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 CloudQuotasClient}. + * + *

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(CloudQuotasClient.class) +@ConditionalOnProperty( + value = "com.google.api.cloudquotas.v1.cloud-quotas.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(CloudQuotasSpringProperties.class) +public class CloudQuotasSpringAutoConfiguration { + private final CloudQuotasSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(CloudQuotasSpringAutoConfiguration.class); + + protected CloudQuotasSpringAutoConfiguration( + CloudQuotasSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from CloudQuotas-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 = "defaultCloudQuotasTransportChannelProvider") + public TransportChannelProvider defaultCloudQuotasTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return CloudQuotasSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return CloudQuotasSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a CloudQuotasSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultCloudQuotasTransportChannelProvider()). 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 CloudQuotasSpringProperties. 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 CloudQuotasSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public CloudQuotasSettings cloudQuotasSettings( + @Qualifier("defaultCloudQuotasTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CloudQuotasSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CloudQuotasSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CloudQuotasSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudQuotasSettings.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 = + CloudQuotasSettings.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 listQuotaInfosRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listQuotaInfosSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listQuotaInfosSettings().setRetrySettings(listQuotaInfosRetrySettings); + + RetrySettings getQuotaInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getQuotaInfoSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getQuotaInfoSettings().setRetrySettings(getQuotaInfoRetrySettings); + + RetrySettings listQuotaPreferencesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listQuotaPreferencesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listQuotaPreferencesSettings() + .setRetrySettings(listQuotaPreferencesRetrySettings); + + RetrySettings getQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getQuotaPreferenceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getQuotaPreferenceSettings() + .setRetrySettings(getQuotaPreferenceRetrySettings); + + RetrySettings createQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createQuotaPreferenceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createQuotaPreferenceSettings() + .setRetrySettings(createQuotaPreferenceRetrySettings); + + RetrySettings updateQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateQuotaPreferenceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateQuotaPreferenceSettings() + .setRetrySettings(updateQuotaPreferenceRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listQuotaInfosRetry = clientProperties.getListQuotaInfosRetry(); + if (listQuotaInfosRetry != null) { + RetrySettings listQuotaInfosRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listQuotaInfosSettings().getRetrySettings(), + listQuotaInfosRetry); + clientSettingsBuilder.listQuotaInfosSettings().setRetrySettings(listQuotaInfosRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listQuotaInfos from properties."); + } + } + Retry getQuotaInfoRetry = clientProperties.getGetQuotaInfoRetry(); + if (getQuotaInfoRetry != null) { + RetrySettings getQuotaInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getQuotaInfoSettings().getRetrySettings(), getQuotaInfoRetry); + clientSettingsBuilder.getQuotaInfoSettings().setRetrySettings(getQuotaInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getQuotaInfo from properties."); + } + } + Retry listQuotaPreferencesRetry = clientProperties.getListQuotaPreferencesRetry(); + if (listQuotaPreferencesRetry != null) { + RetrySettings listQuotaPreferencesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listQuotaPreferencesSettings().getRetrySettings(), + listQuotaPreferencesRetry); + clientSettingsBuilder + .listQuotaPreferencesSettings() + .setRetrySettings(listQuotaPreferencesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listQuotaPreferences from properties."); + } + } + Retry getQuotaPreferenceRetry = clientProperties.getGetQuotaPreferenceRetry(); + if (getQuotaPreferenceRetry != null) { + RetrySettings getQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getQuotaPreferenceSettings().getRetrySettings(), + getQuotaPreferenceRetry); + clientSettingsBuilder + .getQuotaPreferenceSettings() + .setRetrySettings(getQuotaPreferenceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getQuotaPreference from properties."); + } + } + Retry createQuotaPreferenceRetry = clientProperties.getCreateQuotaPreferenceRetry(); + if (createQuotaPreferenceRetry != null) { + RetrySettings createQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createQuotaPreferenceSettings().getRetrySettings(), + createQuotaPreferenceRetry); + clientSettingsBuilder + .createQuotaPreferenceSettings() + .setRetrySettings(createQuotaPreferenceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createQuotaPreference from properties."); + } + } + Retry updateQuotaPreferenceRetry = clientProperties.getUpdateQuotaPreferenceRetry(); + if (updateQuotaPreferenceRetry != null) { + RetrySettings updateQuotaPreferenceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateQuotaPreferenceSettings().getRetrySettings(), + updateQuotaPreferenceRetry); + clientSettingsBuilder + .updateQuotaPreferenceSettings() + .setRetrySettings(updateQuotaPreferenceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateQuotaPreference from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CloudQuotasClient bean configured with CloudQuotasSettings. + * + * @param cloudQuotasSettings settings to configure an instance of client bean. + * @return a {@link CloudQuotasClient} bean configured with {@link CloudQuotasSettings} + */ + @Bean + @ConditionalOnMissingBean + public CloudQuotasClient cloudQuotasClient(CloudQuotasSettings cloudQuotasSettings) + throws IOException { + return CloudQuotasClient.create(cloudQuotasSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cloud-quotas"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringProperties.java b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringProperties.java new file mode 100644 index 0000000000..804fc38ca3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/CloudQuotasSpringProperties.java @@ -0,0 +1,160 @@ +/* + * 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.api.cloudquotas.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 CloudQuotas client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.api.cloudquotas.v1.cloud-quotas") +public class CloudQuotasSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listQuotaInfos. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listQuotaInfosRetry; + /** + * Allow override of retry settings at method-level for getQuotaInfo. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getQuotaInfoRetry; + /** + * Allow override of retry settings at method-level for listQuotaPreferences. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listQuotaPreferencesRetry; + /** + * Allow override of retry settings at method-level for getQuotaPreference. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getQuotaPreferenceRetry; + /** + * Allow override of retry settings at method-level for createQuotaPreference. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createQuotaPreferenceRetry; + /** + * Allow override of retry settings at method-level for updateQuotaPreference. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateQuotaPreferenceRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListQuotaInfosRetry() { + return this.listQuotaInfosRetry; + } + + public void setListQuotaInfosRetry(Retry listQuotaInfosRetry) { + this.listQuotaInfosRetry = listQuotaInfosRetry; + } + + public Retry getGetQuotaInfoRetry() { + return this.getQuotaInfoRetry; + } + + public void setGetQuotaInfoRetry(Retry getQuotaInfoRetry) { + this.getQuotaInfoRetry = getQuotaInfoRetry; + } + + public Retry getListQuotaPreferencesRetry() { + return this.listQuotaPreferencesRetry; + } + + public void setListQuotaPreferencesRetry(Retry listQuotaPreferencesRetry) { + this.listQuotaPreferencesRetry = listQuotaPreferencesRetry; + } + + public Retry getGetQuotaPreferenceRetry() { + return this.getQuotaPreferenceRetry; + } + + public void setGetQuotaPreferenceRetry(Retry getQuotaPreferenceRetry) { + this.getQuotaPreferenceRetry = getQuotaPreferenceRetry; + } + + public Retry getCreateQuotaPreferenceRetry() { + return this.createQuotaPreferenceRetry; + } + + public void setCreateQuotaPreferenceRetry(Retry createQuotaPreferenceRetry) { + this.createQuotaPreferenceRetry = createQuotaPreferenceRetry; + } + + public Retry getUpdateQuotaPreferenceRetry() { + return this.updateQuotaPreferenceRetry; + } + + public void setUpdateQuotaPreferenceRetry(Retry updateQuotaPreferenceRetry) { + this.updateQuotaPreferenceRetry = updateQuotaPreferenceRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/v1/spring/package-info.java new file mode 100644 index 0000000000..2e4d87fc3f --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/java/com/google/api/cloudquotas/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 cloudquotas. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.api.cloudquotas.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..a9de4ff7c2 --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.api.cloudquotas.v1.cloud-quotas.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud cloudquotas/CloudQuotas components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..321970b98f --- /dev/null +++ b/spring-cloud-previews/google-cloud-cloudquotas-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.api.cloudquotas.v1.spring.CloudQuotasSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AcceleratorTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AcceleratorTypesSpringAutoConfiguration.java index 21398582ea..911077eadc 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AcceleratorTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AcceleratorTypesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public AcceleratorTypesSettings acceleratorTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AcceleratorTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AddressesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AddressesSpringAutoConfiguration.java index 80878eac2f..8657a25496 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AddressesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AddressesSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public AddressesSettings addressesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AddressesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AutoscalersSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AutoscalersSpringAutoConfiguration.java index 3940dada64..eb45f05483 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AutoscalersSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/AutoscalersSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public AutoscalersSettings autoscalersSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AutoscalersSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringAutoConfiguration.java index 08dc87b165..3b17cdf001 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public BackendBucketsSettings backendBucketsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BackendBucketsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringAutoConfiguration.java index 7f6fd67162..46ad5a4af1 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public BackendServicesSettings backendServicesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BackendServicesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DiskTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DiskTypesSpringAutoConfiguration.java index 553a6fd50e..0f0c4ae5a0 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DiskTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DiskTypesSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public DiskTypesSettings diskTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DiskTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DisksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DisksSpringAutoConfiguration.java index 4132e2dde0..9da36e09fa 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DisksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/DisksSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public DisksSettings disksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DisksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ExternalVpnGatewaysSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ExternalVpnGatewaysSpringAutoConfiguration.java index 5c03a34306..ac0501b5c1 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ExternalVpnGatewaysSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ExternalVpnGatewaysSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public ExternalVpnGatewaysSettings externalVpnGatewaysSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ExternalVpnGatewaysSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallPoliciesSpringAutoConfiguration.java index 356c64051f..ada83770f8 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallPoliciesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public FirewallPoliciesSettings firewallPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FirewallPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallsSpringAutoConfiguration.java index 79fca5f63b..bfc76b19d5 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/FirewallsSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public FirewallsSettings firewallsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FirewallsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ForwardingRulesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ForwardingRulesSpringAutoConfiguration.java index d6948e2ddf..649c2ed8f1 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ForwardingRulesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ForwardingRulesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public ForwardingRulesSettings forwardingRulesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ForwardingRulesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalAddressesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalAddressesSpringAutoConfiguration.java index 9327d5c2f9..1ac64027a7 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalAddressesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalAddressesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public GlobalAddressesSettings globalAddressesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalAddressesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalForwardingRulesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalForwardingRulesSpringAutoConfiguration.java index 356a5888b9..a3a6e9f3b9 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalForwardingRulesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalForwardingRulesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public GlobalForwardingRulesSettings globalForwardingRulesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalForwardingRulesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalNetworkEndpointGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalNetworkEndpointGroupsSpringAutoConfiguration.java index ef128a6308..7648a7ee65 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalNetworkEndpointGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalNetworkEndpointGroupsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public GlobalNetworkEndpointGroupsSettings globalNetworkEndpointGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalNetworkEndpointGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOperationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOperationsSpringAutoConfiguration.java index 8df7ef1da6..9995b9ad85 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOperationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOperationsSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public GlobalOperationsSettings globalOperationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalOperationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOrganizationOperationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOrganizationOperationsSpringAutoConfiguration.java index c85382a6d6..a51ae910df 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOrganizationOperationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalOrganizationOperationsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public GlobalOrganizationOperationsSettings globalOrganizationOperationsSettings clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalOrganizationOperationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalPublicDelegatedPrefixesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalPublicDelegatedPrefixesSpringAutoConfiguration.java index 392d5e2baa..da1f7820d9 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalPublicDelegatedPrefixesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/GlobalPublicDelegatedPrefixesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public GlobalPublicDelegatedPrefixesSettings globalPublicDelegatedPrefixesSettin clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GlobalPublicDelegatedPrefixesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/HealthChecksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/HealthChecksSpringAutoConfiguration.java index 1dd5e87ac7..037c9a7e4a 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/HealthChecksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/HealthChecksSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public HealthChecksSettings healthChecksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(HealthChecksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImageFamilyViewsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImageFamilyViewsSpringAutoConfiguration.java index 4a5ff0c677..ba637f0bcb 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImageFamilyViewsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImageFamilyViewsSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public ImageFamilyViewsSettings imageFamilyViewsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ImageFamilyViewsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImagesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImagesSpringAutoConfiguration.java index f23e090339..52c7531c02 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImagesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ImagesSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public ImagesSettings imagesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ImagesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagerResizeRequestsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagerResizeRequestsSpringAutoConfiguration.java index 660e96560a..c1b964c33e 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagerResizeRequestsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagerResizeRequestsSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public InstanceGroupManagerResizeRequestsSettings instanceGroupManagerResizeRequ clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstanceGroupManagerResizeRequestsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagersSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagersSpringAutoConfiguration.java index 7765486bab..d247897e60 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagersSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupManagersSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public InstanceGroupManagersSettings instanceGroupManagersSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstanceGroupManagersSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupsSpringAutoConfiguration.java index 125bf21643..dc88d14df8 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceGroupsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public InstanceGroupsSettings instanceGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstanceGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceSettingsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceSettingsServiceSpringAutoConfiguration.java index 2c4cc35df4..2131f41539 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceSettingsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceSettingsServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public InstanceSettingsServiceSettings instanceSettingsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstanceSettingsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceTemplatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceTemplatesSpringAutoConfiguration.java index 725fc2a4a1..a511ca4e34 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceTemplatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstanceTemplatesSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public InstanceTemplatesSettings instanceTemplatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstanceTemplatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstancesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstancesSpringAutoConfiguration.java index 97af966f1c..ae4678f93b 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstancesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstancesSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public InstancesSettings instancesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstancesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstantSnapshotsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstantSnapshotsSpringAutoConfiguration.java index 0aee7de9ea..a25b13f20b 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstantSnapshotsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InstantSnapshotsSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public InstantSnapshotsSettings instantSnapshotsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InstantSnapshotsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectAttachmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectAttachmentsSpringAutoConfiguration.java index 2654f9ced6..21d295909b 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectAttachmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectAttachmentsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public InterconnectAttachmentsSettings interconnectAttachmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InterconnectAttachmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectLocationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectLocationsSpringAutoConfiguration.java index 5c39e485d2..95c3ed2054 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectLocationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectLocationsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public InterconnectLocationsSettings interconnectLocationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InterconnectLocationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectRemoteLocationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectRemoteLocationsSpringAutoConfiguration.java index d188c37604..0e9ba86fb3 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectRemoteLocationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectRemoteLocationsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public InterconnectRemoteLocationsSettings interconnectRemoteLocationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InterconnectRemoteLocationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringAutoConfiguration.java index 552bd9d400..004fa88c62 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public InterconnectsSettings interconnectsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(InterconnectsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicenseCodesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicenseCodesSpringAutoConfiguration.java index acb82816fc..6ecff03460 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicenseCodesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicenseCodesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public LicenseCodesSettings licenseCodesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LicenseCodesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicensesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicensesSpringAutoConfiguration.java index 0685e208b9..fa69bcb890 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicensesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/LicensesSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public LicensesSettings licensesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LicensesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineImagesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineImagesSpringAutoConfiguration.java index d92ed1fd74..67eff04a19 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineImagesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineImagesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public MachineImagesSettings machineImagesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MachineImagesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineTypesSpringAutoConfiguration.java index cf5021a33a..4a00284efe 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/MachineTypesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public MachineTypesSettings machineTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MachineTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkAttachmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkAttachmentsSpringAutoConfiguration.java index a87a395663..9c90397194 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkAttachmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkAttachmentsSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public NetworkAttachmentsSettings networkAttachmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkAttachmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEdgeSecurityServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEdgeSecurityServicesSpringAutoConfiguration.java index 982f099944..cd771f7022 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEdgeSecurityServicesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEdgeSecurityServicesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public NetworkEdgeSecurityServicesSettings networkEdgeSecurityServicesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkEdgeSecurityServicesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEndpointGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEndpointGroupsSpringAutoConfiguration.java index 7484b74604..3f44ea8b42 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEndpointGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkEndpointGroupsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public NetworkEndpointGroupsSettings networkEndpointGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkEndpointGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkFirewallPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkFirewallPoliciesSpringAutoConfiguration.java index dd9ca429b3..612d06d538 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkFirewallPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworkFirewallPoliciesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public NetworkFirewallPoliciesSettings networkFirewallPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkFirewallPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworksSpringAutoConfiguration.java index 36f1361591..77c9bbec7f 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NetworksSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public NetworksSettings networksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeGroupsSpringAutoConfiguration.java index 022fe3915b..368651647d 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeGroupsSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public NodeGroupsSettings nodeGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NodeGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTemplatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTemplatesSpringAutoConfiguration.java index 800666c80a..bda99d7c00 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTemplatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTemplatesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public NodeTemplatesSettings nodeTemplatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NodeTemplatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTypesSpringAutoConfiguration.java index 092116f0f9..7c04d37c06 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/NodeTypesSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public NodeTypesSettings nodeTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NodeTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PacketMirroringsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PacketMirroringsSpringAutoConfiguration.java index f353686ef3..e1479e186d 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PacketMirroringsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PacketMirroringsSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public PacketMirroringsSettings packetMirroringsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PacketMirroringsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ProjectsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ProjectsSpringAutoConfiguration.java index 30adb822ca..6259663065 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ProjectsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ProjectsSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public ProjectsSettings projectsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ProjectsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicAdvertisedPrefixesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicAdvertisedPrefixesSpringAutoConfiguration.java index 50f01d07c7..9935b79ef2 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicAdvertisedPrefixesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicAdvertisedPrefixesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public PublicAdvertisedPrefixesSettings publicAdvertisedPrefixesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PublicAdvertisedPrefixesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicDelegatedPrefixesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicDelegatedPrefixesSpringAutoConfiguration.java index e1881f50ca..245288b95e 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicDelegatedPrefixesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/PublicDelegatedPrefixesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public PublicDelegatedPrefixesSettings publicDelegatedPrefixesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PublicDelegatedPrefixesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionAutoscalersSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionAutoscalersSpringAutoConfiguration.java index 5b6157ed97..e79fa5a486 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionAutoscalersSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionAutoscalersSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public RegionAutoscalersSettings regionAutoscalersSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionAutoscalersSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringAutoConfiguration.java index 8a69fd9eb9..6ee8bb5818 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionBackendServicesSettings regionBackendServicesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionBackendServicesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionCommitmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionCommitmentsSpringAutoConfiguration.java index 20ca7f3b58..b6ababb51f 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionCommitmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionCommitmentsSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public RegionCommitmentsSettings regionCommitmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionCommitmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDiskTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDiskTypesSpringAutoConfiguration.java index 01e488ce19..3a2e8c4048 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDiskTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDiskTypesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public RegionDiskTypesSettings regionDiskTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionDiskTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDisksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDisksSpringAutoConfiguration.java index 424a0d1d4d..b3b833b51c 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDisksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionDisksSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public RegionDisksSettings regionDisksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionDisksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthCheckServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthCheckServicesSpringAutoConfiguration.java index eaacf50380..bd17bcae95 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthCheckServicesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthCheckServicesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionHealthCheckServicesSettings regionHealthCheckServicesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionHealthCheckServicesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthChecksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthChecksSpringAutoConfiguration.java index a0cd7a47d2..2b33cd0e45 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthChecksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionHealthChecksSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public RegionHealthChecksSettings regionHealthChecksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionHealthChecksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupManagersSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupManagersSpringAutoConfiguration.java index ca45519e8e..d70aef9428 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupManagersSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupManagersSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionInstanceGroupManagersSettings regionInstanceGroupManagersSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionInstanceGroupManagersSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupsSpringAutoConfiguration.java index 959d3e2ec0..262e06fd07 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceGroupsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionInstanceGroupsSettings regionInstanceGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionInstanceGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceTemplatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceTemplatesSpringAutoConfiguration.java index f0a1d00259..b11533b6ed 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceTemplatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstanceTemplatesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionInstanceTemplatesSettings regionInstanceTemplatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionInstanceTemplatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstancesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstancesSpringAutoConfiguration.java index d081ce5358..3d4ca179fd 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstancesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstancesSpringAutoConfiguration.java @@ -122,6 +122,7 @@ public RegionInstancesSettings regionInstancesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionInstancesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstantSnapshotsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstantSnapshotsSpringAutoConfiguration.java index affd14d799..879c212664 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstantSnapshotsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionInstantSnapshotsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionInstantSnapshotsSettings regionInstantSnapshotsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionInstantSnapshotsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringAutoConfiguration.java index 412af10cf3..60272fd1c9 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionNetworkEndpointGroupsSettings regionNetworkEndpointGroupsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionNetworkEndpointGroupsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkFirewallPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkFirewallPoliciesSpringAutoConfiguration.java index 1db587c8b5..765d981a4e 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkFirewallPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkFirewallPoliciesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionNetworkFirewallPoliciesSettings regionNetworkFirewallPoliciesSettin clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionNetworkFirewallPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNotificationEndpointsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNotificationEndpointsSpringAutoConfiguration.java index d21733ffec..4ce95c29b4 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNotificationEndpointsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNotificationEndpointsSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionNotificationEndpointsSettings regionNotificationEndpointsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionNotificationEndpointsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionOperationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionOperationsSpringAutoConfiguration.java index 1783769b80..75d9fbe380 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionOperationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionOperationsSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public RegionOperationsSettings regionOperationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionOperationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringAutoConfiguration.java index 9d0a7f0023..e247b29454 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionSecurityPoliciesSettings regionSecurityPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionSecurityPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslCertificatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslCertificatesSpringAutoConfiguration.java index e77976ffb4..2c4f70db87 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslCertificatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslCertificatesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionSslCertificatesSettings regionSslCertificatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionSslCertificatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslPoliciesSpringAutoConfiguration.java index a94a1fd465..888625b626 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSslPoliciesSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public RegionSslPoliciesSettings regionSslPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionSslPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpProxiesSpringAutoConfiguration.java index 7308c8abe6..ffaf98b81c 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpProxiesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionTargetHttpProxiesSettings regionTargetHttpProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionTargetHttpProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpsProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpsProxiesSpringAutoConfiguration.java index e64c544950..2f04eaf702 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpsProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetHttpsProxiesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionTargetHttpsProxiesSettings regionTargetHttpsProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionTargetHttpsProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetTcpProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetTcpProxiesSpringAutoConfiguration.java index f0ffb53630..f539c4d427 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetTcpProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionTargetTcpProxiesSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RegionTargetTcpProxiesSettings regionTargetTcpProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionTargetTcpProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionUrlMapsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionUrlMapsSpringAutoConfiguration.java index f62a138259..f214c24d4a 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionUrlMapsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionUrlMapsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public RegionUrlMapsSettings regionUrlMapsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionUrlMapsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionZonesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionZonesSpringAutoConfiguration.java index 432ac8c13e..52e2a4a403 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionZonesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionZonesSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public RegionZonesSettings regionZonesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionZonesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionsSpringAutoConfiguration.java index 1cdf4130c8..698329fada 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionsSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public RegionsSettings regionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ReservationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ReservationsSpringAutoConfiguration.java index a562fd7690..280d48bda2 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ReservationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ReservationsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public ReservationsSettings reservationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ReservationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ResourcePoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ResourcePoliciesSpringAutoConfiguration.java index c6e7cbb591..a21de57233 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ResourcePoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ResourcePoliciesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public ResourcePoliciesSettings resourcePoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ResourcePoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringAutoConfiguration.java index b02ac954cf..58a5e72647 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public RoutersSettings routersSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RoutersSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutesSpringAutoConfiguration.java index f447c2ab2b..fd421dbc2c 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutesSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public RoutesSettings routesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RoutesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SecurityPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SecurityPoliciesSpringAutoConfiguration.java index b73b99c7bd..122eabc2e4 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SecurityPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SecurityPoliciesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public SecurityPoliciesSettings securityPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SecurityPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ServiceAttachmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ServiceAttachmentsSpringAutoConfiguration.java index 9a57904eb7..85c0e4e62a 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ServiceAttachmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ServiceAttachmentsSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public ServiceAttachmentsSettings serviceAttachmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServiceAttachmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java index a3940b296c..12d72311ec 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public SnapshotSettingsServiceSettings snapshotSettingsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SnapshotSettingsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotsSpringAutoConfiguration.java index d5bcf2660d..9fb1efc26b 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotsSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public SnapshotsSettings snapshotsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SnapshotsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslCertificatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslCertificatesSpringAutoConfiguration.java index 16111d236a..ee5833c83f 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslCertificatesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslCertificatesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public SslCertificatesSettings sslCertificatesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SslCertificatesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslPoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslPoliciesSpringAutoConfiguration.java index 1bd21d5d2d..62bcc017fc 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslPoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SslPoliciesSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public SslPoliciesSettings sslPoliciesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SslPoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolTypesSpringAutoConfiguration.java index 7d7c18a66a..3eeb8ff3e5 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolTypesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public StoragePoolTypesSettings storagePoolTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(StoragePoolTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolsSpringAutoConfiguration.java index 9a7e49723b..7affad7f60 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/StoragePoolsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public StoragePoolsSettings storagePoolsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(StoragePoolsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SubnetworksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SubnetworksSpringAutoConfiguration.java index f22737b991..102b3c08e9 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SubnetworksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SubnetworksSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public SubnetworksSettings subnetworksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SubnetworksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetGrpcProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetGrpcProxiesSpringAutoConfiguration.java index 50b562b0aa..6da8932291 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetGrpcProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetGrpcProxiesSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public TargetGrpcProxiesSettings targetGrpcProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetGrpcProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpProxiesSpringAutoConfiguration.java index 0b18168e28..52e54968be 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpProxiesSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public TargetHttpProxiesSettings targetHttpProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetHttpProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpsProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpsProxiesSpringAutoConfiguration.java index e0e61e67f4..2c68919eb5 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpsProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetHttpsProxiesSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public TargetHttpsProxiesSettings targetHttpsProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetHttpsProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetInstancesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetInstancesSpringAutoConfiguration.java index 8321e64bdd..2df2da4b4c 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetInstancesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetInstancesSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public TargetInstancesSettings targetInstancesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetInstancesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetPoolsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetPoolsSpringAutoConfiguration.java index 4149a60f7a..67866e5026 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetPoolsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetPoolsSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public TargetPoolsSettings targetPoolsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetPoolsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetSslProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetSslProxiesSpringAutoConfiguration.java index 1c17b5f80e..ec062f577b 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetSslProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetSslProxiesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public TargetSslProxiesSettings targetSslProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetSslProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetTcpProxiesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetTcpProxiesSpringAutoConfiguration.java index 02717a2da6..1e61a8e00d 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetTcpProxiesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetTcpProxiesSpringAutoConfiguration.java @@ -125,6 +125,7 @@ public TargetTcpProxiesSettings targetTcpProxiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetTcpProxiesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetVpnGatewaysSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetVpnGatewaysSpringAutoConfiguration.java index 66a031e761..858b654aa4 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetVpnGatewaysSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/TargetVpnGatewaysSpringAutoConfiguration.java @@ -126,6 +126,7 @@ public TargetVpnGatewaysSettings targetVpnGatewaysSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TargetVpnGatewaysSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/UrlMapsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/UrlMapsSpringAutoConfiguration.java index 901fcfe20a..cfe0fb801c 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/UrlMapsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/UrlMapsSpringAutoConfiguration.java @@ -121,6 +121,7 @@ public UrlMapsSettings urlMapsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(UrlMapsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnGatewaysSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnGatewaysSpringAutoConfiguration.java index 6117ddb5ca..bf73f3d710 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnGatewaysSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnGatewaysSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public VpnGatewaysSettings vpnGatewaysSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VpnGatewaysSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnTunnelsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnTunnelsSpringAutoConfiguration.java index 14937b3ad4..0291ed0696 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnTunnelsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/VpnTunnelsSpringAutoConfiguration.java @@ -123,6 +123,7 @@ public VpnTunnelsSettings vpnTunnelsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VpnTunnelsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZoneOperationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZoneOperationsSpringAutoConfiguration.java index e1534f1783..c2ff87aa3d 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZoneOperationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZoneOperationsSpringAutoConfiguration.java @@ -124,6 +124,7 @@ public ZoneOperationsSettings zoneOperationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ZoneOperationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZonesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZonesSpringAutoConfiguration.java index e4df114149..60f04312c6 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZonesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/ZonesSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public ZonesSettings zonesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ZonesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java index 1576be4f8d..ac89975e25 100644 --- a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public ContactCenterInsightsSettings contactCenterInsightsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ContactCenterInsightsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringAutoConfiguration.java index 13ad0e52f1..9dc9555d0c 100644 --- a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringAutoConfiguration.java @@ -96,6 +96,9 @@ protected ClusterManagerSpringAutoConfiguration( @Bean @ConditionalOnMissingBean(name = "defaultClusterManagerTransportChannelProvider") public TransportChannelProvider defaultClusterManagerTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ClusterManagerSettings.defaultHttpJsonTransportProviderBuilder().build(); + } return ClusterManagerSettings.defaultTransportChannelProvider(); } @@ -120,10 +123,19 @@ public ClusterManagerSettings clusterManagerSettings( @Qualifier("defaultClusterManagerTransportChannelProvider") TransportChannelProvider defaultTransportChannelProvider) throws IOException { - ClusterManagerSettings.Builder clientSettingsBuilder = ClusterManagerSettings.newBuilder(); + ClusterManagerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ClusterManagerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ClusterManagerSettings.newBuilder(); + } clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ClusterManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java index cd1894a1f9..92410552de 100644 --- a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java +++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java @@ -38,6 +38,8 @@ public class ClusterManagerSpringProperties implements CredentialsSupplier { private String quotaProjectId; /** Number of threads used for executors. */ private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; /** Allow override of retry settings at service level, applying to all of its RPC methods. */ @NestedConfigurationProperty private Retry retry; /** @@ -224,6 +226,14 @@ public void setQuotaProjectId(String quotaProjectId) { this.quotaProjectId = quotaProjectId; } + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + public Integer getExecutorThreadCount() { return this.executorThreadCount; } diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringAutoConfiguration.java index ff368012fd..2d70226fcb 100644 --- a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ContainerAnalysisSettings containerAnalysisSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ContainerAnalysisSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringAutoConfiguration.java index 3eeb20aa04..f59119cbc1 100644 --- a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public DataFusionSettings dataFusionSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataFusionSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); 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 a2d415e16e..87fb247491 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 @@ -134,6 +134,7 @@ public DataCatalogSettings dataCatalogSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataCatalogSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java index 4ca6bde590..02ef47ce55 100644 --- a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java @@ -138,6 +138,7 @@ public PolicyTagManagerSerializationSettings policyTagManagerSerializationSettin clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PolicyTagManagerSerializationSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java index 7c4254e3df..f9aca75d55 100644 --- a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public PolicyTagManagerSettings policyTagManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PolicyTagManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-datalineage-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-datalineage-spring-starter/pom.xml new file mode 100644 index 0000000000..5d3baadc1e --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-datalineage-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - datalineage + Spring Boot Starter with AutoConfiguration for datalineage + + + + + com.google.cloud + google-cloud-datalineage + + + + 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-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringAutoConfiguration.java new file mode 100644 index 0000000000..1d8dedbd67 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringAutoConfiguration.java @@ -0,0 +1,446 @@ +/* + * 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.datacatalog.lineage.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.datacatalog.lineage.v1.LineageClient; +import com.google.cloud.datacatalog.lineage.v1.LineageSettings; +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 LineageClient}. + * + *

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(LineageClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.datacatalog.lineage.v1.lineage.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(LineageSpringProperties.class) +public class LineageSpringAutoConfiguration { + private final LineageSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(LineageSpringAutoConfiguration.class); + + protected LineageSpringAutoConfiguration( + LineageSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from Lineage-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 = "defaultLineageTransportChannelProvider") + public TransportChannelProvider defaultLineageTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return LineageSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return LineageSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a LineageSettings bean configured to use a DefaultCredentialsProvider and the client + * library's default transport channel provider (defaultLineageTransportChannelProvider()). 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 LineageSpringProperties. 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 LineageSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public LineageSettings lineageSettings( + @Qualifier("defaultLineageTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + LineageSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = LineageSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = LineageSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LineageSettings.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 = + LineageSettings.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 processOpenLineageRunEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.processOpenLineageRunEventSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .processOpenLineageRunEventSettings() + .setRetrySettings(processOpenLineageRunEventRetrySettings); + + RetrySettings createProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createProcessSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createProcessSettings().setRetrySettings(createProcessRetrySettings); + + RetrySettings updateProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProcessSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateProcessSettings().setRetrySettings(updateProcessRetrySettings); + + RetrySettings getProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProcessSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getProcessSettings().setRetrySettings(getProcessRetrySettings); + + RetrySettings listProcessesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProcessesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listProcessesSettings().setRetrySettings(listProcessesRetrySettings); + + RetrySettings createRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createRunSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createRunSettings().setRetrySettings(createRunRetrySettings); + + RetrySettings updateRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateRunSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateRunSettings().setRetrySettings(updateRunRetrySettings); + + RetrySettings getRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRunSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRunSettings().setRetrySettings(getRunRetrySettings); + + RetrySettings listRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRunsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRunsSettings().setRetrySettings(listRunsRetrySettings); + + RetrySettings createLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createLineageEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createLineageEventSettings() + .setRetrySettings(createLineageEventRetrySettings); + + RetrySettings getLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLineageEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getLineageEventSettings() + .setRetrySettings(getLineageEventRetrySettings); + + RetrySettings listLineageEventsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLineageEventsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listLineageEventsSettings() + .setRetrySettings(listLineageEventsRetrySettings); + + RetrySettings deleteLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteLineageEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteLineageEventSettings() + .setRetrySettings(deleteLineageEventRetrySettings); + + RetrySettings searchLinksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchLinksSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchLinksSettings().setRetrySettings(searchLinksRetrySettings); + + RetrySettings batchSearchLinkProcessesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchSearchLinkProcessesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchSearchLinkProcessesSettings() + .setRetrySettings(batchSearchLinkProcessesRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry processOpenLineageRunEventRetry = clientProperties.getProcessOpenLineageRunEventRetry(); + if (processOpenLineageRunEventRetry != null) { + RetrySettings processOpenLineageRunEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.processOpenLineageRunEventSettings().getRetrySettings(), + processOpenLineageRunEventRetry); + clientSettingsBuilder + .processOpenLineageRunEventSettings() + .setRetrySettings(processOpenLineageRunEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for processOpenLineageRunEvent from properties."); + } + } + Retry createProcessRetry = clientProperties.getCreateProcessRetry(); + if (createProcessRetry != null) { + RetrySettings createProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createProcessSettings().getRetrySettings(), createProcessRetry); + clientSettingsBuilder.createProcessSettings().setRetrySettings(createProcessRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createProcess from properties."); + } + } + Retry updateProcessRetry = clientProperties.getUpdateProcessRetry(); + if (updateProcessRetry != null) { + RetrySettings updateProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProcessSettings().getRetrySettings(), updateProcessRetry); + clientSettingsBuilder.updateProcessSettings().setRetrySettings(updateProcessRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateProcess from properties."); + } + } + Retry getProcessRetry = clientProperties.getGetProcessRetry(); + if (getProcessRetry != null) { + RetrySettings getProcessRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProcessSettings().getRetrySettings(), getProcessRetry); + clientSettingsBuilder.getProcessSettings().setRetrySettings(getProcessRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getProcess from properties."); + } + } + Retry listProcessesRetry = clientProperties.getListProcessesRetry(); + if (listProcessesRetry != null) { + RetrySettings listProcessesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProcessesSettings().getRetrySettings(), listProcessesRetry); + clientSettingsBuilder.listProcessesSettings().setRetrySettings(listProcessesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listProcesses from properties."); + } + } + Retry createRunRetry = clientProperties.getCreateRunRetry(); + if (createRunRetry != null) { + RetrySettings createRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createRunSettings().getRetrySettings(), createRunRetry); + clientSettingsBuilder.createRunSettings().setRetrySettings(createRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createRun from properties."); + } + } + Retry updateRunRetry = clientProperties.getUpdateRunRetry(); + if (updateRunRetry != null) { + RetrySettings updateRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateRunSettings().getRetrySettings(), updateRunRetry); + clientSettingsBuilder.updateRunSettings().setRetrySettings(updateRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateRun from properties."); + } + } + Retry getRunRetry = clientProperties.getGetRunRetry(); + if (getRunRetry != null) { + RetrySettings getRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRunSettings().getRetrySettings(), getRunRetry); + clientSettingsBuilder.getRunSettings().setRetrySettings(getRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRun from properties."); + } + } + Retry listRunsRetry = clientProperties.getListRunsRetry(); + if (listRunsRetry != null) { + RetrySettings listRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRunsSettings().getRetrySettings(), listRunsRetry); + clientSettingsBuilder.listRunsSettings().setRetrySettings(listRunsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRuns from properties."); + } + } + Retry createLineageEventRetry = clientProperties.getCreateLineageEventRetry(); + if (createLineageEventRetry != null) { + RetrySettings createLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createLineageEventSettings().getRetrySettings(), + createLineageEventRetry); + clientSettingsBuilder + .createLineageEventSettings() + .setRetrySettings(createLineageEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createLineageEvent from properties."); + } + } + Retry getLineageEventRetry = clientProperties.getGetLineageEventRetry(); + if (getLineageEventRetry != null) { + RetrySettings getLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLineageEventSettings().getRetrySettings(), + getLineageEventRetry); + clientSettingsBuilder + .getLineageEventSettings() + .setRetrySettings(getLineageEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLineageEvent from properties."); + } + } + Retry listLineageEventsRetry = clientProperties.getListLineageEventsRetry(); + if (listLineageEventsRetry != null) { + RetrySettings listLineageEventsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLineageEventsSettings().getRetrySettings(), + listLineageEventsRetry); + clientSettingsBuilder + .listLineageEventsSettings() + .setRetrySettings(listLineageEventsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listLineageEvents from properties."); + } + } + Retry deleteLineageEventRetry = clientProperties.getDeleteLineageEventRetry(); + if (deleteLineageEventRetry != null) { + RetrySettings deleteLineageEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteLineageEventSettings().getRetrySettings(), + deleteLineageEventRetry); + clientSettingsBuilder + .deleteLineageEventSettings() + .setRetrySettings(deleteLineageEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteLineageEvent from properties."); + } + } + Retry searchLinksRetry = clientProperties.getSearchLinksRetry(); + if (searchLinksRetry != null) { + RetrySettings searchLinksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchLinksSettings().getRetrySettings(), searchLinksRetry); + clientSettingsBuilder.searchLinksSettings().setRetrySettings(searchLinksRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchLinks from properties."); + } + } + Retry batchSearchLinkProcessesRetry = clientProperties.getBatchSearchLinkProcessesRetry(); + if (batchSearchLinkProcessesRetry != null) { + RetrySettings batchSearchLinkProcessesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchSearchLinkProcessesSettings().getRetrySettings(), + batchSearchLinkProcessesRetry); + clientSettingsBuilder + .batchSearchLinkProcessesSettings() + .setRetrySettings(batchSearchLinkProcessesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchSearchLinkProcesses from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a LineageClient bean configured with LineageSettings. + * + * @param lineageSettings settings to configure an instance of client bean. + * @return a {@link LineageClient} bean configured with {@link LineageSettings} + */ + @Bean + @ConditionalOnMissingBean + public LineageClient lineageClient(LineageSettings lineageSettings) throws IOException { + return LineageClient.create(lineageSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-lineage"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringProperties.java b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringProperties.java new file mode 100644 index 0000000000..60ceedf437 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/LineageSpringProperties.java @@ -0,0 +1,277 @@ +/* + * 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.datacatalog.lineage.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 Lineage client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.datacatalog.lineage.v1.lineage") +public class LineageSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 processOpenLineageRunEvent. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry processOpenLineageRunEventRetry; + /** + * Allow override of retry settings at method-level for createProcess. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createProcessRetry; + /** + * Allow override of retry settings at method-level for updateProcess. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateProcessRetry; + /** + * Allow override of retry settings at method-level for getProcess. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getProcessRetry; + /** + * Allow override of retry settings at method-level for listProcesses. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listProcessesRetry; + /** + * Allow override of retry settings at method-level for createRun. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createRunRetry; + /** + * Allow override of retry settings at method-level for updateRun. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateRunRetry; + /** + * Allow override of retry settings at method-level for getRun. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRunRetry; + /** + * Allow override of retry settings at method-level for listRuns. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRunsRetry; + /** + * Allow override of retry settings at method-level for createLineageEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createLineageEventRetry; + /** + * Allow override of retry settings at method-level for getLineageEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLineageEventRetry; + /** + * Allow override of retry settings at method-level for listLineageEvents. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLineageEventsRetry; + /** + * Allow override of retry settings at method-level for deleteLineageEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteLineageEventRetry; + /** + * Allow override of retry settings at method-level for searchLinks. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchLinksRetry; + /** + * Allow override of retry settings at method-level for batchSearchLinkProcesses. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchSearchLinkProcessesRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getProcessOpenLineageRunEventRetry() { + return this.processOpenLineageRunEventRetry; + } + + public void setProcessOpenLineageRunEventRetry(Retry processOpenLineageRunEventRetry) { + this.processOpenLineageRunEventRetry = processOpenLineageRunEventRetry; + } + + public Retry getCreateProcessRetry() { + return this.createProcessRetry; + } + + public void setCreateProcessRetry(Retry createProcessRetry) { + this.createProcessRetry = createProcessRetry; + } + + public Retry getUpdateProcessRetry() { + return this.updateProcessRetry; + } + + public void setUpdateProcessRetry(Retry updateProcessRetry) { + this.updateProcessRetry = updateProcessRetry; + } + + public Retry getGetProcessRetry() { + return this.getProcessRetry; + } + + public void setGetProcessRetry(Retry getProcessRetry) { + this.getProcessRetry = getProcessRetry; + } + + public Retry getListProcessesRetry() { + return this.listProcessesRetry; + } + + public void setListProcessesRetry(Retry listProcessesRetry) { + this.listProcessesRetry = listProcessesRetry; + } + + public Retry getCreateRunRetry() { + return this.createRunRetry; + } + + public void setCreateRunRetry(Retry createRunRetry) { + this.createRunRetry = createRunRetry; + } + + public Retry getUpdateRunRetry() { + return this.updateRunRetry; + } + + public void setUpdateRunRetry(Retry updateRunRetry) { + this.updateRunRetry = updateRunRetry; + } + + public Retry getGetRunRetry() { + return this.getRunRetry; + } + + public void setGetRunRetry(Retry getRunRetry) { + this.getRunRetry = getRunRetry; + } + + public Retry getListRunsRetry() { + return this.listRunsRetry; + } + + public void setListRunsRetry(Retry listRunsRetry) { + this.listRunsRetry = listRunsRetry; + } + + public Retry getCreateLineageEventRetry() { + return this.createLineageEventRetry; + } + + public void setCreateLineageEventRetry(Retry createLineageEventRetry) { + this.createLineageEventRetry = createLineageEventRetry; + } + + public Retry getGetLineageEventRetry() { + return this.getLineageEventRetry; + } + + public void setGetLineageEventRetry(Retry getLineageEventRetry) { + this.getLineageEventRetry = getLineageEventRetry; + } + + public Retry getListLineageEventsRetry() { + return this.listLineageEventsRetry; + } + + public void setListLineageEventsRetry(Retry listLineageEventsRetry) { + this.listLineageEventsRetry = listLineageEventsRetry; + } + + public Retry getDeleteLineageEventRetry() { + return this.deleteLineageEventRetry; + } + + public void setDeleteLineageEventRetry(Retry deleteLineageEventRetry) { + this.deleteLineageEventRetry = deleteLineageEventRetry; + } + + public Retry getSearchLinksRetry() { + return this.searchLinksRetry; + } + + public void setSearchLinksRetry(Retry searchLinksRetry) { + this.searchLinksRetry = searchLinksRetry; + } + + public Retry getBatchSearchLinkProcessesRetry() { + return this.batchSearchLinkProcessesRetry; + } + + public void setBatchSearchLinkProcessesRetry(Retry batchSearchLinkProcessesRetry) { + this.batchSearchLinkProcessesRetry = batchSearchLinkProcessesRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/v1/spring/package-info.java new file mode 100644 index 0000000000..3dab1b2c11 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/java/com/google/cloud/datacatalog/lineage/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 datalineage. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.datacatalog.lineage.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..08fe504df0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.datacatalog.lineage.v1.lineage.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud datalineage/Lineage components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..693c8b89f8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datalineage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.datacatalog.lineage.v1.spring.LineageSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/CatalogServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/CatalogServiceSpringAutoConfiguration.java index 6725065ccf..cb1905def2 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/CatalogServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/CatalogServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CatalogServiceSettings catalogServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CatalogServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringAutoConfiguration.java index 9c16d4b367..88281acca4 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ContentServiceSettings contentServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ContentServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java index a86f3b4c67..c80455bd97 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public DataScanServiceSettings dataScanServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataScanServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataTaxonomyServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataTaxonomyServiceSpringAutoConfiguration.java index 2e65f02c81..4f18e696c2 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataTaxonomyServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataTaxonomyServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public DataTaxonomyServiceSettings dataTaxonomyServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataTaxonomyServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java index d0ed1815ad..63db1c4c5a 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public DataplexServiceSettings dataplexServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataplexServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java index 03cf039dd2..7f0da88d11 100644 --- a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public MetadataServiceSettings metadataServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(MetadataServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringAutoConfiguration.java index 84b3cd7288..7f38bb87ba 100644 --- a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public DataprocMetastoreFederationSettings dataprocMetastoreFederationSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataprocMetastoreFederationSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java index a00da24082..f165cea518 100644 --- a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public DataprocMetastoreSettings dataprocMetastoreSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataprocMetastoreSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringAutoConfiguration.java index 7b6f87387f..b725f6b1b3 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AutoscalingPolicyServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java index 337da46222..3bfceaa6b1 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public BatchControllerSettings batchControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(BatchControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java index 44f9fd0f6c..da3ff1ce4b 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ClusterControllerSettings clusterControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ClusterControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java index 27548947bd..436ae11f93 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public JobControllerSettings jobControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(JobControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java index 06694fba0d..a2c06eb114 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public NodeGroupControllerSettings nodeGroupControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NodeGroupControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionControllerSpringAutoConfiguration.java index 7ff515242e..c3c2b4c4d6 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionControllerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public SessionControllerSettings sessionControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SessionControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionTemplateControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionTemplateControllerSpringAutoConfiguration.java index 72185f730c..139d525d30 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionTemplateControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/SessionTemplateControllerSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public SessionTemplateControllerSettings sessionTemplateControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SessionTemplateControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java index b62477b4e0..d8da2bb672 100644 --- a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public WorkflowTemplateServiceSettings workflowTemplateServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(WorkflowTemplateServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringAutoConfiguration.java index bf86ba67d8..2f9ad67364 100644 --- a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public DatastreamSettings datastreamSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DatastreamSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringAutoConfiguration.java index 388cee95da..232acbfcb7 100644 --- a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringAutoConfiguration.java @@ -134,6 +134,7 @@ public Controller2Settings controller2Settings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(Controller2Settings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java index 4515f8b6a0..746c6ba5f1 100644 --- a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java @@ -132,6 +132,7 @@ public Debugger2Settings debugger2Settings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(Debugger2Settings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java index 0b9f0c4cf2..55da3d9bb0 100644 --- a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java @@ -134,6 +134,7 @@ public CloudDeploySettings cloudDeploySettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudDeploySettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringAutoConfiguration.java index a5bbde318b..7201b9e28a 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public AgentsSettings agentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AgentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java index dc293b413c..81ed26c921 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public AnswerRecordsSettings answerRecordsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AnswerRecordsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java index f3cc80c39c..8dc290ce92 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public ContextsSettings contextsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ContextsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java index f21e6ce8ba..c28983cff0 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public ConversationDatasetsSettings conversationDatasetsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConversationDatasetsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java index 3739db2e2b..2c3eca1436 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ConversationModelsSettings conversationModelsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConversationModelsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java index 89edace472..3bb423f403 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public ConversationProfilesSettings conversationProfilesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConversationProfilesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java index 1fd3384f41..2fb77d15a0 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ConversationsSettings conversationsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConversationsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java index 90d719779e..54f668201f 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public DocumentsSettings documentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DocumentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java index cbe6fe9f86..ba99b4e940 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public EntityTypesSettings entityTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EntityTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java index a2354f75bb..06efe0df5a 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public EnvironmentsSettings environmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EnvironmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java index f0d503bbbd..97d26c4aca 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public FulfillmentsSettings fulfillmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FulfillmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java index 9259acf803..7b00d1567a 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public IntentsSettings intentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IntentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java index f3ca702a20..3032c2cae5 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public KnowledgeBasesSettings knowledgeBasesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(KnowledgeBasesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java index ded5ae24ca..ead3a93279 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ParticipantsSettings participantsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ParticipantsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java index 0e53c10e71..a560048f86 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public SessionEntityTypesSettings sessionEntityTypesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SessionEntityTypesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java index e52b86d706..be26ed9e95 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public SessionsSettings sessionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SessionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java index 92455ac50d..f6089fdcb1 100644 --- a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public VersionsSettings versionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VersionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/pom.xml new file mode 100644 index 0000000000..1a8a441aec --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-discoveryengine-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - discoveryengine + Spring Boot Starter with AutoConfiguration for discoveryengine + + + + + com.google.cloud + google-cloud-discoveryengine + + + + 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-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..bc179f11a6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringAutoConfiguration.java @@ -0,0 +1,205 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.CompletionServiceClient; +import com.google.cloud.discoveryengine.v1.CompletionServiceSettings; +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 CompletionServiceClient}. + * + *

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(CompletionServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.completion-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(CompletionServiceSpringProperties.class) +public class CompletionServiceSpringAutoConfiguration { + private final CompletionServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(CompletionServiceSpringAutoConfiguration.class); + + protected CompletionServiceSpringAutoConfiguration( + CompletionServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from CompletionService-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 = "defaultCompletionServiceTransportChannelProvider") + public TransportChannelProvider defaultCompletionServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return CompletionServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return CompletionServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a CompletionServiceSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultCompletionServiceTransportChannelProvider()). 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 CompletionServiceSpringProperties. 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 CompletionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public CompletionServiceSettings completionServiceSettings( + @Qualifier("defaultCompletionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CompletionServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CompletionServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CompletionServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CompletionServiceSettings.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 = + CompletionServiceSettings.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 completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry completeQueryRetry = clientProperties.getCompleteQueryRetry(); + if (completeQueryRetry != null) { + RetrySettings completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), completeQueryRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for completeQuery from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CompletionServiceClient bean configured with CompletionServiceSettings. + * + * @param completionServiceSettings settings to configure an instance of client bean. + * @return a {@link CompletionServiceClient} bean configured with {@link + * CompletionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public CompletionServiceClient completionServiceClient( + CompletionServiceSettings completionServiceSettings) throws IOException { + return CompletionServiceClient.create(completionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-completion-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringProperties.java new file mode 100644 index 0000000000..39c08adb15 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/CompletionServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * 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.discoveryengine.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 CompletionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.completion-service") +public class CompletionServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 completeQuery. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry completeQueryRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getCompleteQueryRetry() { + return this.completeQueryRetry; + } + + public void setCompleteQueryRetry(Retry completeQueryRetry) { + this.completeQueryRetry = completeQueryRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..8a2962875a --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringAutoConfiguration.java @@ -0,0 +1,263 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.ControlServiceClient; +import com.google.cloud.discoveryengine.v1.ControlServiceSettings; +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 ControlServiceClient}. + * + *

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(ControlServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.control-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(ControlServiceSpringProperties.class) +public class ControlServiceSpringAutoConfiguration { + private final ControlServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(ControlServiceSpringAutoConfiguration.class); + + protected ControlServiceSpringAutoConfiguration( + ControlServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from ControlService-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 = "defaultControlServiceTransportChannelProvider") + public TransportChannelProvider defaultControlServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ControlServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ControlServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ControlServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultControlServiceTransportChannelProvider()). 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 ControlServiceSpringProperties. 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 ControlServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ControlServiceSettings controlServiceSettings( + @Qualifier("defaultControlServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ControlServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ControlServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ControlServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ControlServiceSettings.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 = + ControlServiceSettings.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 createControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createControlSettings().setRetrySettings(createControlRetrySettings); + + RetrySettings deleteControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteControlSettings().setRetrySettings(deleteControlRetrySettings); + + RetrySettings updateControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateControlSettings().setRetrySettings(updateControlRetrySettings); + + RetrySettings getControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getControlSettings().setRetrySettings(getControlRetrySettings); + + RetrySettings listControlsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listControlsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listControlsSettings().setRetrySettings(listControlsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createControlRetry = clientProperties.getCreateControlRetry(); + if (createControlRetry != null) { + RetrySettings createControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createControlSettings().getRetrySettings(), createControlRetry); + clientSettingsBuilder.createControlSettings().setRetrySettings(createControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createControl from properties."); + } + } + Retry deleteControlRetry = clientProperties.getDeleteControlRetry(); + if (deleteControlRetry != null) { + RetrySettings deleteControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteControlSettings().getRetrySettings(), deleteControlRetry); + clientSettingsBuilder.deleteControlSettings().setRetrySettings(deleteControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteControl from properties."); + } + } + Retry updateControlRetry = clientProperties.getUpdateControlRetry(); + if (updateControlRetry != null) { + RetrySettings updateControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateControlSettings().getRetrySettings(), updateControlRetry); + clientSettingsBuilder.updateControlSettings().setRetrySettings(updateControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateControl from properties."); + } + } + Retry getControlRetry = clientProperties.getGetControlRetry(); + if (getControlRetry != null) { + RetrySettings getControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getControlSettings().getRetrySettings(), getControlRetry); + clientSettingsBuilder.getControlSettings().setRetrySettings(getControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getControl from properties."); + } + } + Retry listControlsRetry = clientProperties.getListControlsRetry(); + if (listControlsRetry != null) { + RetrySettings listControlsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listControlsSettings().getRetrySettings(), listControlsRetry); + clientSettingsBuilder.listControlsSettings().setRetrySettings(listControlsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listControls from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ControlServiceClient bean configured with ControlServiceSettings. + * + * @param controlServiceSettings settings to configure an instance of client bean. + * @return a {@link ControlServiceClient} bean configured with {@link ControlServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ControlServiceClient controlServiceClient(ControlServiceSettings controlServiceSettings) + throws IOException { + return ControlServiceClient.create(controlServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-control-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringProperties.java new file mode 100644 index 0000000000..a422a10298 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ControlServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * 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.discoveryengine.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 ControlService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.control-service") +public class ControlServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 createControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createControlRetry; + /** + * Allow override of retry settings at method-level for deleteControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteControlRetry; + /** + * Allow override of retry settings at method-level for updateControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateControlRetry; + /** + * Allow override of retry settings at method-level for getControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getControlRetry; + /** + * Allow override of retry settings at method-level for listControls. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listControlsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getCreateControlRetry() { + return this.createControlRetry; + } + + public void setCreateControlRetry(Retry createControlRetry) { + this.createControlRetry = createControlRetry; + } + + public Retry getDeleteControlRetry() { + return this.deleteControlRetry; + } + + public void setDeleteControlRetry(Retry deleteControlRetry) { + this.deleteControlRetry = deleteControlRetry; + } + + public Retry getUpdateControlRetry() { + return this.updateControlRetry; + } + + public void setUpdateControlRetry(Retry updateControlRetry) { + this.updateControlRetry = updateControlRetry; + } + + public Retry getGetControlRetry() { + return this.getControlRetry; + } + + public void setGetControlRetry(Retry getControlRetry) { + this.getControlRetry = getControlRetry; + } + + public Retry getListControlsRetry() { + return this.listControlsRetry; + } + + public void setListControlsRetry(Retry listControlsRetry) { + this.listControlsRetry = listControlsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..070ca2d882 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringAutoConfiguration.java @@ -0,0 +1,423 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.ConversationalSearchServiceClient; +import com.google.cloud.discoveryengine.v1.ConversationalSearchServiceSettings; +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 ConversationalSearchServiceClient}. + * + *

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(ConversationalSearchServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.conversational-search-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(ConversationalSearchServiceSpringProperties.class) +public class ConversationalSearchServiceSpringAutoConfiguration { + private final ConversationalSearchServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(ConversationalSearchServiceSpringAutoConfiguration.class); + + protected ConversationalSearchServiceSpringAutoConfiguration( + ConversationalSearchServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from ConversationalSearchService-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 = "defaultConversationalSearchServiceTransportChannelProvider") + public TransportChannelProvider defaultConversationalSearchServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ConversationalSearchServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ConversationalSearchServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ConversationalSearchServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultConversationalSearchServiceTransportChannelProvider()). 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 ConversationalSearchServiceSpringProperties. 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 ConversationalSearchServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConversationalSearchServiceSettings conversationalSearchServiceSettings( + @Qualifier("defaultConversationalSearchServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConversationalSearchServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConversationalSearchServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConversationalSearchServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConversationalSearchServiceSettings.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 = + ConversationalSearchServiceSettings.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 converseConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.converseConversationSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .converseConversationSettings() + .setRetrySettings(converseConversationRetrySettings); + + RetrySettings createConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createConversationSettings() + .setRetrySettings(createConversationRetrySettings); + + RetrySettings deleteConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteConversationSettings() + .setRetrySettings(deleteConversationRetrySettings); + + RetrySettings updateConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateConversationSettings() + .setRetrySettings(updateConversationRetrySettings); + + RetrySettings getConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getConversationSettings() + .setRetrySettings(getConversationRetrySettings); + + RetrySettings listConversationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listConversationsSettings() + .setRetrySettings(listConversationsRetrySettings); + + RetrySettings answerQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.answerQuerySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.answerQuerySettings().setRetrySettings(answerQueryRetrySettings); + + RetrySettings getAnswerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnswerSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getAnswerSettings().setRetrySettings(getAnswerRetrySettings); + + RetrySettings createSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createSessionSettings().setRetrySettings(createSessionRetrySettings); + + RetrySettings deleteSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteSessionSettings().setRetrySettings(deleteSessionRetrySettings); + + RetrySettings updateSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateSessionSettings().setRetrySettings(updateSessionRetrySettings); + + RetrySettings getSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSessionSettings().setRetrySettings(getSessionRetrySettings); + + RetrySettings listSessionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSessionsSettings().setRetrySettings(listSessionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry converseConversationRetry = clientProperties.getConverseConversationRetry(); + if (converseConversationRetry != null) { + RetrySettings converseConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.converseConversationSettings().getRetrySettings(), + converseConversationRetry); + clientSettingsBuilder + .converseConversationSettings() + .setRetrySettings(converseConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for converseConversation from properties."); + } + } + Retry createConversationRetry = clientProperties.getCreateConversationRetry(); + if (createConversationRetry != null) { + RetrySettings createConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationSettings().getRetrySettings(), + createConversationRetry); + clientSettingsBuilder + .createConversationSettings() + .setRetrySettings(createConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createConversation from properties."); + } + } + Retry deleteConversationRetry = clientProperties.getDeleteConversationRetry(); + if (deleteConversationRetry != null) { + RetrySettings deleteConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteConversationSettings().getRetrySettings(), + deleteConversationRetry); + clientSettingsBuilder + .deleteConversationSettings() + .setRetrySettings(deleteConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteConversation from properties."); + } + } + Retry updateConversationRetry = clientProperties.getUpdateConversationRetry(); + if (updateConversationRetry != null) { + RetrySettings updateConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateConversationSettings().getRetrySettings(), + updateConversationRetry); + clientSettingsBuilder + .updateConversationSettings() + .setRetrySettings(updateConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateConversation from properties."); + } + } + Retry getConversationRetry = clientProperties.getGetConversationRetry(); + if (getConversationRetry != null) { + RetrySettings getConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationSettings().getRetrySettings(), + getConversationRetry); + clientSettingsBuilder + .getConversationSettings() + .setRetrySettings(getConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getConversation from properties."); + } + } + Retry listConversationsRetry = clientProperties.getListConversationsRetry(); + if (listConversationsRetry != null) { + RetrySettings listConversationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationsSettings().getRetrySettings(), + listConversationsRetry); + clientSettingsBuilder + .listConversationsSettings() + .setRetrySettings(listConversationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversations from properties."); + } + } + Retry answerQueryRetry = clientProperties.getAnswerQueryRetry(); + if (answerQueryRetry != null) { + RetrySettings answerQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.answerQuerySettings().getRetrySettings(), answerQueryRetry); + clientSettingsBuilder.answerQuerySettings().setRetrySettings(answerQueryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for answerQuery from properties."); + } + } + Retry getAnswerRetry = clientProperties.getGetAnswerRetry(); + if (getAnswerRetry != null) { + RetrySettings getAnswerRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnswerSettings().getRetrySettings(), getAnswerRetry); + clientSettingsBuilder.getAnswerSettings().setRetrySettings(getAnswerRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getAnswer from properties."); + } + } + Retry createSessionRetry = clientProperties.getCreateSessionRetry(); + if (createSessionRetry != null) { + RetrySettings createSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createSessionSettings().getRetrySettings(), createSessionRetry); + clientSettingsBuilder.createSessionSettings().setRetrySettings(createSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createSession from properties."); + } + } + Retry deleteSessionRetry = clientProperties.getDeleteSessionRetry(); + if (deleteSessionRetry != null) { + RetrySettings deleteSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteSessionSettings().getRetrySettings(), deleteSessionRetry); + clientSettingsBuilder.deleteSessionSettings().setRetrySettings(deleteSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteSession from properties."); + } + } + Retry updateSessionRetry = clientProperties.getUpdateSessionRetry(); + if (updateSessionRetry != null) { + RetrySettings updateSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSessionSettings().getRetrySettings(), updateSessionRetry); + clientSettingsBuilder.updateSessionSettings().setRetrySettings(updateSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateSession from properties."); + } + } + Retry getSessionRetry = clientProperties.getGetSessionRetry(); + if (getSessionRetry != null) { + RetrySettings getSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSessionSettings().getRetrySettings(), getSessionRetry); + clientSettingsBuilder.getSessionSettings().setRetrySettings(getSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSession from properties."); + } + } + Retry listSessionsRetry = clientProperties.getListSessionsRetry(); + if (listSessionsRetry != null) { + RetrySettings listSessionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionsSettings().getRetrySettings(), listSessionsRetry); + clientSettingsBuilder.listSessionsSettings().setRetrySettings(listSessionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSessions from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConversationalSearchServiceClient bean configured with + * ConversationalSearchServiceSettings. + * + * @param conversationalSearchServiceSettings settings to configure an instance of client bean. + * @return a {@link ConversationalSearchServiceClient} bean configured with {@link + * ConversationalSearchServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConversationalSearchServiceClient conversationalSearchServiceClient( + ConversationalSearchServiceSettings conversationalSearchServiceSettings) throws IOException { + return ConversationalSearchServiceClient.create(conversationalSearchServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-conversational-search-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringProperties.java new file mode 100644 index 0000000000..5b0e8d0d3a --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ConversationalSearchServiceSpringProperties.java @@ -0,0 +1,251 @@ +/* + * 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.discoveryengine.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 ConversationalSearchService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.conversational-search-service") +public class ConversationalSearchServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 converseConversation. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry converseConversationRetry; + /** + * Allow override of retry settings at method-level for createConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createConversationRetry; + /** + * Allow override of retry settings at method-level for deleteConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteConversationRetry; + /** + * Allow override of retry settings at method-level for updateConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateConversationRetry; + /** + * Allow override of retry settings at method-level for getConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationRetry; + /** + * Allow override of retry settings at method-level for listConversations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationsRetry; + /** + * Allow override of retry settings at method-level for answerQuery. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry answerQueryRetry; + /** + * Allow override of retry settings at method-level for getAnswer. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAnswerRetry; + /** + * Allow override of retry settings at method-level for createSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createSessionRetry; + /** + * Allow override of retry settings at method-level for deleteSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteSessionRetry; + /** + * Allow override of retry settings at method-level for updateSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateSessionRetry; + /** + * Allow override of retry settings at method-level for getSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSessionRetry; + /** + * Allow override of retry settings at method-level for listSessions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSessionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getConverseConversationRetry() { + return this.converseConversationRetry; + } + + public void setConverseConversationRetry(Retry converseConversationRetry) { + this.converseConversationRetry = converseConversationRetry; + } + + public Retry getCreateConversationRetry() { + return this.createConversationRetry; + } + + public void setCreateConversationRetry(Retry createConversationRetry) { + this.createConversationRetry = createConversationRetry; + } + + public Retry getDeleteConversationRetry() { + return this.deleteConversationRetry; + } + + public void setDeleteConversationRetry(Retry deleteConversationRetry) { + this.deleteConversationRetry = deleteConversationRetry; + } + + public Retry getUpdateConversationRetry() { + return this.updateConversationRetry; + } + + public void setUpdateConversationRetry(Retry updateConversationRetry) { + this.updateConversationRetry = updateConversationRetry; + } + + public Retry getGetConversationRetry() { + return this.getConversationRetry; + } + + public void setGetConversationRetry(Retry getConversationRetry) { + this.getConversationRetry = getConversationRetry; + } + + public Retry getListConversationsRetry() { + return this.listConversationsRetry; + } + + public void setListConversationsRetry(Retry listConversationsRetry) { + this.listConversationsRetry = listConversationsRetry; + } + + public Retry getAnswerQueryRetry() { + return this.answerQueryRetry; + } + + public void setAnswerQueryRetry(Retry answerQueryRetry) { + this.answerQueryRetry = answerQueryRetry; + } + + public Retry getGetAnswerRetry() { + return this.getAnswerRetry; + } + + public void setGetAnswerRetry(Retry getAnswerRetry) { + this.getAnswerRetry = getAnswerRetry; + } + + public Retry getCreateSessionRetry() { + return this.createSessionRetry; + } + + public void setCreateSessionRetry(Retry createSessionRetry) { + this.createSessionRetry = createSessionRetry; + } + + public Retry getDeleteSessionRetry() { + return this.deleteSessionRetry; + } + + public void setDeleteSessionRetry(Retry deleteSessionRetry) { + this.deleteSessionRetry = deleteSessionRetry; + } + + public Retry getUpdateSessionRetry() { + return this.updateSessionRetry; + } + + public void setUpdateSessionRetry(Retry updateSessionRetry) { + this.updateSessionRetry = updateSessionRetry; + } + + public Retry getGetSessionRetry() { + return this.getSessionRetry; + } + + public void setGetSessionRetry(Retry getSessionRetry) { + this.getSessionRetry = getSessionRetry; + } + + public Retry getListSessionsRetry() { + return this.listSessionsRetry; + } + + public void setListSessionsRetry(Retry listSessionsRetry) { + this.listSessionsRetry = listSessionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..e2c36cc33a --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringAutoConfiguration.java @@ -0,0 +1,240 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.DataStoreServiceClient; +import com.google.cloud.discoveryengine.v1.DataStoreServiceSettings; +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 DataStoreServiceClient}. + * + *

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(DataStoreServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.data-store-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(DataStoreServiceSpringProperties.class) +public class DataStoreServiceSpringAutoConfiguration { + private final DataStoreServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(DataStoreServiceSpringAutoConfiguration.class); + + protected DataStoreServiceSpringAutoConfiguration( + DataStoreServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from DataStoreService-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 = "defaultDataStoreServiceTransportChannelProvider") + public TransportChannelProvider defaultDataStoreServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return DataStoreServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return DataStoreServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a DataStoreServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultDataStoreServiceTransportChannelProvider()). 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 DataStoreServiceSpringProperties. 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 DataStoreServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public DataStoreServiceSettings dataStoreServiceSettings( + @Qualifier("defaultDataStoreServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DataStoreServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DataStoreServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DataStoreServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataStoreServiceSettings.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 = + DataStoreServiceSettings.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 getDataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataStoreSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDataStoreSettings().setRetrySettings(getDataStoreRetrySettings); + + RetrySettings listDataStoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataStoresSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDataStoresSettings().setRetrySettings(listDataStoresRetrySettings); + + RetrySettings updateDataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDataStoreSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateDataStoreSettings() + .setRetrySettings(updateDataStoreRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getDataStoreRetry = clientProperties.getGetDataStoreRetry(); + if (getDataStoreRetry != null) { + RetrySettings getDataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataStoreSettings().getRetrySettings(), getDataStoreRetry); + clientSettingsBuilder.getDataStoreSettings().setRetrySettings(getDataStoreRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataStore from properties."); + } + } + Retry listDataStoresRetry = clientProperties.getListDataStoresRetry(); + if (listDataStoresRetry != null) { + RetrySettings listDataStoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataStoresSettings().getRetrySettings(), + listDataStoresRetry); + clientSettingsBuilder.listDataStoresSettings().setRetrySettings(listDataStoresRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDataStores from properties."); + } + } + Retry updateDataStoreRetry = clientProperties.getUpdateDataStoreRetry(); + if (updateDataStoreRetry != null) { + RetrySettings updateDataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDataStoreSettings().getRetrySettings(), + updateDataStoreRetry); + clientSettingsBuilder + .updateDataStoreSettings() + .setRetrySettings(updateDataStoreRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateDataStore from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DataStoreServiceClient bean configured with DataStoreServiceSettings. + * + * @param dataStoreServiceSettings settings to configure an instance of client bean. + * @return a {@link DataStoreServiceClient} bean configured with {@link DataStoreServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DataStoreServiceClient dataStoreServiceClient( + DataStoreServiceSettings dataStoreServiceSettings) throws IOException { + return DataStoreServiceClient.create(dataStoreServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-data-store-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringProperties.java new file mode 100644 index 0000000000..2ec5af8734 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DataStoreServiceSpringProperties.java @@ -0,0 +1,121 @@ +/* + * 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.discoveryengine.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 DataStoreService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.data-store-service") +public class DataStoreServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getDataStore. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDataStoreRetry; + /** + * Allow override of retry settings at method-level for listDataStores. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataStoresRetry; + /** + * Allow override of retry settings at method-level for updateDataStore. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDataStoreRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetDataStoreRetry() { + return this.getDataStoreRetry; + } + + public void setGetDataStoreRetry(Retry getDataStoreRetry) { + this.getDataStoreRetry = getDataStoreRetry; + } + + public Retry getListDataStoresRetry() { + return this.listDataStoresRetry; + } + + public void setListDataStoresRetry(Retry listDataStoresRetry) { + this.listDataStoresRetry = listDataStoresRetry; + } + + public Retry getUpdateDataStoreRetry() { + return this.updateDataStoreRetry; + } + + public void setUpdateDataStoreRetry(Retry updateDataStoreRetry) { + this.updateDataStoreRetry = updateDataStoreRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..e9fd6f0362 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringAutoConfiguration.java @@ -0,0 +1,266 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.DocumentServiceClient; +import com.google.cloud.discoveryengine.v1.DocumentServiceSettings; +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 DocumentServiceClient}. + * + *

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(DocumentServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.document-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(DocumentServiceSpringProperties.class) +public class DocumentServiceSpringAutoConfiguration { + private final DocumentServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(DocumentServiceSpringAutoConfiguration.class); + + protected DocumentServiceSpringAutoConfiguration( + DocumentServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from DocumentService-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 = "defaultDocumentServiceTransportChannelProvider") + public TransportChannelProvider defaultDocumentServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return DocumentServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return DocumentServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a DocumentServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultDocumentServiceTransportChannelProvider()). 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 DocumentServiceSpringProperties. 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 DocumentServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DocumentServiceSettings documentServiceSettings( + @Qualifier("defaultDocumentServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DocumentServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DocumentServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DocumentServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DocumentServiceSettings.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 = + DocumentServiceSettings.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 getDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDocumentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDocumentSettings().setRetrySettings(getDocumentRetrySettings); + + RetrySettings listDocumentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDocumentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDocumentsSettings().setRetrySettings(listDocumentsRetrySettings); + + RetrySettings createDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDocumentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createDocumentSettings().setRetrySettings(createDocumentRetrySettings); + + RetrySettings updateDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDocumentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateDocumentSettings().setRetrySettings(updateDocumentRetrySettings); + + RetrySettings deleteDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteDocumentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteDocumentSettings().setRetrySettings(deleteDocumentRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getDocumentRetry = clientProperties.getGetDocumentRetry(); + if (getDocumentRetry != null) { + RetrySettings getDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDocumentSettings().getRetrySettings(), getDocumentRetry); + clientSettingsBuilder.getDocumentSettings().setRetrySettings(getDocumentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDocument from properties."); + } + } + Retry listDocumentsRetry = clientProperties.getListDocumentsRetry(); + if (listDocumentsRetry != null) { + RetrySettings listDocumentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDocumentsSettings().getRetrySettings(), listDocumentsRetry); + clientSettingsBuilder.listDocumentsSettings().setRetrySettings(listDocumentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDocuments from properties."); + } + } + Retry createDocumentRetry = clientProperties.getCreateDocumentRetry(); + if (createDocumentRetry != null) { + RetrySettings createDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDocumentSettings().getRetrySettings(), + createDocumentRetry); + clientSettingsBuilder.createDocumentSettings().setRetrySettings(createDocumentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createDocument from properties."); + } + } + Retry updateDocumentRetry = clientProperties.getUpdateDocumentRetry(); + if (updateDocumentRetry != null) { + RetrySettings updateDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDocumentSettings().getRetrySettings(), + updateDocumentRetry); + clientSettingsBuilder.updateDocumentSettings().setRetrySettings(updateDocumentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateDocument from properties."); + } + } + Retry deleteDocumentRetry = clientProperties.getDeleteDocumentRetry(); + if (deleteDocumentRetry != null) { + RetrySettings deleteDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteDocumentSettings().getRetrySettings(), + deleteDocumentRetry); + clientSettingsBuilder.deleteDocumentSettings().setRetrySettings(deleteDocumentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteDocument from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DocumentServiceClient bean configured with DocumentServiceSettings. + * + * @param documentServiceSettings settings to configure an instance of client bean. + * @return a {@link DocumentServiceClient} bean configured with {@link DocumentServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DocumentServiceClient documentServiceClient( + DocumentServiceSettings documentServiceSettings) throws IOException { + return DocumentServiceClient.create(documentServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-document-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringProperties.java new file mode 100644 index 0000000000..b86e9a1da9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/DocumentServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * 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.discoveryengine.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 DocumentService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.document-service") +public class DocumentServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getDocument. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDocumentRetry; + /** + * Allow override of retry settings at method-level for listDocuments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDocumentsRetry; + /** + * Allow override of retry settings at method-level for createDocument. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createDocumentRetry; + /** + * Allow override of retry settings at method-level for updateDocument. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDocumentRetry; + /** + * Allow override of retry settings at method-level for deleteDocument. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteDocumentRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetDocumentRetry() { + return this.getDocumentRetry; + } + + public void setGetDocumentRetry(Retry getDocumentRetry) { + this.getDocumentRetry = getDocumentRetry; + } + + public Retry getListDocumentsRetry() { + return this.listDocumentsRetry; + } + + public void setListDocumentsRetry(Retry listDocumentsRetry) { + this.listDocumentsRetry = listDocumentsRetry; + } + + public Retry getCreateDocumentRetry() { + return this.createDocumentRetry; + } + + public void setCreateDocumentRetry(Retry createDocumentRetry) { + this.createDocumentRetry = createDocumentRetry; + } + + public Retry getUpdateDocumentRetry() { + return this.updateDocumentRetry; + } + + public void setUpdateDocumentRetry(Retry updateDocumentRetry) { + this.updateDocumentRetry = updateDocumentRetry; + } + + public Retry getDeleteDocumentRetry() { + return this.deleteDocumentRetry; + } + + public void setDeleteDocumentRetry(Retry deleteDocumentRetry) { + this.deleteDocumentRetry = deleteDocumentRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..6d34e89af7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringAutoConfiguration.java @@ -0,0 +1,233 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.EngineServiceClient; +import com.google.cloud.discoveryengine.v1.EngineServiceSettings; +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 EngineServiceClient}. + * + *

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(EngineServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.engine-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(EngineServiceSpringProperties.class) +public class EngineServiceSpringAutoConfiguration { + private final EngineServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(EngineServiceSpringAutoConfiguration.class); + + protected EngineServiceSpringAutoConfiguration( + EngineServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from EngineService-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 = "defaultEngineServiceTransportChannelProvider") + public TransportChannelProvider defaultEngineServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return EngineServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return EngineServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a EngineServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultEngineServiceTransportChannelProvider()). 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 EngineServiceSpringProperties. 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 EngineServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EngineServiceSettings engineServiceSettings( + @Qualifier("defaultEngineServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EngineServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EngineServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EngineServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EngineServiceSettings.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 = + EngineServiceSettings.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 updateEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEngineSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateEngineSettings().setRetrySettings(updateEngineRetrySettings); + + RetrySettings getEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEngineSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEngineSettings().setRetrySettings(getEngineRetrySettings); + + RetrySettings listEnginesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnginesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listEnginesSettings().setRetrySettings(listEnginesRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry updateEngineRetry = clientProperties.getUpdateEngineRetry(); + if (updateEngineRetry != null) { + RetrySettings updateEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEngineSettings().getRetrySettings(), updateEngineRetry); + clientSettingsBuilder.updateEngineSettings().setRetrySettings(updateEngineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateEngine from properties."); + } + } + Retry getEngineRetry = clientProperties.getGetEngineRetry(); + if (getEngineRetry != null) { + RetrySettings getEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEngineSettings().getRetrySettings(), getEngineRetry); + clientSettingsBuilder.getEngineSettings().setRetrySettings(getEngineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEngine from properties."); + } + } + Retry listEnginesRetry = clientProperties.getListEnginesRetry(); + if (listEnginesRetry != null) { + RetrySettings listEnginesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnginesSettings().getRetrySettings(), listEnginesRetry); + clientSettingsBuilder.listEnginesSettings().setRetrySettings(listEnginesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEngines from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a EngineServiceClient bean configured with EngineServiceSettings. + * + * @param engineServiceSettings settings to configure an instance of client bean. + * @return a {@link EngineServiceClient} bean configured with {@link EngineServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public EngineServiceClient engineServiceClient(EngineServiceSettings engineServiceSettings) + throws IOException { + return EngineServiceClient.create(engineServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-engine-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringProperties.java new file mode 100644 index 0000000000..05d337b211 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/EngineServiceSpringProperties.java @@ -0,0 +1,121 @@ +/* + * 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.discoveryengine.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 EngineService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.engine-service") +public class EngineServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 updateEngine. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEngineRetry; + /** + * Allow override of retry settings at method-level for getEngine. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEngineRetry; + /** + * Allow override of retry settings at method-level for listEngines. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEnginesRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getUpdateEngineRetry() { + return this.updateEngineRetry; + } + + public void setUpdateEngineRetry(Retry updateEngineRetry) { + this.updateEngineRetry = updateEngineRetry; + } + + public Retry getGetEngineRetry() { + return this.getEngineRetry; + } + + public void setGetEngineRetry(Retry getEngineRetry) { + this.getEngineRetry = getEngineRetry; + } + + public Retry getListEnginesRetry() { + return this.listEnginesRetry; + } + + public void setListEnginesRetry(Retry listEnginesRetry) { + this.listEnginesRetry = listEnginesRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..bc28a91e78 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringAutoConfiguration.java @@ -0,0 +1,208 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.GroundedGenerationServiceClient; +import com.google.cloud.discoveryengine.v1.GroundedGenerationServiceSettings; +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 GroundedGenerationServiceClient}. + * + *

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(GroundedGenerationServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.grounded-generation-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(GroundedGenerationServiceSpringProperties.class) +public class GroundedGenerationServiceSpringAutoConfiguration { + private final GroundedGenerationServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(GroundedGenerationServiceSpringAutoConfiguration.class); + + protected GroundedGenerationServiceSpringAutoConfiguration( + GroundedGenerationServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from GroundedGenerationService-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 = "defaultGroundedGenerationServiceTransportChannelProvider") + public TransportChannelProvider defaultGroundedGenerationServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return GroundedGenerationServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return GroundedGenerationServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a GroundedGenerationServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultGroundedGenerationServiceTransportChannelProvider()). 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 GroundedGenerationServiceSpringProperties. 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 GroundedGenerationServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GroundedGenerationServiceSettings groundedGenerationServiceSettings( + @Qualifier("defaultGroundedGenerationServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GroundedGenerationServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = GroundedGenerationServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = GroundedGenerationServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GroundedGenerationServiceSettings.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 = + GroundedGenerationServiceSettings.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 checkGroundingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.checkGroundingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.checkGroundingSettings().setRetrySettings(checkGroundingRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry checkGroundingRetry = clientProperties.getCheckGroundingRetry(); + if (checkGroundingRetry != null) { + RetrySettings checkGroundingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.checkGroundingSettings().getRetrySettings(), + checkGroundingRetry); + clientSettingsBuilder.checkGroundingSettings().setRetrySettings(checkGroundingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for checkGrounding from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GroundedGenerationServiceClient bean configured with + * GroundedGenerationServiceSettings. + * + * @param groundedGenerationServiceSettings settings to configure an instance of client bean. + * @return a {@link GroundedGenerationServiceClient} bean configured with {@link + * GroundedGenerationServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GroundedGenerationServiceClient groundedGenerationServiceClient( + GroundedGenerationServiceSettings groundedGenerationServiceSettings) throws IOException { + return GroundedGenerationServiceClient.create(groundedGenerationServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-grounded-generation-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringProperties.java new file mode 100644 index 0000000000..0b72035afc --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/GroundedGenerationServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * 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.discoveryengine.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 GroundedGenerationService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.grounded-generation-service") +public class GroundedGenerationServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 checkGrounding. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry checkGroundingRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getCheckGroundingRetry() { + return this.checkGroundingRetry; + } + + public void setCheckGroundingRetry(Retry checkGroundingRetry) { + this.checkGroundingRetry = checkGroundingRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..8ff80fcbc7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringAutoConfiguration.java @@ -0,0 +1,186 @@ +/* + * 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.discoveryengine.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.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.discoveryengine.v1.ProjectServiceClient; +import com.google.cloud.discoveryengine.v1.ProjectServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +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 ProjectServiceClient}. + * + *

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(ProjectServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.project-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(ProjectServiceSpringProperties.class) +public class ProjectServiceSpringAutoConfiguration { + private final ProjectServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(ProjectServiceSpringAutoConfiguration.class); + + protected ProjectServiceSpringAutoConfiguration( + ProjectServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from ProjectService-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 = "defaultProjectServiceTransportChannelProvider") + public TransportChannelProvider defaultProjectServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ProjectServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ProjectServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ProjectServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultProjectServiceTransportChannelProvider()). 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 ProjectServiceSpringProperties. 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 ProjectServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ProjectServiceSettings projectServiceSettings( + @Qualifier("defaultProjectServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ProjectServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ProjectServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ProjectServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ProjectServiceSettings.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 = + ProjectServiceSettings.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) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ProjectServiceClient bean configured with ProjectServiceSettings. + * + * @param projectServiceSettings settings to configure an instance of client bean. + * @return a {@link ProjectServiceClient} bean configured with {@link ProjectServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ProjectServiceClient projectServiceClient(ProjectServiceSettings projectServiceSettings) + throws IOException { + return ProjectServiceClient.create(projectServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-project-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringProperties.java new file mode 100644 index 0000000000..cf407c656c --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/ProjectServiceSpringProperties.java @@ -0,0 +1,82 @@ +/* + * 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.discoveryengine.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 ProjectService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.project-service") +public class ProjectServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..2045ea7a4c --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringAutoConfiguration.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.discoveryengine.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.discoveryengine.v1.RankServiceClient; +import com.google.cloud.discoveryengine.v1.RankServiceSettings; +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 RankServiceClient}. + * + *

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(RankServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.rank-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(RankServiceSpringProperties.class) +public class RankServiceSpringAutoConfiguration { + private final RankServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(RankServiceSpringAutoConfiguration.class); + + protected RankServiceSpringAutoConfiguration( + RankServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from RankService-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 = "defaultRankServiceTransportChannelProvider") + public TransportChannelProvider defaultRankServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return RankServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return RankServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a RankServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultRankServiceTransportChannelProvider()). 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 RankServiceSpringProperties. 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 RankServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public RankServiceSettings rankServiceSettings( + @Qualifier("defaultRankServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + RankServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = RankServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = RankServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RankServiceSettings.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 = + RankServiceSettings.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 rankRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rankSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.rankSettings().setRetrySettings(rankRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry rankRetry = clientProperties.getRankRetry(); + if (rankRetry != null) { + RetrySettings rankRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rankSettings().getRetrySettings(), rankRetry); + clientSettingsBuilder.rankSettings().setRetrySettings(rankRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for rank from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a RankServiceClient bean configured with RankServiceSettings. + * + * @param rankServiceSettings settings to configure an instance of client bean. + * @return a {@link RankServiceClient} bean configured with {@link RankServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public RankServiceClient rankServiceClient(RankServiceSettings rankServiceSettings) + throws IOException { + return RankServiceClient.create(rankServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-rank-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringProperties.java new file mode 100644 index 0000000000..a2673cd80b --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RankServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * 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.discoveryengine.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 RankService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.rank-service") +public class RankServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 rank. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry rankRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getRankRetry() { + return this.rankRetry; + } + + public void setRankRetry(Retry rankRetry) { + this.rankRetry = rankRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..81406c08c4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringAutoConfiguration.java @@ -0,0 +1,206 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.RecommendationServiceClient; +import com.google.cloud.discoveryengine.v1.RecommendationServiceSettings; +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 RecommendationServiceClient}. + * + *

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(RecommendationServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.recommendation-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(RecommendationServiceSpringProperties.class) +public class RecommendationServiceSpringAutoConfiguration { + private final RecommendationServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(RecommendationServiceSpringAutoConfiguration.class); + + protected RecommendationServiceSpringAutoConfiguration( + RecommendationServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from RecommendationService-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 = "defaultRecommendationServiceTransportChannelProvider") + public TransportChannelProvider defaultRecommendationServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return RecommendationServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return RecommendationServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a RecommendationServiceSettings bean configured to use a DefaultCredentialsProvider + * and the client library's default transport channel provider + * (defaultRecommendationServiceTransportChannelProvider()). 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 RecommendationServiceSpringProperties. 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 RecommendationServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public RecommendationServiceSettings recommendationServiceSettings( + @Qualifier("defaultRecommendationServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + RecommendationServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = RecommendationServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = RecommendationServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RecommendationServiceSettings.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 = + RecommendationServiceSettings.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 recommendRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.recommendSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.recommendSettings().setRetrySettings(recommendRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry recommendRetry = clientProperties.getRecommendRetry(); + if (recommendRetry != null) { + RetrySettings recommendRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.recommendSettings().getRetrySettings(), recommendRetry); + clientSettingsBuilder.recommendSettings().setRetrySettings(recommendRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for recommend from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a RecommendationServiceClient bean configured with RecommendationServiceSettings. + * + * @param recommendationServiceSettings settings to configure an instance of client bean. + * @return a {@link RecommendationServiceClient} bean configured with {@link + * RecommendationServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public RecommendationServiceClient recommendationServiceClient( + RecommendationServiceSettings recommendationServiceSettings) throws IOException { + return RecommendationServiceClient.create(recommendationServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-recommendation-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringProperties.java new file mode 100644 index 0000000000..3168c992b8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/RecommendationServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * 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.discoveryengine.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 RecommendationService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.recommendation-service") +public class RecommendationServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 recommend. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry recommendRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getRecommendRetry() { + return this.recommendRetry; + } + + public void setRecommendRetry(Retry recommendRetry) { + this.recommendRetry = recommendRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..776291df26 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringAutoConfiguration.java @@ -0,0 +1,218 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.SchemaServiceClient; +import com.google.cloud.discoveryengine.v1.SchemaServiceSettings; +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 SchemaServiceClient}. + * + *

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(SchemaServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.schema-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SchemaServiceSpringProperties.class) +public class SchemaServiceSpringAutoConfiguration { + private final SchemaServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(SchemaServiceSpringAutoConfiguration.class); + + protected SchemaServiceSpringAutoConfiguration( + SchemaServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SchemaService-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 = "defaultSchemaServiceTransportChannelProvider") + public TransportChannelProvider defaultSchemaServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SchemaServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SchemaServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SchemaServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultSchemaServiceTransportChannelProvider()). 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 SchemaServiceSpringProperties. 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 SchemaServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public SchemaServiceSettings schemaServiceSettings( + @Qualifier("defaultSchemaServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SchemaServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SchemaServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SchemaServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SchemaServiceSettings.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 = + SchemaServiceSettings.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 getSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSchemaSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSchemaSettings().setRetrySettings(getSchemaRetrySettings); + + RetrySettings listSchemasRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSchemasSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSchemasSettings().setRetrySettings(listSchemasRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getSchemaRetry = clientProperties.getGetSchemaRetry(); + if (getSchemaRetry != null) { + RetrySettings getSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSchemaSettings().getRetrySettings(), getSchemaRetry); + clientSettingsBuilder.getSchemaSettings().setRetrySettings(getSchemaRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSchema from properties."); + } + } + Retry listSchemasRetry = clientProperties.getListSchemasRetry(); + if (listSchemasRetry != null) { + RetrySettings listSchemasRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSchemasSettings().getRetrySettings(), listSchemasRetry); + clientSettingsBuilder.listSchemasSettings().setRetrySettings(listSchemasRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSchemas from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SchemaServiceClient bean configured with SchemaServiceSettings. + * + * @param schemaServiceSettings settings to configure an instance of client bean. + * @return a {@link SchemaServiceClient} bean configured with {@link SchemaServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SchemaServiceClient schemaServiceClient(SchemaServiceSettings schemaServiceSettings) + throws IOException { + return SchemaServiceClient.create(schemaServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-schema-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringProperties.java new file mode 100644 index 0000000000..e009b858cf --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SchemaServiceSpringProperties.java @@ -0,0 +1,108 @@ +/* + * 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.discoveryengine.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 SchemaService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.schema-service") +public class SchemaServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getSchema. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSchemaRetry; + /** + * Allow override of retry settings at method-level for listSchemas. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSchemasRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetSchemaRetry() { + return this.getSchemaRetry; + } + + public void setGetSchemaRetry(Retry getSchemaRetry) { + this.getSchemaRetry = getSchemaRetry; + } + + public Retry getListSchemasRetry() { + return this.listSchemasRetry; + } + + public void setListSchemasRetry(Retry listSchemasRetry) { + this.listSchemasRetry = listSchemasRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..a65c97e214 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.SearchServiceClient; +import com.google.cloud.discoveryengine.v1.SearchServiceSettings; +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 SearchServiceClient}. + * + *

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(SearchServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.search-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SearchServiceSpringProperties.class) +public class SearchServiceSpringAutoConfiguration { + private final SearchServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(SearchServiceSpringAutoConfiguration.class); + + protected SearchServiceSpringAutoConfiguration( + SearchServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SearchService-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 = "defaultSearchServiceTransportChannelProvider") + public TransportChannelProvider defaultSearchServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SearchServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SearchServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SearchServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultSearchServiceTransportChannelProvider()). 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 SearchServiceSpringProperties. 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 SearchServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public SearchServiceSettings searchServiceSettings( + @Qualifier("defaultSearchServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SearchServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SearchServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SearchServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SearchServiceSettings.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 = + SearchServiceSettings.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 searchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchSettings().setRetrySettings(searchRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry searchRetry = clientProperties.getSearchRetry(); + if (searchRetry != null) { + RetrySettings searchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchSettings().getRetrySettings(), searchRetry); + clientSettingsBuilder.searchSettings().setRetrySettings(searchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for search from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SearchServiceClient bean configured with SearchServiceSettings. + * + * @param searchServiceSettings settings to configure an instance of client bean. + * @return a {@link SearchServiceClient} bean configured with {@link SearchServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SearchServiceClient searchServiceClient(SearchServiceSettings searchServiceSettings) + throws IOException { + return SearchServiceClient.create(searchServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-search-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringProperties.java new file mode 100644 index 0000000000..7eef87f904 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SearchServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * 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.discoveryengine.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 SearchService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.search-service") +public class SearchServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 search. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getSearchRetry() { + return this.searchRetry; + } + + public void setSearchRetry(Retry searchRetry) { + this.searchRetry = searchRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..ac289a2ae6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringAutoConfiguration.java @@ -0,0 +1,270 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.SiteSearchEngineServiceClient; +import com.google.cloud.discoveryengine.v1.SiteSearchEngineServiceSettings; +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 SiteSearchEngineServiceClient}. + * + *

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(SiteSearchEngineServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.site-search-engine-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SiteSearchEngineServiceSpringProperties.class) +public class SiteSearchEngineServiceSpringAutoConfiguration { + private final SiteSearchEngineServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(SiteSearchEngineServiceSpringAutoConfiguration.class); + + protected SiteSearchEngineServiceSpringAutoConfiguration( + SiteSearchEngineServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SiteSearchEngineService-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 = "defaultSiteSearchEngineServiceTransportChannelProvider") + public TransportChannelProvider defaultSiteSearchEngineServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SiteSearchEngineServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SiteSearchEngineServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SiteSearchEngineServiceSettings bean configured to use a DefaultCredentialsProvider + * and the client library's default transport channel provider + * (defaultSiteSearchEngineServiceTransportChannelProvider()). 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 SiteSearchEngineServiceSpringProperties. 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 SiteSearchEngineServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SiteSearchEngineServiceSettings siteSearchEngineServiceSettings( + @Qualifier("defaultSiteSearchEngineServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SiteSearchEngineServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SiteSearchEngineServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SiteSearchEngineServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SiteSearchEngineServiceSettings.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 = + SiteSearchEngineServiceSettings.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 getSiteSearchEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSiteSearchEngineSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getSiteSearchEngineSettings() + .setRetrySettings(getSiteSearchEngineRetrySettings); + + RetrySettings getTargetSiteRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTargetSiteSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getTargetSiteSettings().setRetrySettings(getTargetSiteRetrySettings); + + RetrySettings listTargetSitesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTargetSitesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listTargetSitesSettings() + .setRetrySettings(listTargetSitesRetrySettings); + + RetrySettings fetchDomainVerificationStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchDomainVerificationStatusSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .fetchDomainVerificationStatusSettings() + .setRetrySettings(fetchDomainVerificationStatusRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getSiteSearchEngineRetry = clientProperties.getGetSiteSearchEngineRetry(); + if (getSiteSearchEngineRetry != null) { + RetrySettings getSiteSearchEngineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSiteSearchEngineSettings().getRetrySettings(), + getSiteSearchEngineRetry); + clientSettingsBuilder + .getSiteSearchEngineSettings() + .setRetrySettings(getSiteSearchEngineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getSiteSearchEngine from properties."); + } + } + Retry getTargetSiteRetry = clientProperties.getGetTargetSiteRetry(); + if (getTargetSiteRetry != null) { + RetrySettings getTargetSiteRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTargetSiteSettings().getRetrySettings(), getTargetSiteRetry); + clientSettingsBuilder.getTargetSiteSettings().setRetrySettings(getTargetSiteRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getTargetSite from properties."); + } + } + Retry listTargetSitesRetry = clientProperties.getListTargetSitesRetry(); + if (listTargetSitesRetry != null) { + RetrySettings listTargetSitesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTargetSitesSettings().getRetrySettings(), + listTargetSitesRetry); + clientSettingsBuilder + .listTargetSitesSettings() + .setRetrySettings(listTargetSitesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listTargetSites from properties."); + } + } + Retry fetchDomainVerificationStatusRetry = + clientProperties.getFetchDomainVerificationStatusRetry(); + if (fetchDomainVerificationStatusRetry != null) { + RetrySettings fetchDomainVerificationStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchDomainVerificationStatusSettings().getRetrySettings(), + fetchDomainVerificationStatusRetry); + clientSettingsBuilder + .fetchDomainVerificationStatusSettings() + .setRetrySettings(fetchDomainVerificationStatusRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for fetchDomainVerificationStatus from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SiteSearchEngineServiceClient bean configured with SiteSearchEngineServiceSettings. + * + * @param siteSearchEngineServiceSettings settings to configure an instance of client bean. + * @return a {@link SiteSearchEngineServiceClient} bean configured with {@link + * SiteSearchEngineServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SiteSearchEngineServiceClient siteSearchEngineServiceClient( + SiteSearchEngineServiceSettings siteSearchEngineServiceSettings) throws IOException { + return SiteSearchEngineServiceClient.create(siteSearchEngineServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-site-search-engine-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringProperties.java new file mode 100644 index 0000000000..c1fecf22b3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/SiteSearchEngineServiceSpringProperties.java @@ -0,0 +1,134 @@ +/* + * 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.discoveryengine.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 SiteSearchEngineService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.site-search-engine-service") +public class SiteSearchEngineServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getSiteSearchEngine. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSiteSearchEngineRetry; + /** + * Allow override of retry settings at method-level for getTargetSite. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTargetSiteRetry; + /** + * Allow override of retry settings at method-level for listTargetSites. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTargetSitesRetry; + /** + * Allow override of retry settings at method-level for fetchDomainVerificationStatus. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry fetchDomainVerificationStatusRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetSiteSearchEngineRetry() { + return this.getSiteSearchEngineRetry; + } + + public void setGetSiteSearchEngineRetry(Retry getSiteSearchEngineRetry) { + this.getSiteSearchEngineRetry = getSiteSearchEngineRetry; + } + + public Retry getGetTargetSiteRetry() { + return this.getTargetSiteRetry; + } + + public void setGetTargetSiteRetry(Retry getTargetSiteRetry) { + this.getTargetSiteRetry = getTargetSiteRetry; + } + + public Retry getListTargetSitesRetry() { + return this.listTargetSitesRetry; + } + + public void setListTargetSitesRetry(Retry listTargetSitesRetry) { + this.listTargetSitesRetry = listTargetSitesRetry; + } + + public Retry getFetchDomainVerificationStatusRetry() { + return this.fetchDomainVerificationStatusRetry; + } + + public void setFetchDomainVerificationStatusRetry(Retry fetchDomainVerificationStatusRetry) { + this.fetchDomainVerificationStatusRetry = fetchDomainVerificationStatusRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..9f19b7ef5e --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringAutoConfiguration.java @@ -0,0 +1,226 @@ +/* + * 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.discoveryengine.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.discoveryengine.v1.UserEventServiceClient; +import com.google.cloud.discoveryengine.v1.UserEventServiceSettings; +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 UserEventServiceClient}. + * + *

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(UserEventServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.discoveryengine.v1.user-event-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(UserEventServiceSpringProperties.class) +public class UserEventServiceSpringAutoConfiguration { + private final UserEventServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(UserEventServiceSpringAutoConfiguration.class); + + protected UserEventServiceSpringAutoConfiguration( + UserEventServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from UserEventService-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 = "defaultUserEventServiceTransportChannelProvider") + public TransportChannelProvider defaultUserEventServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return UserEventServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return UserEventServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a UserEventServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultUserEventServiceTransportChannelProvider()). 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 UserEventServiceSpringProperties. 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 UserEventServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public UserEventServiceSettings userEventServiceSettings( + @Qualifier("defaultUserEventServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + UserEventServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = UserEventServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = UserEventServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(UserEventServiceSettings.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 = + UserEventServiceSettings.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 writeUserEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeUserEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.writeUserEventSettings().setRetrySettings(writeUserEventRetrySettings); + + RetrySettings collectUserEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.collectUserEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .collectUserEventSettings() + .setRetrySettings(collectUserEventRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry writeUserEventRetry = clientProperties.getWriteUserEventRetry(); + if (writeUserEventRetry != null) { + RetrySettings writeUserEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeUserEventSettings().getRetrySettings(), + writeUserEventRetry); + clientSettingsBuilder.writeUserEventSettings().setRetrySettings(writeUserEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for writeUserEvent from properties."); + } + } + Retry collectUserEventRetry = clientProperties.getCollectUserEventRetry(); + if (collectUserEventRetry != null) { + RetrySettings collectUserEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.collectUserEventSettings().getRetrySettings(), + collectUserEventRetry); + clientSettingsBuilder + .collectUserEventSettings() + .setRetrySettings(collectUserEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for collectUserEvent from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a UserEventServiceClient bean configured with UserEventServiceSettings. + * + * @param userEventServiceSettings settings to configure an instance of client bean. + * @return a {@link UserEventServiceClient} bean configured with {@link UserEventServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public UserEventServiceClient userEventServiceClient( + UserEventServiceSettings userEventServiceSettings) throws IOException { + return UserEventServiceClient.create(userEventServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-user-event-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringProperties.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringProperties.java new file mode 100644 index 0000000000..6b08a1cd40 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/UserEventServiceSpringProperties.java @@ -0,0 +1,108 @@ +/* + * 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.discoveryengine.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 UserEventService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.discoveryengine.v1.user-event-service") +public class UserEventServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 writeUserEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry writeUserEventRetry; + /** + * Allow override of retry settings at method-level for collectUserEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry collectUserEventRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getWriteUserEventRetry() { + return this.writeUserEventRetry; + } + + public void setWriteUserEventRetry(Retry writeUserEventRetry) { + this.writeUserEventRetry = writeUserEventRetry; + } + + public Retry getCollectUserEventRetry() { + return this.collectUserEventRetry; + } + + public void setCollectUserEventRetry(Retry collectUserEventRetry) { + this.collectUserEventRetry = collectUserEventRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/v1/spring/package-info.java new file mode 100644 index 0000000000..48998763a3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/java/com/google/cloud/discoveryengine/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 discoveryengine. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.discoveryengine.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..cfd4e6fc79 --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,88 @@ +{ + "properties": [ + { + "name": "com.google.cloud.discoveryengine.v1.completion-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/CompletionService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.control-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/ControlService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.conversational-search-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/ConversationalSearchService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.data-store-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/DataStoreService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.document-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/DocumentService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.engine-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/EngineService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.grounded-generation-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/GroundedGenerationService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.project-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/ProjectService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.rank-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/RankService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.recommendation-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/RecommendationService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.schema-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/SchemaService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.search-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/SearchService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.site-search-engine-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/SiteSearchEngineService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.discoveryengine.v1.user-event-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud discoveryengine/UserEventService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..c1b710c8ba --- /dev/null +++ b/spring-cloud-previews/google-cloud-discoveryengine-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,14 @@ +com.google.cloud.discoveryengine.v1.spring.CompletionServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.ControlServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.ConversationalSearchServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.DataStoreServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.DocumentServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.EngineServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.GroundedGenerationServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.ProjectServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.RankServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.RecommendationServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.SchemaServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.SearchServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.SiteSearchEngineServiceSpringAutoConfiguration +com.google.cloud.discoveryengine.v1.spring.UserEventServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/pom.xml new file mode 100644 index 0000000000..f454f26896 --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-distributedcloudedge-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - edgecontainer + Spring Boot Starter with AutoConfiguration for edgecontainer + + + + + com.google.cloud + google-cloud-distributedcloudedge + + + + 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-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringAutoConfiguration.java new file mode 100644 index 0000000000..0e7da53ea1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringAutoConfiguration.java @@ -0,0 +1,413 @@ +/* + * 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.edgecontainer.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.edgecontainer.v1.EdgeContainerClient; +import com.google.cloud.edgecontainer.v1.EdgeContainerSettings; +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 EdgeContainerClient}. + * + *

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(EdgeContainerClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.edgecontainer.v1.edge-container.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(EdgeContainerSpringProperties.class) +public class EdgeContainerSpringAutoConfiguration { + private final EdgeContainerSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(EdgeContainerSpringAutoConfiguration.class); + + protected EdgeContainerSpringAutoConfiguration( + EdgeContainerSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from EdgeContainer-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 = "defaultEdgeContainerTransportChannelProvider") + public TransportChannelProvider defaultEdgeContainerTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return EdgeContainerSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return EdgeContainerSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a EdgeContainerSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultEdgeContainerTransportChannelProvider()). 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 EdgeContainerSpringProperties. 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 EdgeContainerSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EdgeContainerSettings edgeContainerSettings( + @Qualifier("defaultEdgeContainerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EdgeContainerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EdgeContainerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EdgeContainerSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EdgeContainerSettings.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 = + EdgeContainerSettings.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 listClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClustersSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings); + + RetrySettings getClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClusterSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings); + + RetrySettings generateAccessTokenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .generateAccessTokenSettings() + .setRetrySettings(generateAccessTokenRetrySettings); + + RetrySettings generateOfflineCredentialRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateOfflineCredentialSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .generateOfflineCredentialSettings() + .setRetrySettings(generateOfflineCredentialRetrySettings); + + RetrySettings listNodePoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNodePoolsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listNodePoolsSettings().setRetrySettings(listNodePoolsRetrySettings); + + RetrySettings getNodePoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNodePoolSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getNodePoolSettings().setRetrySettings(getNodePoolRetrySettings); + + RetrySettings listMachinesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMachinesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listMachinesSettings().setRetrySettings(listMachinesRetrySettings); + + RetrySettings getMachineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMachineSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getMachineSettings().setRetrySettings(getMachineRetrySettings); + + RetrySettings listVpnConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVpnConnectionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listVpnConnectionsSettings() + .setRetrySettings(listVpnConnectionsRetrySettings); + + RetrySettings getVpnConnectionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVpnConnectionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getVpnConnectionSettings() + .setRetrySettings(getVpnConnectionRetrySettings); + + RetrySettings getServerConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServerConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getServerConfigSettings() + .setRetrySettings(getServerConfigRetrySettings); + + 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 listClustersRetry = clientProperties.getListClustersRetry(); + if (listClustersRetry != null) { + RetrySettings listClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClustersSettings().getRetrySettings(), listClustersRetry); + clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listClusters from properties."); + } + } + Retry getClusterRetry = clientProperties.getGetClusterRetry(); + if (getClusterRetry != null) { + RetrySettings getClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClusterSettings().getRetrySettings(), getClusterRetry); + clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCluster from properties."); + } + } + Retry generateAccessTokenRetry = clientProperties.getGenerateAccessTokenRetry(); + if (generateAccessTokenRetry != null) { + RetrySettings generateAccessTokenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(), + generateAccessTokenRetry); + clientSettingsBuilder + .generateAccessTokenSettings() + .setRetrySettings(generateAccessTokenRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for generateAccessToken from properties."); + } + } + Retry generateOfflineCredentialRetry = clientProperties.getGenerateOfflineCredentialRetry(); + if (generateOfflineCredentialRetry != null) { + RetrySettings generateOfflineCredentialRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateOfflineCredentialSettings().getRetrySettings(), + generateOfflineCredentialRetry); + clientSettingsBuilder + .generateOfflineCredentialSettings() + .setRetrySettings(generateOfflineCredentialRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for generateOfflineCredential from properties."); + } + } + Retry listNodePoolsRetry = clientProperties.getListNodePoolsRetry(); + if (listNodePoolsRetry != null) { + RetrySettings listNodePoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNodePoolsSettings().getRetrySettings(), listNodePoolsRetry); + clientSettingsBuilder.listNodePoolsSettings().setRetrySettings(listNodePoolsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listNodePools from properties."); + } + } + Retry getNodePoolRetry = clientProperties.getGetNodePoolRetry(); + if (getNodePoolRetry != null) { + RetrySettings getNodePoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNodePoolSettings().getRetrySettings(), getNodePoolRetry); + clientSettingsBuilder.getNodePoolSettings().setRetrySettings(getNodePoolRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getNodePool from properties."); + } + } + Retry listMachinesRetry = clientProperties.getListMachinesRetry(); + if (listMachinesRetry != null) { + RetrySettings listMachinesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMachinesSettings().getRetrySettings(), listMachinesRetry); + clientSettingsBuilder.listMachinesSettings().setRetrySettings(listMachinesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listMachines from properties."); + } + } + Retry getMachineRetry = clientProperties.getGetMachineRetry(); + if (getMachineRetry != null) { + RetrySettings getMachineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMachineSettings().getRetrySettings(), getMachineRetry); + clientSettingsBuilder.getMachineSettings().setRetrySettings(getMachineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getMachine from properties."); + } + } + Retry listVpnConnectionsRetry = clientProperties.getListVpnConnectionsRetry(); + if (listVpnConnectionsRetry != null) { + RetrySettings listVpnConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVpnConnectionsSettings().getRetrySettings(), + listVpnConnectionsRetry); + clientSettingsBuilder + .listVpnConnectionsSettings() + .setRetrySettings(listVpnConnectionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listVpnConnections from properties."); + } + } + Retry getVpnConnectionRetry = clientProperties.getGetVpnConnectionRetry(); + if (getVpnConnectionRetry != null) { + RetrySettings getVpnConnectionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVpnConnectionSettings().getRetrySettings(), + getVpnConnectionRetry); + clientSettingsBuilder + .getVpnConnectionSettings() + .setRetrySettings(getVpnConnectionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getVpnConnection from properties."); + } + } + Retry getServerConfigRetry = clientProperties.getGetServerConfigRetry(); + if (getServerConfigRetry != null) { + RetrySettings getServerConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServerConfigSettings().getRetrySettings(), + getServerConfigRetry); + clientSettingsBuilder + .getServerConfigSettings() + .setRetrySettings(getServerConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getServerConfig 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 EdgeContainerClient bean configured with EdgeContainerSettings. + * + * @param edgeContainerSettings settings to configure an instance of client bean. + * @return a {@link EdgeContainerClient} bean configured with {@link EdgeContainerSettings} + */ + @Bean + @ConditionalOnMissingBean + public EdgeContainerClient edgeContainerClient(EdgeContainerSettings edgeContainerSettings) + throws IOException { + return EdgeContainerClient.create(edgeContainerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-edge-container"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringProperties.java b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringProperties.java new file mode 100644 index 0000000000..b9541a2eae --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/EdgeContainerSpringProperties.java @@ -0,0 +1,251 @@ +/* + * 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.edgecontainer.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 EdgeContainer client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.edgecontainer.v1.edge-container") +public class EdgeContainerSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listClusters. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listClustersRetry; + /** + * Allow override of retry settings at method-level for getCluster. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getClusterRetry; + /** + * Allow override of retry settings at method-level for generateAccessToken. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry generateAccessTokenRetry; + /** + * Allow override of retry settings at method-level for generateOfflineCredential. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry generateOfflineCredentialRetry; + /** + * Allow override of retry settings at method-level for listNodePools. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNodePoolsRetry; + /** + * Allow override of retry settings at method-level for getNodePool. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNodePoolRetry; + /** + * Allow override of retry settings at method-level for listMachines. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listMachinesRetry; + /** + * Allow override of retry settings at method-level for getMachine. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getMachineRetry; + /** + * Allow override of retry settings at method-level for listVpnConnections. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listVpnConnectionsRetry; + /** + * Allow override of retry settings at method-level for getVpnConnection. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getVpnConnectionRetry; + /** + * Allow override of retry settings at method-level for getServerConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getServerConfigRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListClustersRetry() { + return this.listClustersRetry; + } + + public void setListClustersRetry(Retry listClustersRetry) { + this.listClustersRetry = listClustersRetry; + } + + public Retry getGetClusterRetry() { + return this.getClusterRetry; + } + + public void setGetClusterRetry(Retry getClusterRetry) { + this.getClusterRetry = getClusterRetry; + } + + public Retry getGenerateAccessTokenRetry() { + return this.generateAccessTokenRetry; + } + + public void setGenerateAccessTokenRetry(Retry generateAccessTokenRetry) { + this.generateAccessTokenRetry = generateAccessTokenRetry; + } + + public Retry getGenerateOfflineCredentialRetry() { + return this.generateOfflineCredentialRetry; + } + + public void setGenerateOfflineCredentialRetry(Retry generateOfflineCredentialRetry) { + this.generateOfflineCredentialRetry = generateOfflineCredentialRetry; + } + + public Retry getListNodePoolsRetry() { + return this.listNodePoolsRetry; + } + + public void setListNodePoolsRetry(Retry listNodePoolsRetry) { + this.listNodePoolsRetry = listNodePoolsRetry; + } + + public Retry getGetNodePoolRetry() { + return this.getNodePoolRetry; + } + + public void setGetNodePoolRetry(Retry getNodePoolRetry) { + this.getNodePoolRetry = getNodePoolRetry; + } + + public Retry getListMachinesRetry() { + return this.listMachinesRetry; + } + + public void setListMachinesRetry(Retry listMachinesRetry) { + this.listMachinesRetry = listMachinesRetry; + } + + public Retry getGetMachineRetry() { + return this.getMachineRetry; + } + + public void setGetMachineRetry(Retry getMachineRetry) { + this.getMachineRetry = getMachineRetry; + } + + public Retry getListVpnConnectionsRetry() { + return this.listVpnConnectionsRetry; + } + + public void setListVpnConnectionsRetry(Retry listVpnConnectionsRetry) { + this.listVpnConnectionsRetry = listVpnConnectionsRetry; + } + + public Retry getGetVpnConnectionRetry() { + return this.getVpnConnectionRetry; + } + + public void setGetVpnConnectionRetry(Retry getVpnConnectionRetry) { + this.getVpnConnectionRetry = getVpnConnectionRetry; + } + + public Retry getGetServerConfigRetry() { + return this.getServerConfigRetry; + } + + public void setGetServerConfigRetry(Retry getServerConfigRetry) { + this.getServerConfigRetry = getServerConfigRetry; + } + + 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-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/v1/spring/package-info.java new file mode 100644 index 0000000000..9fb2d21790 --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/java/com/google/cloud/edgecontainer/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 edgecontainer. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.edgecontainer.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..fa53e630f9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.edgecontainer.v1.edge-container.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud edgecontainer/EdgeContainer components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..054e2221b1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-distributedcloudedge-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.edgecontainer.v1.spring.EdgeContainerSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringAutoConfiguration.java index a59b40e038..bfafc48fcd 100644 --- a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public DlpServiceSettings dlpServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DlpServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringAutoConfiguration.java index 9f4c343ecb..9cb10f4123 100644 --- a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public DataMigrationServiceSettings dataMigrationServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DataMigrationServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringAutoConfiguration.java index f99b31f188..5306353a12 100644 --- a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public DocumentProcessorServiceSettings documentProcessorServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DocumentProcessorServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringAutoConfiguration.java index 5a865c5018..5d7a0f36d5 100644 --- a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public DomainsSettings domainsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DomainsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/pom.xml new file mode 100644 index 0000000000..bfcfb6263e --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-edgenetwork-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - edgenetwork + Spring Boot Starter with AutoConfiguration for edgenetwork + + + + + com.google.cloud + google-cloud-edgenetwork + + + + 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-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringAutoConfiguration.java new file mode 100644 index 0000000000..743ecc6b79 --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringAutoConfiguration.java @@ -0,0 +1,496 @@ +/* + * 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.edgenetwork.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.edgenetwork.v1.EdgeNetworkClient; +import com.google.cloud.edgenetwork.v1.EdgeNetworkSettings; +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 EdgeNetworkClient}. + * + *

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(EdgeNetworkClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.edgenetwork.v1.edge-network.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(EdgeNetworkSpringProperties.class) +public class EdgeNetworkSpringAutoConfiguration { + private final EdgeNetworkSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(EdgeNetworkSpringAutoConfiguration.class); + + protected EdgeNetworkSpringAutoConfiguration( + EdgeNetworkSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from EdgeNetwork-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 = "defaultEdgeNetworkTransportChannelProvider") + public TransportChannelProvider defaultEdgeNetworkTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return EdgeNetworkSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return EdgeNetworkSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a EdgeNetworkSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultEdgeNetworkTransportChannelProvider()). 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 EdgeNetworkSpringProperties. 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 EdgeNetworkSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EdgeNetworkSettings edgeNetworkSettings( + @Qualifier("defaultEdgeNetworkTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EdgeNetworkSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EdgeNetworkSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EdgeNetworkSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EdgeNetworkSettings.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 = + EdgeNetworkSettings.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 initializeZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.initializeZoneSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.initializeZoneSettings().setRetrySettings(initializeZoneRetrySettings); + + RetrySettings listZonesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZonesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listZonesSettings().setRetrySettings(listZonesRetrySettings); + + RetrySettings getZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getZoneSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getZoneSettings().setRetrySettings(getZoneRetrySettings); + + RetrySettings listNetworksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNetworksSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listNetworksSettings().setRetrySettings(listNetworksRetrySettings); + + RetrySettings getNetworkRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNetworkSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getNetworkSettings().setRetrySettings(getNetworkRetrySettings); + + RetrySettings diagnoseNetworkRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseNetworkSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .diagnoseNetworkSettings() + .setRetrySettings(diagnoseNetworkRetrySettings); + + RetrySettings listSubnetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSubnetsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSubnetsSettings().setRetrySettings(listSubnetsRetrySettings); + + RetrySettings getSubnetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSubnetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSubnetSettings().setRetrySettings(getSubnetRetrySettings); + + RetrySettings listInterconnectsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInterconnectsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listInterconnectsSettings() + .setRetrySettings(listInterconnectsRetrySettings); + + RetrySettings getInterconnectRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInterconnectSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getInterconnectSettings() + .setRetrySettings(getInterconnectRetrySettings); + + RetrySettings diagnoseInterconnectRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseInterconnectSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .diagnoseInterconnectSettings() + .setRetrySettings(diagnoseInterconnectRetrySettings); + + RetrySettings listInterconnectAttachmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInterconnectAttachmentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listInterconnectAttachmentsSettings() + .setRetrySettings(listInterconnectAttachmentsRetrySettings); + + RetrySettings getInterconnectAttachmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInterconnectAttachmentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getInterconnectAttachmentSettings() + .setRetrySettings(getInterconnectAttachmentRetrySettings); + + RetrySettings listRoutersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRoutersSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRoutersSettings().setRetrySettings(listRoutersRetrySettings); + + RetrySettings getRouterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRouterSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRouterSettings().setRetrySettings(getRouterRetrySettings); + + RetrySettings diagnoseRouterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseRouterSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.diagnoseRouterSettings().setRetrySettings(diagnoseRouterRetrySettings); + + 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 initializeZoneRetry = clientProperties.getInitializeZoneRetry(); + if (initializeZoneRetry != null) { + RetrySettings initializeZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.initializeZoneSettings().getRetrySettings(), + initializeZoneRetry); + clientSettingsBuilder.initializeZoneSettings().setRetrySettings(initializeZoneRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for initializeZone from properties."); + } + } + Retry listZonesRetry = clientProperties.getListZonesRetry(); + if (listZonesRetry != null) { + RetrySettings listZonesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZonesSettings().getRetrySettings(), listZonesRetry); + clientSettingsBuilder.listZonesSettings().setRetrySettings(listZonesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listZones from properties."); + } + } + Retry getZoneRetry = clientProperties.getGetZoneRetry(); + if (getZoneRetry != null) { + RetrySettings getZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getZoneSettings().getRetrySettings(), getZoneRetry); + clientSettingsBuilder.getZoneSettings().setRetrySettings(getZoneRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getZone from properties."); + } + } + Retry listNetworksRetry = clientProperties.getListNetworksRetry(); + if (listNetworksRetry != null) { + RetrySettings listNetworksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNetworksSettings().getRetrySettings(), listNetworksRetry); + clientSettingsBuilder.listNetworksSettings().setRetrySettings(listNetworksRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listNetworks from properties."); + } + } + Retry getNetworkRetry = clientProperties.getGetNetworkRetry(); + if (getNetworkRetry != null) { + RetrySettings getNetworkRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNetworkSettings().getRetrySettings(), getNetworkRetry); + clientSettingsBuilder.getNetworkSettings().setRetrySettings(getNetworkRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getNetwork from properties."); + } + } + Retry diagnoseNetworkRetry = clientProperties.getDiagnoseNetworkRetry(); + if (diagnoseNetworkRetry != null) { + RetrySettings diagnoseNetworkRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseNetworkSettings().getRetrySettings(), + diagnoseNetworkRetry); + clientSettingsBuilder + .diagnoseNetworkSettings() + .setRetrySettings(diagnoseNetworkRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for diagnoseNetwork from properties."); + } + } + Retry listSubnetsRetry = clientProperties.getListSubnetsRetry(); + if (listSubnetsRetry != null) { + RetrySettings listSubnetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSubnetsSettings().getRetrySettings(), listSubnetsRetry); + clientSettingsBuilder.listSubnetsSettings().setRetrySettings(listSubnetsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSubnets from properties."); + } + } + Retry getSubnetRetry = clientProperties.getGetSubnetRetry(); + if (getSubnetRetry != null) { + RetrySettings getSubnetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSubnetSettings().getRetrySettings(), getSubnetRetry); + clientSettingsBuilder.getSubnetSettings().setRetrySettings(getSubnetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSubnet from properties."); + } + } + Retry listInterconnectsRetry = clientProperties.getListInterconnectsRetry(); + if (listInterconnectsRetry != null) { + RetrySettings listInterconnectsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInterconnectsSettings().getRetrySettings(), + listInterconnectsRetry); + clientSettingsBuilder + .listInterconnectsSettings() + .setRetrySettings(listInterconnectsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listInterconnects from properties."); + } + } + Retry getInterconnectRetry = clientProperties.getGetInterconnectRetry(); + if (getInterconnectRetry != null) { + RetrySettings getInterconnectRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInterconnectSettings().getRetrySettings(), + getInterconnectRetry); + clientSettingsBuilder + .getInterconnectSettings() + .setRetrySettings(getInterconnectRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getInterconnect from properties."); + } + } + Retry diagnoseInterconnectRetry = clientProperties.getDiagnoseInterconnectRetry(); + if (diagnoseInterconnectRetry != null) { + RetrySettings diagnoseInterconnectRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseInterconnectSettings().getRetrySettings(), + diagnoseInterconnectRetry); + clientSettingsBuilder + .diagnoseInterconnectSettings() + .setRetrySettings(diagnoseInterconnectRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for diagnoseInterconnect from properties."); + } + } + Retry listInterconnectAttachmentsRetry = clientProperties.getListInterconnectAttachmentsRetry(); + if (listInterconnectAttachmentsRetry != null) { + RetrySettings listInterconnectAttachmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInterconnectAttachmentsSettings().getRetrySettings(), + listInterconnectAttachmentsRetry); + clientSettingsBuilder + .listInterconnectAttachmentsSettings() + .setRetrySettings(listInterconnectAttachmentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listInterconnectAttachments from properties."); + } + } + Retry getInterconnectAttachmentRetry = clientProperties.getGetInterconnectAttachmentRetry(); + if (getInterconnectAttachmentRetry != null) { + RetrySettings getInterconnectAttachmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInterconnectAttachmentSettings().getRetrySettings(), + getInterconnectAttachmentRetry); + clientSettingsBuilder + .getInterconnectAttachmentSettings() + .setRetrySettings(getInterconnectAttachmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getInterconnectAttachment from properties."); + } + } + Retry listRoutersRetry = clientProperties.getListRoutersRetry(); + if (listRoutersRetry != null) { + RetrySettings listRoutersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRoutersSettings().getRetrySettings(), listRoutersRetry); + clientSettingsBuilder.listRoutersSettings().setRetrySettings(listRoutersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRouters from properties."); + } + } + Retry getRouterRetry = clientProperties.getGetRouterRetry(); + if (getRouterRetry != null) { + RetrySettings getRouterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRouterSettings().getRetrySettings(), getRouterRetry); + clientSettingsBuilder.getRouterSettings().setRetrySettings(getRouterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRouter from properties."); + } + } + Retry diagnoseRouterRetry = clientProperties.getDiagnoseRouterRetry(); + if (diagnoseRouterRetry != null) { + RetrySettings diagnoseRouterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.diagnoseRouterSettings().getRetrySettings(), + diagnoseRouterRetry); + clientSettingsBuilder.diagnoseRouterSettings().setRetrySettings(diagnoseRouterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for diagnoseRouter 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 EdgeNetworkClient bean configured with EdgeNetworkSettings. + * + * @param edgeNetworkSettings settings to configure an instance of client bean. + * @return a {@link EdgeNetworkClient} bean configured with {@link EdgeNetworkSettings} + */ + @Bean + @ConditionalOnMissingBean + public EdgeNetworkClient edgeNetworkClient(EdgeNetworkSettings edgeNetworkSettings) + throws IOException { + return EdgeNetworkClient.create(edgeNetworkSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-edge-network"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringProperties.java b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringProperties.java new file mode 100644 index 0000000000..bec20bf0f7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/EdgeNetworkSpringProperties.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.edgenetwork.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 EdgeNetwork client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.edgenetwork.v1.edge-network") +public class EdgeNetworkSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 initializeZone. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry initializeZoneRetry; + /** + * Allow override of retry settings at method-level for listZones. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listZonesRetry; + /** + * Allow override of retry settings at method-level for getZone. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getZoneRetry; + /** + * Allow override of retry settings at method-level for listNetworks. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNetworksRetry; + /** + * Allow override of retry settings at method-level for getNetwork. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNetworkRetry; + /** + * Allow override of retry settings at method-level for diagnoseNetwork. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry diagnoseNetworkRetry; + /** + * Allow override of retry settings at method-level for listSubnets. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSubnetsRetry; + /** + * Allow override of retry settings at method-level for getSubnet. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSubnetRetry; + /** + * Allow override of retry settings at method-level for listInterconnects. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listInterconnectsRetry; + /** + * Allow override of retry settings at method-level for getInterconnect. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getInterconnectRetry; + /** + * Allow override of retry settings at method-level for diagnoseInterconnect. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry diagnoseInterconnectRetry; + /** + * Allow override of retry settings at method-level for listInterconnectAttachments. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listInterconnectAttachmentsRetry; + /** + * Allow override of retry settings at method-level for getInterconnectAttachment. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getInterconnectAttachmentRetry; + /** + * Allow override of retry settings at method-level for listRouters. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRoutersRetry; + /** + * Allow override of retry settings at method-level for getRouter. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRouterRetry; + /** + * Allow override of retry settings at method-level for diagnoseRouter. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry diagnoseRouterRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getInitializeZoneRetry() { + return this.initializeZoneRetry; + } + + public void setInitializeZoneRetry(Retry initializeZoneRetry) { + this.initializeZoneRetry = initializeZoneRetry; + } + + public Retry getListZonesRetry() { + return this.listZonesRetry; + } + + public void setListZonesRetry(Retry listZonesRetry) { + this.listZonesRetry = listZonesRetry; + } + + public Retry getGetZoneRetry() { + return this.getZoneRetry; + } + + public void setGetZoneRetry(Retry getZoneRetry) { + this.getZoneRetry = getZoneRetry; + } + + public Retry getListNetworksRetry() { + return this.listNetworksRetry; + } + + public void setListNetworksRetry(Retry listNetworksRetry) { + this.listNetworksRetry = listNetworksRetry; + } + + public Retry getGetNetworkRetry() { + return this.getNetworkRetry; + } + + public void setGetNetworkRetry(Retry getNetworkRetry) { + this.getNetworkRetry = getNetworkRetry; + } + + public Retry getDiagnoseNetworkRetry() { + return this.diagnoseNetworkRetry; + } + + public void setDiagnoseNetworkRetry(Retry diagnoseNetworkRetry) { + this.diagnoseNetworkRetry = diagnoseNetworkRetry; + } + + public Retry getListSubnetsRetry() { + return this.listSubnetsRetry; + } + + public void setListSubnetsRetry(Retry listSubnetsRetry) { + this.listSubnetsRetry = listSubnetsRetry; + } + + public Retry getGetSubnetRetry() { + return this.getSubnetRetry; + } + + public void setGetSubnetRetry(Retry getSubnetRetry) { + this.getSubnetRetry = getSubnetRetry; + } + + public Retry getListInterconnectsRetry() { + return this.listInterconnectsRetry; + } + + public void setListInterconnectsRetry(Retry listInterconnectsRetry) { + this.listInterconnectsRetry = listInterconnectsRetry; + } + + public Retry getGetInterconnectRetry() { + return this.getInterconnectRetry; + } + + public void setGetInterconnectRetry(Retry getInterconnectRetry) { + this.getInterconnectRetry = getInterconnectRetry; + } + + public Retry getDiagnoseInterconnectRetry() { + return this.diagnoseInterconnectRetry; + } + + public void setDiagnoseInterconnectRetry(Retry diagnoseInterconnectRetry) { + this.diagnoseInterconnectRetry = diagnoseInterconnectRetry; + } + + public Retry getListInterconnectAttachmentsRetry() { + return this.listInterconnectAttachmentsRetry; + } + + public void setListInterconnectAttachmentsRetry(Retry listInterconnectAttachmentsRetry) { + this.listInterconnectAttachmentsRetry = listInterconnectAttachmentsRetry; + } + + public Retry getGetInterconnectAttachmentRetry() { + return this.getInterconnectAttachmentRetry; + } + + public void setGetInterconnectAttachmentRetry(Retry getInterconnectAttachmentRetry) { + this.getInterconnectAttachmentRetry = getInterconnectAttachmentRetry; + } + + public Retry getListRoutersRetry() { + return this.listRoutersRetry; + } + + public void setListRoutersRetry(Retry listRoutersRetry) { + this.listRoutersRetry = listRoutersRetry; + } + + public Retry getGetRouterRetry() { + return this.getRouterRetry; + } + + public void setGetRouterRetry(Retry getRouterRetry) { + this.getRouterRetry = getRouterRetry; + } + + public Retry getDiagnoseRouterRetry() { + return this.diagnoseRouterRetry; + } + + public void setDiagnoseRouterRetry(Retry diagnoseRouterRetry) { + this.diagnoseRouterRetry = diagnoseRouterRetry; + } + + 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-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/v1/spring/package-info.java new file mode 100644 index 0000000000..629e3458f5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/java/com/google/cloud/edgenetwork/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 edgenetwork. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.edgenetwork.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..ea548bb72d --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.edgenetwork.v1.edge-network.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud edgenetwork/EdgeNetwork components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..55be4732c5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-edgenetwork-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.edgenetwork.v1.spring.EdgeNetworkSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringAutoConfiguration.java index 55db841c9b..56c992866d 100644 --- a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public EssentialContactsServiceSettings essentialContactsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EssentialContactsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringAutoConfiguration.java index 114f2ff4e1..33b09b7fca 100644 --- a/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public EventarcSettings eventarcSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EventarcSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringAutoConfiguration.java index a17cf28bc4..7ff8204a75 100644 --- a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public CloudFilestoreManagerSettings cloudFilestoreManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudFilestoreManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringAutoConfiguration.java index 175f3d39c4..54bb3089bd 100644 --- a/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public FunctionServiceSettings functionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FunctionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringAutoConfiguration.java index af2755b6ab..91b3b6ac64 100644 --- a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public GkeHubSettings gkeHubSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GkeHubSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringAutoConfiguration.java index 960a8c764a..31a4892075 100644 --- a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public GSuiteAddOnsSettings gSuiteAddOnsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GSuiteAddOnsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringAutoConfiguration.java index bd918b723e..358ec29794 100644 --- a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public IamCredentialsSettings iAMCredentialsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IamCredentialsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-iap-spring-starter/pom.xml new file mode 100644 index 0000000000..8d8b20a425 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-iap-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - iap + Spring Boot Starter with AutoConfiguration for iap + + + + + com.google.cloud + google-cloud-iap + + + + 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-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..c56ab98ba4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringAutoConfiguration.java @@ -0,0 +1,392 @@ +/* + * 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.iap.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.iap.v1.IdentityAwareProxyAdminServiceClient; +import com.google.cloud.iap.v1.IdentityAwareProxyAdminServiceSettings; +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 IdentityAwareProxyAdminServiceClient}. + * + *

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(IdentityAwareProxyAdminServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.iap.v1.identity-aware-proxy-admin-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(IdentityAwareProxyAdminServiceSpringProperties.class) +public class IdentityAwareProxyAdminServiceSpringAutoConfiguration { + private final IdentityAwareProxyAdminServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(IdentityAwareProxyAdminServiceSpringAutoConfiguration.class); + + protected IdentityAwareProxyAdminServiceSpringAutoConfiguration( + IdentityAwareProxyAdminServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Using credentials from IdentityAwareProxyAdminService-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 = "defaultIdentityAwareProxyAdminServiceTransportChannelProvider") + public TransportChannelProvider defaultIdentityAwareProxyAdminServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return IdentityAwareProxyAdminServiceSettings.defaultHttpJsonTransportProviderBuilder() + .build(); + } + return IdentityAwareProxyAdminServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a IdentityAwareProxyAdminServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultIdentityAwareProxyAdminServiceTransportChannelProvider()). 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 IdentityAwareProxyAdminServiceSpringProperties. 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 IdentityAwareProxyAdminServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public IdentityAwareProxyAdminServiceSettings identityAwareProxyAdminServiceSettings( + @Qualifier("defaultIdentityAwareProxyAdminServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + IdentityAwareProxyAdminServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = IdentityAwareProxyAdminServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = IdentityAwareProxyAdminServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IdentityAwareProxyAdminServiceSettings.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 = + IdentityAwareProxyAdminServiceSettings.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 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); + + RetrySettings getIapSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIapSettingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIapSettingsSettings().setRetrySettings(getIapSettingsRetrySettings); + + RetrySettings updateIapSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIapSettingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateIapSettingsSettings() + .setRetrySettings(updateIapSettingsRetrySettings); + + RetrySettings listTunnelDestGroupsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTunnelDestGroupsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listTunnelDestGroupsSettings() + .setRetrySettings(listTunnelDestGroupsRetrySettings); + + RetrySettings createTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTunnelDestGroupSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTunnelDestGroupSettings() + .setRetrySettings(createTunnelDestGroupRetrySettings); + + RetrySettings getTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTunnelDestGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getTunnelDestGroupSettings() + .setRetrySettings(getTunnelDestGroupRetrySettings); + + RetrySettings deleteTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTunnelDestGroupSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteTunnelDestGroupSettings() + .setRetrySettings(deleteTunnelDestGroupRetrySettings); + + RetrySettings updateTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTunnelDestGroupSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateTunnelDestGroupSettings() + .setRetrySettings(updateTunnelDestGroupRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings 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."); + } + } + Retry getIapSettingsRetry = clientProperties.getGetIapSettingsRetry(); + if (getIapSettingsRetry != null) { + RetrySettings getIapSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIapSettingsSettings().getRetrySettings(), + getIapSettingsRetry); + clientSettingsBuilder.getIapSettingsSettings().setRetrySettings(getIapSettingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIapSettings from properties."); + } + } + Retry updateIapSettingsRetry = clientProperties.getUpdateIapSettingsRetry(); + if (updateIapSettingsRetry != null) { + RetrySettings updateIapSettingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIapSettingsSettings().getRetrySettings(), + updateIapSettingsRetry); + clientSettingsBuilder + .updateIapSettingsSettings() + .setRetrySettings(updateIapSettingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateIapSettings from properties."); + } + } + Retry listTunnelDestGroupsRetry = clientProperties.getListTunnelDestGroupsRetry(); + if (listTunnelDestGroupsRetry != null) { + RetrySettings listTunnelDestGroupsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTunnelDestGroupsSettings().getRetrySettings(), + listTunnelDestGroupsRetry); + clientSettingsBuilder + .listTunnelDestGroupsSettings() + .setRetrySettings(listTunnelDestGroupsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTunnelDestGroups from properties."); + } + } + Retry createTunnelDestGroupRetry = clientProperties.getCreateTunnelDestGroupRetry(); + if (createTunnelDestGroupRetry != null) { + RetrySettings createTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTunnelDestGroupSettings().getRetrySettings(), + createTunnelDestGroupRetry); + clientSettingsBuilder + .createTunnelDestGroupSettings() + .setRetrySettings(createTunnelDestGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTunnelDestGroup from properties."); + } + } + Retry getTunnelDestGroupRetry = clientProperties.getGetTunnelDestGroupRetry(); + if (getTunnelDestGroupRetry != null) { + RetrySettings getTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTunnelDestGroupSettings().getRetrySettings(), + getTunnelDestGroupRetry); + clientSettingsBuilder + .getTunnelDestGroupSettings() + .setRetrySettings(getTunnelDestGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTunnelDestGroup from properties."); + } + } + Retry deleteTunnelDestGroupRetry = clientProperties.getDeleteTunnelDestGroupRetry(); + if (deleteTunnelDestGroupRetry != null) { + RetrySettings deleteTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTunnelDestGroupSettings().getRetrySettings(), + deleteTunnelDestGroupRetry); + clientSettingsBuilder + .deleteTunnelDestGroupSettings() + .setRetrySettings(deleteTunnelDestGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteTunnelDestGroup from properties."); + } + } + Retry updateTunnelDestGroupRetry = clientProperties.getUpdateTunnelDestGroupRetry(); + if (updateTunnelDestGroupRetry != null) { + RetrySettings updateTunnelDestGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTunnelDestGroupSettings().getRetrySettings(), + updateTunnelDestGroupRetry); + clientSettingsBuilder + .updateTunnelDestGroupSettings() + .setRetrySettings(updateTunnelDestGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTunnelDestGroup from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a IdentityAwareProxyAdminServiceClient bean configured with + * IdentityAwareProxyAdminServiceSettings. + * + * @param identityAwareProxyAdminServiceSettings settings to configure an instance of client bean. + * @return a {@link IdentityAwareProxyAdminServiceClient} bean configured with {@link + * IdentityAwareProxyAdminServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public IdentityAwareProxyAdminServiceClient identityAwareProxyAdminServiceClient( + IdentityAwareProxyAdminServiceSettings identityAwareProxyAdminServiceSettings) + throws IOException { + return IdentityAwareProxyAdminServiceClient.create(identityAwareProxyAdminServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-identity-aware-proxy-admin-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringProperties.java b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringProperties.java new file mode 100644 index 0000000000..afc844935a --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyAdminServiceSpringProperties.java @@ -0,0 +1,212 @@ +/* + * 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.iap.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 IdentityAwareProxyAdminService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.iap.v1.identity-aware-proxy-admin-service") +public class IdentityAwareProxyAdminServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 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; + /** + * Allow override of retry settings at method-level for getIapSettings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIapSettingsRetry; + /** + * Allow override of retry settings at method-level for updateIapSettings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateIapSettingsRetry; + /** + * Allow override of retry settings at method-level for listTunnelDestGroups. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTunnelDestGroupsRetry; + /** + * Allow override of retry settings at method-level for createTunnelDestGroup. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTunnelDestGroupRetry; + /** + * Allow override of retry settings at method-level for getTunnelDestGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTunnelDestGroupRetry; + /** + * Allow override of retry settings at method-level for deleteTunnelDestGroup. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteTunnelDestGroupRetry; + /** + * Allow override of retry settings at method-level for updateTunnelDestGroup. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTunnelDestGroupRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 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; + } + + public Retry getGetIapSettingsRetry() { + return this.getIapSettingsRetry; + } + + public void setGetIapSettingsRetry(Retry getIapSettingsRetry) { + this.getIapSettingsRetry = getIapSettingsRetry; + } + + public Retry getUpdateIapSettingsRetry() { + return this.updateIapSettingsRetry; + } + + public void setUpdateIapSettingsRetry(Retry updateIapSettingsRetry) { + this.updateIapSettingsRetry = updateIapSettingsRetry; + } + + public Retry getListTunnelDestGroupsRetry() { + return this.listTunnelDestGroupsRetry; + } + + public void setListTunnelDestGroupsRetry(Retry listTunnelDestGroupsRetry) { + this.listTunnelDestGroupsRetry = listTunnelDestGroupsRetry; + } + + public Retry getCreateTunnelDestGroupRetry() { + return this.createTunnelDestGroupRetry; + } + + public void setCreateTunnelDestGroupRetry(Retry createTunnelDestGroupRetry) { + this.createTunnelDestGroupRetry = createTunnelDestGroupRetry; + } + + public Retry getGetTunnelDestGroupRetry() { + return this.getTunnelDestGroupRetry; + } + + public void setGetTunnelDestGroupRetry(Retry getTunnelDestGroupRetry) { + this.getTunnelDestGroupRetry = getTunnelDestGroupRetry; + } + + public Retry getDeleteTunnelDestGroupRetry() { + return this.deleteTunnelDestGroupRetry; + } + + public void setDeleteTunnelDestGroupRetry(Retry deleteTunnelDestGroupRetry) { + this.deleteTunnelDestGroupRetry = deleteTunnelDestGroupRetry; + } + + public Retry getUpdateTunnelDestGroupRetry() { + return this.updateTunnelDestGroupRetry; + } + + public void setUpdateTunnelDestGroupRetry(Retry updateTunnelDestGroupRetry) { + this.updateTunnelDestGroupRetry = updateTunnelDestGroupRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..26792e244d --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringAutoConfiguration.java @@ -0,0 +1,358 @@ +/* + * 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.iap.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.iap.v1.IdentityAwareProxyOAuthServiceClient; +import com.google.cloud.iap.v1.IdentityAwareProxyOAuthServiceSettings; +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 IdentityAwareProxyOAuthServiceClient}. + * + *

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(IdentityAwareProxyOAuthServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.iap.v1.identity-aware-proxy-o-auth-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(IdentityAwareProxyOAuthServiceSpringProperties.class) +public class IdentityAwareProxyOAuthServiceSpringAutoConfiguration { + private final IdentityAwareProxyOAuthServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(IdentityAwareProxyOAuthServiceSpringAutoConfiguration.class); + + protected IdentityAwareProxyOAuthServiceSpringAutoConfiguration( + IdentityAwareProxyOAuthServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Using credentials from IdentityAwareProxyOAuthService-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 = "defaultIdentityAwareProxyOAuthServiceTransportChannelProvider") + public TransportChannelProvider defaultIdentityAwareProxyOAuthServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return IdentityAwareProxyOAuthServiceSettings.defaultHttpJsonTransportProviderBuilder() + .build(); + } + return IdentityAwareProxyOAuthServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a IdentityAwareProxyOAuthServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultIdentityAwareProxyOAuthServiceTransportChannelProvider()). 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 IdentityAwareProxyOAuthServiceSpringProperties. 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 IdentityAwareProxyOAuthServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public IdentityAwareProxyOAuthServiceSettings identityAwareProxyOAuthServiceSettings( + @Qualifier("defaultIdentityAwareProxyOAuthServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + IdentityAwareProxyOAuthServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = IdentityAwareProxyOAuthServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = IdentityAwareProxyOAuthServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IdentityAwareProxyOAuthServiceSettings.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 = + IdentityAwareProxyOAuthServiceSettings.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 listBrandsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBrandsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listBrandsSettings().setRetrySettings(listBrandsRetrySettings); + + RetrySettings createBrandRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBrandSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createBrandSettings().setRetrySettings(createBrandRetrySettings); + + RetrySettings getBrandRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBrandSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getBrandSettings().setRetrySettings(getBrandRetrySettings); + + RetrySettings createIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIdentityAwareProxyClientSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createIdentityAwareProxyClientSettings() + .setRetrySettings(createIdentityAwareProxyClientRetrySettings); + + RetrySettings listIdentityAwareProxyClientsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIdentityAwareProxyClientsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listIdentityAwareProxyClientsSettings() + .setRetrySettings(listIdentityAwareProxyClientsRetrySettings); + + RetrySettings getIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIdentityAwareProxyClientSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getIdentityAwareProxyClientSettings() + .setRetrySettings(getIdentityAwareProxyClientRetrySettings); + + RetrySettings resetIdentityAwareProxyClientSecretRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .resetIdentityAwareProxyClientSecretSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .resetIdentityAwareProxyClientSecretSettings() + .setRetrySettings(resetIdentityAwareProxyClientSecretRetrySettings); + + RetrySettings deleteIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIdentityAwareProxyClientSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteIdentityAwareProxyClientSettings() + .setRetrySettings(deleteIdentityAwareProxyClientRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listBrandsRetry = clientProperties.getListBrandsRetry(); + if (listBrandsRetry != null) { + RetrySettings listBrandsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBrandsSettings().getRetrySettings(), listBrandsRetry); + clientSettingsBuilder.listBrandsSettings().setRetrySettings(listBrandsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listBrands from properties."); + } + } + Retry createBrandRetry = clientProperties.getCreateBrandRetry(); + if (createBrandRetry != null) { + RetrySettings createBrandRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBrandSettings().getRetrySettings(), createBrandRetry); + clientSettingsBuilder.createBrandSettings().setRetrySettings(createBrandRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createBrand from properties."); + } + } + Retry getBrandRetry = clientProperties.getGetBrandRetry(); + if (getBrandRetry != null) { + RetrySettings getBrandRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBrandSettings().getRetrySettings(), getBrandRetry); + clientSettingsBuilder.getBrandSettings().setRetrySettings(getBrandRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getBrand from properties."); + } + } + Retry createIdentityAwareProxyClientRetry = + clientProperties.getCreateIdentityAwareProxyClientRetry(); + if (createIdentityAwareProxyClientRetry != null) { + RetrySettings createIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIdentityAwareProxyClientSettings().getRetrySettings(), + createIdentityAwareProxyClientRetry); + clientSettingsBuilder + .createIdentityAwareProxyClientSettings() + .setRetrySettings(createIdentityAwareProxyClientRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createIdentityAwareProxyClient from properties."); + } + } + Retry listIdentityAwareProxyClientsRetry = + clientProperties.getListIdentityAwareProxyClientsRetry(); + if (listIdentityAwareProxyClientsRetry != null) { + RetrySettings listIdentityAwareProxyClientsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIdentityAwareProxyClientsSettings().getRetrySettings(), + listIdentityAwareProxyClientsRetry); + clientSettingsBuilder + .listIdentityAwareProxyClientsSettings() + .setRetrySettings(listIdentityAwareProxyClientsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listIdentityAwareProxyClients from properties."); + } + } + Retry getIdentityAwareProxyClientRetry = clientProperties.getGetIdentityAwareProxyClientRetry(); + if (getIdentityAwareProxyClientRetry != null) { + RetrySettings getIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIdentityAwareProxyClientSettings().getRetrySettings(), + getIdentityAwareProxyClientRetry); + clientSettingsBuilder + .getIdentityAwareProxyClientSettings() + .setRetrySettings(getIdentityAwareProxyClientRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getIdentityAwareProxyClient from properties."); + } + } + Retry resetIdentityAwareProxyClientSecretRetry = + clientProperties.getResetIdentityAwareProxyClientSecretRetry(); + if (resetIdentityAwareProxyClientSecretRetry != null) { + RetrySettings resetIdentityAwareProxyClientSecretRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .resetIdentityAwareProxyClientSecretSettings() + .getRetrySettings(), + resetIdentityAwareProxyClientSecretRetry); + clientSettingsBuilder + .resetIdentityAwareProxyClientSecretSettings() + .setRetrySettings(resetIdentityAwareProxyClientSecretRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for resetIdentityAwareProxyClientSecret from properties."); + } + } + Retry deleteIdentityAwareProxyClientRetry = + clientProperties.getDeleteIdentityAwareProxyClientRetry(); + if (deleteIdentityAwareProxyClientRetry != null) { + RetrySettings deleteIdentityAwareProxyClientRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIdentityAwareProxyClientSettings().getRetrySettings(), + deleteIdentityAwareProxyClientRetry); + clientSettingsBuilder + .deleteIdentityAwareProxyClientSettings() + .setRetrySettings(deleteIdentityAwareProxyClientRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteIdentityAwareProxyClient from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a IdentityAwareProxyOAuthServiceClient bean configured with + * IdentityAwareProxyOAuthServiceSettings. + * + * @param identityAwareProxyOAuthServiceSettings settings to configure an instance of client bean. + * @return a {@link IdentityAwareProxyOAuthServiceClient} bean configured with {@link + * IdentityAwareProxyOAuthServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public IdentityAwareProxyOAuthServiceClient identityAwareProxyOAuthServiceClient( + IdentityAwareProxyOAuthServiceSettings identityAwareProxyOAuthServiceSettings) + throws IOException { + return IdentityAwareProxyOAuthServiceClient.create(identityAwareProxyOAuthServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-identity-aware-proxy-o-auth-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringProperties.java b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringProperties.java new file mode 100644 index 0000000000..9b19a8ed05 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/IdentityAwareProxyOAuthServiceSpringProperties.java @@ -0,0 +1,187 @@ +/* + * 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.iap.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 IdentityAwareProxyOAuthService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.iap.v1.identity-aware-proxy-o-auth-service") +public class IdentityAwareProxyOAuthServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listBrands. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBrandsRetry; + /** + * Allow override of retry settings at method-level for createBrand. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createBrandRetry; + /** + * Allow override of retry settings at method-level for getBrand. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getBrandRetry; + /** + * Allow override of retry settings at method-level for createIdentityAwareProxyClient. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createIdentityAwareProxyClientRetry; + /** + * Allow override of retry settings at method-level for listIdentityAwareProxyClients. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listIdentityAwareProxyClientsRetry; + /** + * Allow override of retry settings at method-level for getIdentityAwareProxyClient. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIdentityAwareProxyClientRetry; + /** + * Allow override of retry settings at method-level for resetIdentityAwareProxyClientSecret. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry resetIdentityAwareProxyClientSecretRetry; + /** + * Allow override of retry settings at method-level for deleteIdentityAwareProxyClient. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteIdentityAwareProxyClientRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListBrandsRetry() { + return this.listBrandsRetry; + } + + public void setListBrandsRetry(Retry listBrandsRetry) { + this.listBrandsRetry = listBrandsRetry; + } + + public Retry getCreateBrandRetry() { + return this.createBrandRetry; + } + + public void setCreateBrandRetry(Retry createBrandRetry) { + this.createBrandRetry = createBrandRetry; + } + + public Retry getGetBrandRetry() { + return this.getBrandRetry; + } + + public void setGetBrandRetry(Retry getBrandRetry) { + this.getBrandRetry = getBrandRetry; + } + + public Retry getCreateIdentityAwareProxyClientRetry() { + return this.createIdentityAwareProxyClientRetry; + } + + public void setCreateIdentityAwareProxyClientRetry(Retry createIdentityAwareProxyClientRetry) { + this.createIdentityAwareProxyClientRetry = createIdentityAwareProxyClientRetry; + } + + public Retry getListIdentityAwareProxyClientsRetry() { + return this.listIdentityAwareProxyClientsRetry; + } + + public void setListIdentityAwareProxyClientsRetry(Retry listIdentityAwareProxyClientsRetry) { + this.listIdentityAwareProxyClientsRetry = listIdentityAwareProxyClientsRetry; + } + + public Retry getGetIdentityAwareProxyClientRetry() { + return this.getIdentityAwareProxyClientRetry; + } + + public void setGetIdentityAwareProxyClientRetry(Retry getIdentityAwareProxyClientRetry) { + this.getIdentityAwareProxyClientRetry = getIdentityAwareProxyClientRetry; + } + + public Retry getResetIdentityAwareProxyClientSecretRetry() { + return this.resetIdentityAwareProxyClientSecretRetry; + } + + public void setResetIdentityAwareProxyClientSecretRetry( + Retry resetIdentityAwareProxyClientSecretRetry) { + this.resetIdentityAwareProxyClientSecretRetry = resetIdentityAwareProxyClientSecretRetry; + } + + public Retry getDeleteIdentityAwareProxyClientRetry() { + return this.deleteIdentityAwareProxyClientRetry; + } + + public void setDeleteIdentityAwareProxyClientRetry(Retry deleteIdentityAwareProxyClientRetry) { + this.deleteIdentityAwareProxyClientRetry = deleteIdentityAwareProxyClientRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/v1/spring/package-info.java new file mode 100644 index 0000000000..9f06a09f92 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/java/com/google/cloud/iap/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 iap. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.iap.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..2c92a5b7f8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "name": "com.google.cloud.iap.v1.identity-aware-proxy-admin-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud iap/IdentityAwareProxyAdminService components.", + "defaultValue": true + }, + { + "name": "com.google.cloud.iap.v1.identity-aware-proxy-o-auth-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud iap/IdentityAwareProxyOAuthService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..7ba0e93f40 --- /dev/null +++ b/spring-cloud-previews/google-cloud-iap-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.google.cloud.iap.v1.spring.IdentityAwareProxyAdminServiceSpringAutoConfiguration +com.google.cloud.iap.v1.spring.IdentityAwareProxyOAuthServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringAutoConfiguration.java index e2aecd68bd..3b7b01219d 100644 --- a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public IDSSettings iDSSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IDSSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-infra-manager-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/pom.xml new file mode 100644 index 0000000000..5affa3ee0d --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-infra-manager-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - config + Spring Boot Starter with AutoConfiguration for config + + + + + com.google.cloud + google-cloud-infra-manager + + + + 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-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringAutoConfiguration.java new file mode 100644 index 0000000000..84db23f487 --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringAutoConfiguration.java @@ -0,0 +1,552 @@ +/* + * 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.config.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.config.v1.ConfigClient; +import com.google.cloud.config.v1.ConfigSettings; +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 ConfigClient}. + * + *

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(ConfigClient.class) +@ConditionalOnProperty(value = "com.google.cloud.config.v1.config.enabled", matchIfMissing = true) +@EnableConfigurationProperties(ConfigSpringProperties.class) +public class ConfigSpringAutoConfiguration { + private final ConfigSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(ConfigSpringAutoConfiguration.class); + + protected ConfigSpringAutoConfiguration( + ConfigSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from Config-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 = "defaultConfigTransportChannelProvider") + public TransportChannelProvider defaultConfigTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ConfigSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ConfigSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ConfigSettings bean configured to use a DefaultCredentialsProvider and the client + * library's default transport channel provider (defaultConfigTransportChannelProvider()). 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 ConfigSpringProperties. 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 ConfigSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConfigSettings configSettings( + @Qualifier("defaultConfigTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConfigSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConfigSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConfigSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ConfigSettings.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 = + ConfigSettings.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 listDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDeploymentsSettings() + .setRetrySettings(listDeploymentsRetrySettings); + + RetrySettings getDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings); + + RetrySettings listRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRevisionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRevisionsSettings().setRetrySettings(listRevisionsRetrySettings); + + RetrySettings getRevisionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRevisionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRevisionSettings().setRetrySettings(getRevisionRetrySettings); + + RetrySettings getResourceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getResourceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getResourceSettings().setRetrySettings(getResourceRetrySettings); + + RetrySettings listResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listResourcesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listResourcesSettings().setRetrySettings(listResourcesRetrySettings); + + RetrySettings exportDeploymentStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportDeploymentStatefileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .exportDeploymentStatefileSettings() + .setRetrySettings(exportDeploymentStatefileRetrySettings); + + RetrySettings exportRevisionStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportRevisionStatefileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .exportRevisionStatefileSettings() + .setRetrySettings(exportRevisionStatefileRetrySettings); + + RetrySettings importStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importStatefileSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .importStatefileSettings() + .setRetrySettings(importStatefileRetrySettings); + + RetrySettings deleteStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteStatefileSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteStatefileSettings() + .setRetrySettings(deleteStatefileRetrySettings); + + RetrySettings exportLockInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportLockInfoSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.exportLockInfoSettings().setRetrySettings(exportLockInfoRetrySettings); + + RetrySettings getPreviewRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPreviewSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPreviewSettings().setRetrySettings(getPreviewRetrySettings); + + RetrySettings listPreviewsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPreviewsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listPreviewsSettings().setRetrySettings(listPreviewsRetrySettings); + + RetrySettings exportPreviewResultRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportPreviewResultSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .exportPreviewResultSettings() + .setRetrySettings(exportPreviewResultRetrySettings); + + RetrySettings listTerraformVersionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTerraformVersionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listTerraformVersionsSettings() + .setRetrySettings(listTerraformVersionsRetrySettings); + + RetrySettings getTerraformVersionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTerraformVersionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getTerraformVersionSettings() + .setRetrySettings(getTerraformVersionRetrySettings); + + 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 listDeploymentsRetry = clientProperties.getListDeploymentsRetry(); + if (listDeploymentsRetry != null) { + RetrySettings listDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(), + listDeploymentsRetry); + clientSettingsBuilder + .listDeploymentsSettings() + .setRetrySettings(listDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDeployments from properties."); + } + } + Retry getDeploymentRetry = clientProperties.getGetDeploymentRetry(); + if (getDeploymentRetry != null) { + RetrySettings getDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), getDeploymentRetry); + clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDeployment from properties."); + } + } + Retry listRevisionsRetry = clientProperties.getListRevisionsRetry(); + if (listRevisionsRetry != null) { + RetrySettings listRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRevisionsSettings().getRetrySettings(), listRevisionsRetry); + clientSettingsBuilder.listRevisionsSettings().setRetrySettings(listRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRevisions from properties."); + } + } + Retry getRevisionRetry = clientProperties.getGetRevisionRetry(); + if (getRevisionRetry != null) { + RetrySettings getRevisionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRevisionSettings().getRetrySettings(), getRevisionRetry); + clientSettingsBuilder.getRevisionSettings().setRetrySettings(getRevisionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRevision from properties."); + } + } + Retry getResourceRetry = clientProperties.getGetResourceRetry(); + if (getResourceRetry != null) { + RetrySettings getResourceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getResourceSettings().getRetrySettings(), getResourceRetry); + clientSettingsBuilder.getResourceSettings().setRetrySettings(getResourceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getResource from properties."); + } + } + Retry listResourcesRetry = clientProperties.getListResourcesRetry(); + if (listResourcesRetry != null) { + RetrySettings listResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listResourcesSettings().getRetrySettings(), listResourcesRetry); + clientSettingsBuilder.listResourcesSettings().setRetrySettings(listResourcesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listResources from properties."); + } + } + Retry exportDeploymentStatefileRetry = clientProperties.getExportDeploymentStatefileRetry(); + if (exportDeploymentStatefileRetry != null) { + RetrySettings exportDeploymentStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportDeploymentStatefileSettings().getRetrySettings(), + exportDeploymentStatefileRetry); + clientSettingsBuilder + .exportDeploymentStatefileSettings() + .setRetrySettings(exportDeploymentStatefileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for exportDeploymentStatefile from properties."); + } + } + Retry exportRevisionStatefileRetry = clientProperties.getExportRevisionStatefileRetry(); + if (exportRevisionStatefileRetry != null) { + RetrySettings exportRevisionStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportRevisionStatefileSettings().getRetrySettings(), + exportRevisionStatefileRetry); + clientSettingsBuilder + .exportRevisionStatefileSettings() + .setRetrySettings(exportRevisionStatefileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for exportRevisionStatefile from properties."); + } + } + Retry importStatefileRetry = clientProperties.getImportStatefileRetry(); + if (importStatefileRetry != null) { + RetrySettings importStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importStatefileSettings().getRetrySettings(), + importStatefileRetry); + clientSettingsBuilder + .importStatefileSettings() + .setRetrySettings(importStatefileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for importStatefile from properties."); + } + } + Retry deleteStatefileRetry = clientProperties.getDeleteStatefileRetry(); + if (deleteStatefileRetry != null) { + RetrySettings deleteStatefileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteStatefileSettings().getRetrySettings(), + deleteStatefileRetry); + clientSettingsBuilder + .deleteStatefileSettings() + .setRetrySettings(deleteStatefileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteStatefile from properties."); + } + } + Retry exportLockInfoRetry = clientProperties.getExportLockInfoRetry(); + if (exportLockInfoRetry != null) { + RetrySettings exportLockInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportLockInfoSettings().getRetrySettings(), + exportLockInfoRetry); + clientSettingsBuilder.exportLockInfoSettings().setRetrySettings(exportLockInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for exportLockInfo from properties."); + } + } + Retry getPreviewRetry = clientProperties.getGetPreviewRetry(); + if (getPreviewRetry != null) { + RetrySettings getPreviewRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPreviewSettings().getRetrySettings(), getPreviewRetry); + clientSettingsBuilder.getPreviewSettings().setRetrySettings(getPreviewRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPreview from properties."); + } + } + Retry listPreviewsRetry = clientProperties.getListPreviewsRetry(); + if (listPreviewsRetry != null) { + RetrySettings listPreviewsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPreviewsSettings().getRetrySettings(), listPreviewsRetry); + clientSettingsBuilder.listPreviewsSettings().setRetrySettings(listPreviewsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listPreviews from properties."); + } + } + Retry exportPreviewResultRetry = clientProperties.getExportPreviewResultRetry(); + if (exportPreviewResultRetry != null) { + RetrySettings exportPreviewResultRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportPreviewResultSettings().getRetrySettings(), + exportPreviewResultRetry); + clientSettingsBuilder + .exportPreviewResultSettings() + .setRetrySettings(exportPreviewResultRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for exportPreviewResult from properties."); + } + } + Retry listTerraformVersionsRetry = clientProperties.getListTerraformVersionsRetry(); + if (listTerraformVersionsRetry != null) { + RetrySettings listTerraformVersionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTerraformVersionsSettings().getRetrySettings(), + listTerraformVersionsRetry); + clientSettingsBuilder + .listTerraformVersionsSettings() + .setRetrySettings(listTerraformVersionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTerraformVersions from properties."); + } + } + Retry getTerraformVersionRetry = clientProperties.getGetTerraformVersionRetry(); + if (getTerraformVersionRetry != null) { + RetrySettings getTerraformVersionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTerraformVersionSettings().getRetrySettings(), + getTerraformVersionRetry); + clientSettingsBuilder + .getTerraformVersionSettings() + .setRetrySettings(getTerraformVersionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTerraformVersion 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 ConfigClient bean configured with ConfigSettings. + * + * @param configSettings settings to configure an instance of client bean. + * @return a {@link ConfigClient} bean configured with {@link ConfigSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConfigClient configClient(ConfigSettings configSettings) throws IOException { + return ConfigClient.create(configSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-config"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringProperties.java b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringProperties.java new file mode 100644 index 0000000000..63f721cecc --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/ConfigSpringProperties.java @@ -0,0 +1,355 @@ +/* + * 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.config.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 Config client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.config.v1.config") +public class ConfigSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listDeployments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDeploymentsRetry; + /** + * Allow override of retry settings at method-level for getDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDeploymentRetry; + /** + * Allow override of retry settings at method-level for listRevisions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRevisionsRetry; + /** + * Allow override of retry settings at method-level for getRevision. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRevisionRetry; + /** + * Allow override of retry settings at method-level for getResource. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getResourceRetry; + /** + * Allow override of retry settings at method-level for listResources. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listResourcesRetry; + /** + * Allow override of retry settings at method-level for exportDeploymentStatefile. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportDeploymentStatefileRetry; + /** + * Allow override of retry settings at method-level for exportRevisionStatefile. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportRevisionStatefileRetry; + /** + * Allow override of retry settings at method-level for importStatefile. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry importStatefileRetry; + /** + * Allow override of retry settings at method-level for deleteStatefile. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteStatefileRetry; + /** + * Allow override of retry settings at method-level for exportLockInfo. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportLockInfoRetry; + /** + * Allow override of retry settings at method-level for getPreview. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPreviewRetry; + /** + * Allow override of retry settings at method-level for listPreviews. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPreviewsRetry; + /** + * Allow override of retry settings at method-level for exportPreviewResult. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportPreviewResultRetry; + /** + * Allow override of retry settings at method-level for listTerraformVersions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTerraformVersionsRetry; + /** + * Allow override of retry settings at method-level for getTerraformVersion. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTerraformVersionRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListDeploymentsRetry() { + return this.listDeploymentsRetry; + } + + public void setListDeploymentsRetry(Retry listDeploymentsRetry) { + this.listDeploymentsRetry = listDeploymentsRetry; + } + + public Retry getGetDeploymentRetry() { + return this.getDeploymentRetry; + } + + public void setGetDeploymentRetry(Retry getDeploymentRetry) { + this.getDeploymentRetry = getDeploymentRetry; + } + + public Retry getListRevisionsRetry() { + return this.listRevisionsRetry; + } + + public void setListRevisionsRetry(Retry listRevisionsRetry) { + this.listRevisionsRetry = listRevisionsRetry; + } + + public Retry getGetRevisionRetry() { + return this.getRevisionRetry; + } + + public void setGetRevisionRetry(Retry getRevisionRetry) { + this.getRevisionRetry = getRevisionRetry; + } + + public Retry getGetResourceRetry() { + return this.getResourceRetry; + } + + public void setGetResourceRetry(Retry getResourceRetry) { + this.getResourceRetry = getResourceRetry; + } + + public Retry getListResourcesRetry() { + return this.listResourcesRetry; + } + + public void setListResourcesRetry(Retry listResourcesRetry) { + this.listResourcesRetry = listResourcesRetry; + } + + public Retry getExportDeploymentStatefileRetry() { + return this.exportDeploymentStatefileRetry; + } + + public void setExportDeploymentStatefileRetry(Retry exportDeploymentStatefileRetry) { + this.exportDeploymentStatefileRetry = exportDeploymentStatefileRetry; + } + + public Retry getExportRevisionStatefileRetry() { + return this.exportRevisionStatefileRetry; + } + + public void setExportRevisionStatefileRetry(Retry exportRevisionStatefileRetry) { + this.exportRevisionStatefileRetry = exportRevisionStatefileRetry; + } + + public Retry getImportStatefileRetry() { + return this.importStatefileRetry; + } + + public void setImportStatefileRetry(Retry importStatefileRetry) { + this.importStatefileRetry = importStatefileRetry; + } + + public Retry getDeleteStatefileRetry() { + return this.deleteStatefileRetry; + } + + public void setDeleteStatefileRetry(Retry deleteStatefileRetry) { + this.deleteStatefileRetry = deleteStatefileRetry; + } + + public Retry getExportLockInfoRetry() { + return this.exportLockInfoRetry; + } + + public void setExportLockInfoRetry(Retry exportLockInfoRetry) { + this.exportLockInfoRetry = exportLockInfoRetry; + } + + public Retry getGetPreviewRetry() { + return this.getPreviewRetry; + } + + public void setGetPreviewRetry(Retry getPreviewRetry) { + this.getPreviewRetry = getPreviewRetry; + } + + public Retry getListPreviewsRetry() { + return this.listPreviewsRetry; + } + + public void setListPreviewsRetry(Retry listPreviewsRetry) { + this.listPreviewsRetry = listPreviewsRetry; + } + + public Retry getExportPreviewResultRetry() { + return this.exportPreviewResultRetry; + } + + public void setExportPreviewResultRetry(Retry exportPreviewResultRetry) { + this.exportPreviewResultRetry = exportPreviewResultRetry; + } + + public Retry getListTerraformVersionsRetry() { + return this.listTerraformVersionsRetry; + } + + public void setListTerraformVersionsRetry(Retry listTerraformVersionsRetry) { + this.listTerraformVersionsRetry = listTerraformVersionsRetry; + } + + public Retry getGetTerraformVersionRetry() { + return this.getTerraformVersionRetry; + } + + public void setGetTerraformVersionRetry(Retry getTerraformVersionRetry) { + this.getTerraformVersionRetry = getTerraformVersionRetry; + } + + 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-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/v1/spring/package-info.java new file mode 100644 index 0000000000..d3dc7c03df --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/java/com/google/cloud/config/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 config. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.config.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..6aa568dd6e --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.config.v1.config.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud config/Config components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..f4137e73be --- /dev/null +++ b/spring-cloud-previews/google-cloud-infra-manager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.config.v1.spring.ConfigSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringAutoConfiguration.java index e472a08f8f..4aad4fefb3 100644 --- a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public DeviceManagerSettings deviceManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DeviceManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v2/spring/LanguageServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v2/spring/LanguageServiceSpringAutoConfiguration.java index e93bc0d8a4..f087426698 100644 --- a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v2/spring/LanguageServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v2/spring/LanguageServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public LanguageServiceSettings languageServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LanguageServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringAutoConfiguration.java index 689b05999a..95cb836a92 100644 --- a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public ManagedIdentitiesServiceSettings managedIdentitiesServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ManagedIdentitiesServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringAutoConfiguration.java index f743dfae22..c907a9a887 100644 --- a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CloudMemcacheSettings cloudMemcacheSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudMemcacheSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringAutoConfiguration.java index a942d58afc..63b0681003 100644 --- a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public DashboardsServiceSettings dashboardsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(DashboardsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringAutoConfiguration.java index 8abf3486fb..2f0c26b7be 100644 --- a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ReachabilityServiceSettings reachabilityServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ReachabilityServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-network-security-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-network-security-spring-starter/pom.xml new file mode 100644 index 0000000000..0d243729dd --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-network-security-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - networksecurity + Spring Boot Starter with AutoConfiguration for networksecurity + + + + + com.google.cloud + google-cloud-network-security + + + + 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-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringAutoConfiguration.java new file mode 100644 index 0000000000..3ab36a00ab --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringAutoConfiguration.java @@ -0,0 +1,388 @@ +/* + * 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.networksecurity.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.networksecurity.v1.NetworkSecurityClient; +import com.google.cloud.networksecurity.v1.NetworkSecuritySettings; +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 NetworkSecurityClient}. + * + *

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(NetworkSecurityClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.networksecurity.v1.network-security.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(NetworkSecuritySpringProperties.class) +public class NetworkSecuritySpringAutoConfiguration { + private final NetworkSecuritySpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(NetworkSecuritySpringAutoConfiguration.class); + + protected NetworkSecuritySpringAutoConfiguration( + NetworkSecuritySpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from NetworkSecurity-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 = "defaultNetworkSecurityTransportChannelProvider") + public TransportChannelProvider defaultNetworkSecurityTransportChannelProvider() { + return NetworkSecuritySettings.defaultTransportChannelProvider(); + } + + /** + * Provides a NetworkSecuritySettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultNetworkSecurityTransportChannelProvider()). 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 NetworkSecuritySpringProperties. 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 NetworkSecuritySettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public NetworkSecuritySettings networkSecuritySettings( + @Qualifier("defaultNetworkSecurityTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + NetworkSecuritySettings.Builder clientSettingsBuilder = NetworkSecuritySettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NetworkSecuritySettings.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 = + NetworkSecuritySettings.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 listAuthorizationPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizationPoliciesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listAuthorizationPoliciesSettings() + .setRetrySettings(listAuthorizationPoliciesRetrySettings); + + RetrySettings getAuthorizationPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAuthorizationPolicySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getAuthorizationPolicySettings() + .setRetrySettings(getAuthorizationPolicyRetrySettings); + + RetrySettings listServerTlsPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServerTlsPoliciesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listServerTlsPoliciesSettings() + .setRetrySettings(listServerTlsPoliciesRetrySettings); + + RetrySettings getServerTlsPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServerTlsPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getServerTlsPolicySettings() + .setRetrySettings(getServerTlsPolicyRetrySettings); + + RetrySettings listClientTlsPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClientTlsPoliciesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listClientTlsPoliciesSettings() + .setRetrySettings(listClientTlsPoliciesRetrySettings); + + RetrySettings getClientTlsPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClientTlsPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getClientTlsPolicySettings() + .setRetrySettings(getClientTlsPolicyRetrySettings); + + 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 listAuthorizationPoliciesRetry = clientProperties.getListAuthorizationPoliciesRetry(); + if (listAuthorizationPoliciesRetry != null) { + RetrySettings listAuthorizationPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizationPoliciesSettings().getRetrySettings(), + listAuthorizationPoliciesRetry); + clientSettingsBuilder + .listAuthorizationPoliciesSettings() + .setRetrySettings(listAuthorizationPoliciesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAuthorizationPolicies from properties."); + } + } + Retry getAuthorizationPolicyRetry = clientProperties.getGetAuthorizationPolicyRetry(); + if (getAuthorizationPolicyRetry != null) { + RetrySettings getAuthorizationPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAuthorizationPolicySettings().getRetrySettings(), + getAuthorizationPolicyRetry); + clientSettingsBuilder + .getAuthorizationPolicySettings() + .setRetrySettings(getAuthorizationPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAuthorizationPolicy from properties."); + } + } + Retry listServerTlsPoliciesRetry = clientProperties.getListServerTlsPoliciesRetry(); + if (listServerTlsPoliciesRetry != null) { + RetrySettings listServerTlsPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServerTlsPoliciesSettings().getRetrySettings(), + listServerTlsPoliciesRetry); + clientSettingsBuilder + .listServerTlsPoliciesSettings() + .setRetrySettings(listServerTlsPoliciesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listServerTlsPolicies from properties."); + } + } + Retry getServerTlsPolicyRetry = clientProperties.getGetServerTlsPolicyRetry(); + if (getServerTlsPolicyRetry != null) { + RetrySettings getServerTlsPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServerTlsPolicySettings().getRetrySettings(), + getServerTlsPolicyRetry); + clientSettingsBuilder + .getServerTlsPolicySettings() + .setRetrySettings(getServerTlsPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getServerTlsPolicy from properties."); + } + } + Retry listClientTlsPoliciesRetry = clientProperties.getListClientTlsPoliciesRetry(); + if (listClientTlsPoliciesRetry != null) { + RetrySettings listClientTlsPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClientTlsPoliciesSettings().getRetrySettings(), + listClientTlsPoliciesRetry); + clientSettingsBuilder + .listClientTlsPoliciesSettings() + .setRetrySettings(listClientTlsPoliciesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listClientTlsPolicies from properties."); + } + } + Retry getClientTlsPolicyRetry = clientProperties.getGetClientTlsPolicyRetry(); + if (getClientTlsPolicyRetry != null) { + RetrySettings getClientTlsPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClientTlsPolicySettings().getRetrySettings(), + getClientTlsPolicyRetry); + clientSettingsBuilder + .getClientTlsPolicySettings() + .setRetrySettings(getClientTlsPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getClientTlsPolicy 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 NetworkSecurityClient bean configured with NetworkSecuritySettings. + * + * @param networkSecuritySettings settings to configure an instance of client bean. + * @return a {@link NetworkSecurityClient} bean configured with {@link NetworkSecuritySettings} + */ + @Bean + @ConditionalOnMissingBean + public NetworkSecurityClient networkSecurityClient( + NetworkSecuritySettings networkSecuritySettings) throws IOException { + return NetworkSecurityClient.create(networkSecuritySettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-network-security"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringProperties.java b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringProperties.java new file mode 100644 index 0000000000..1968872d7c --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/NetworkSecuritySpringProperties.java @@ -0,0 +1,215 @@ +/* + * 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.networksecurity.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 NetworkSecurity client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.networksecurity.v1.network-security") +public class NetworkSecuritySpringProperties 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 listAuthorizationPolicies. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAuthorizationPoliciesRetry; + /** + * Allow override of retry settings at method-level for getAuthorizationPolicy. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAuthorizationPolicyRetry; + /** + * Allow override of retry settings at method-level for listServerTlsPolicies. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listServerTlsPoliciesRetry; + /** + * Allow override of retry settings at method-level for getServerTlsPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getServerTlsPolicyRetry; + /** + * Allow override of retry settings at method-level for listClientTlsPolicies. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listClientTlsPoliciesRetry; + /** + * Allow override of retry settings at method-level for getClientTlsPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getClientTlsPolicyRetry; + /** + * 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 getListAuthorizationPoliciesRetry() { + return this.listAuthorizationPoliciesRetry; + } + + public void setListAuthorizationPoliciesRetry(Retry listAuthorizationPoliciesRetry) { + this.listAuthorizationPoliciesRetry = listAuthorizationPoliciesRetry; + } + + public Retry getGetAuthorizationPolicyRetry() { + return this.getAuthorizationPolicyRetry; + } + + public void setGetAuthorizationPolicyRetry(Retry getAuthorizationPolicyRetry) { + this.getAuthorizationPolicyRetry = getAuthorizationPolicyRetry; + } + + public Retry getListServerTlsPoliciesRetry() { + return this.listServerTlsPoliciesRetry; + } + + public void setListServerTlsPoliciesRetry(Retry listServerTlsPoliciesRetry) { + this.listServerTlsPoliciesRetry = listServerTlsPoliciesRetry; + } + + public Retry getGetServerTlsPolicyRetry() { + return this.getServerTlsPolicyRetry; + } + + public void setGetServerTlsPolicyRetry(Retry getServerTlsPolicyRetry) { + this.getServerTlsPolicyRetry = getServerTlsPolicyRetry; + } + + public Retry getListClientTlsPoliciesRetry() { + return this.listClientTlsPoliciesRetry; + } + + public void setListClientTlsPoliciesRetry(Retry listClientTlsPoliciesRetry) { + this.listClientTlsPoliciesRetry = listClientTlsPoliciesRetry; + } + + public Retry getGetClientTlsPolicyRetry() { + return this.getClientTlsPolicyRetry; + } + + public void setGetClientTlsPolicyRetry(Retry getClientTlsPolicyRetry) { + this.getClientTlsPolicyRetry = getClientTlsPolicyRetry; + } + + 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-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/v1/spring/package-info.java new file mode 100644 index 0000000000..c35246367f --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/java/com/google/cloud/networksecurity/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 networksecurity. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.networksecurity.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..8a28b382f4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.networksecurity.v1.network-security.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud networksecurity/NetworkSecurity components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..58f332d49e --- /dev/null +++ b/spring-cloud-previews/google-cloud-network-security-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.networksecurity.v1.spring.NetworkSecuritySpringAutoConfiguration \ No newline at end of file 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 9b2648f660..618886c9e3 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 @@ -123,6 +123,7 @@ public HubServiceSettings hubServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(HubServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java index 4d01a0e263..6ba4a4c77c 100644 --- a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public PolicyBasedRoutingServiceSettings policyBasedRoutingServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PolicyBasedRoutingServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v2/spring/NotebookServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v2/spring/NotebookServiceSpringAutoConfiguration.java index 24aa5abcef..9c456c3718 100644 --- a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v2/spring/NotebookServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v2/spring/NotebookServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public NotebookServiceSettings notebookServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(NotebookServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringAutoConfiguration.java index fce5160642..bd6ca50d41 100644 --- a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public FleetRoutingSettings fleetRoutingSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(FleetRoutingSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringAutoConfiguration.java index 53de898a6c..4586faa81e 100644 --- a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public EnvironmentsSettings environmentsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EnvironmentsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java index 23bcad6dcc..b7f0950f8c 100644 --- a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ImageVersionsSettings imageVersionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ImageVersionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringAutoConfiguration.java index 93b5a5c454..469f38cce1 100644 --- a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringAutoConfiguration.java @@ -132,6 +132,7 @@ public OrgPolicySettings orgPolicySettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(OrgPolicySettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringAutoConfiguration.java index 9e15c68f6f..e1d740dd2a 100644 --- a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public OsConfigServiceSettings osConfigServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(OsConfigServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java index 1d73508d98..0d39fa0e2a 100644 --- a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public OsConfigZonalServiceSettings osConfigZonalServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(OsConfigZonalServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringAutoConfiguration.java index 4666c9f443..7288109d40 100644 --- a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public OsLoginServiceSettings osLoginServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(OsLoginServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringAutoConfiguration.java index 9ff94bcb75..bb43d4b42d 100644 --- a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public IamCheckerSettings iamCheckerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IamCheckerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java index db0b335e2b..1cfbebb768 100644 --- a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ExportServiceSettings exportServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ExportServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringAutoConfiguration.java index 1d9f4df067..b4a8227566 100644 --- a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ProfilerServiceSettings profilerServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ProfilerServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-publicca-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-publicca-spring-starter/pom.xml new file mode 100644 index 0000000000..af05e47f86 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-publicca-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - publicca + Spring Boot Starter with AutoConfiguration for publicca + + + + + com.google.cloud + google-cloud-publicca + + + + 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-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..d3cd79c7a8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringAutoConfiguration.java @@ -0,0 +1,221 @@ +/* + * 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.security.publicca.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.security.publicca.v1.PublicCertificateAuthorityServiceClient; +import com.google.cloud.security.publicca.v1.PublicCertificateAuthorityServiceSettings; +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 PublicCertificateAuthorityServiceClient}. + * + *

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(PublicCertificateAuthorityServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.security.publicca.v1.public-certificate-authority-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(PublicCertificateAuthorityServiceSpringProperties.class) +public class PublicCertificateAuthorityServiceSpringAutoConfiguration { + private final PublicCertificateAuthorityServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(PublicCertificateAuthorityServiceSpringAutoConfiguration.class); + + protected PublicCertificateAuthorityServiceSpringAutoConfiguration( + PublicCertificateAuthorityServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Using credentials from PublicCertificateAuthorityService-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 = "defaultPublicCertificateAuthorityServiceTransportChannelProvider") + public TransportChannelProvider + defaultPublicCertificateAuthorityServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return PublicCertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder() + .build(); + } + return PublicCertificateAuthorityServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a PublicCertificateAuthorityServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultPublicCertificateAuthorityServiceTransportChannelProvider()). 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 PublicCertificateAuthorityServiceSpringProperties. 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 PublicCertificateAuthorityServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public PublicCertificateAuthorityServiceSettings publicCertificateAuthorityServiceSettings( + @Qualifier("defaultPublicCertificateAuthorityServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PublicCertificateAuthorityServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = PublicCertificateAuthorityServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = PublicCertificateAuthorityServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PublicCertificateAuthorityServiceSettings.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 = + PublicCertificateAuthorityServiceSettings.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 createExternalAccountKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createExternalAccountKeySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createExternalAccountKeySettings() + .setRetrySettings(createExternalAccountKeyRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createExternalAccountKeyRetry = clientProperties.getCreateExternalAccountKeyRetry(); + if (createExternalAccountKeyRetry != null) { + RetrySettings createExternalAccountKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createExternalAccountKeySettings().getRetrySettings(), + createExternalAccountKeyRetry); + clientSettingsBuilder + .createExternalAccountKeySettings() + .setRetrySettings(createExternalAccountKeyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createExternalAccountKey from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a PublicCertificateAuthorityServiceClient bean configured with + * PublicCertificateAuthorityServiceSettings. + * + * @param publicCertificateAuthorityServiceSettings settings to configure an instance of client + * bean. + * @return a {@link PublicCertificateAuthorityServiceClient} bean configured with {@link + * PublicCertificateAuthorityServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public PublicCertificateAuthorityServiceClient publicCertificateAuthorityServiceClient( + PublicCertificateAuthorityServiceSettings publicCertificateAuthorityServiceSettings) + throws IOException { + return PublicCertificateAuthorityServiceClient.create( + publicCertificateAuthorityServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-public-certificate-authority-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringProperties.java b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringProperties.java new file mode 100644 index 0000000000..bf80e1ef94 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/PublicCertificateAuthorityServiceSpringProperties.java @@ -0,0 +1,96 @@ +/* + * 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.security.publicca.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 PublicCertificateAuthorityService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties( + "com.google.cloud.security.publicca.v1.public-certificate-authority-service") +public class PublicCertificateAuthorityServiceSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 createExternalAccountKey. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createExternalAccountKeyRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getCreateExternalAccountKeyRetry() { + return this.createExternalAccountKeyRetry; + } + + public void setCreateExternalAccountKeyRetry(Retry createExternalAccountKeyRetry) { + this.createExternalAccountKeyRetry = createExternalAccountKeyRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/v1/spring/package-info.java new file mode 100644 index 0000000000..410f51d515 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/java/com/google/cloud/security/publicca/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 publicca. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.security.publicca.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..ef8fbe9c25 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.security.publicca.v1.public-certificate-authority-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud publicca/PublicCertificateAuthorityService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..15016ef9f3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-publicca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.security.publicca.v1.spring.PublicCertificateAuthorityServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringAutoConfiguration.java index 9e93a84130..999379a07e 100644 --- a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringAutoConfiguration.java @@ -127,6 +127,7 @@ public RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RecaptchaEnterpriseServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringAutoConfiguration.java index 68f97b4e54..a51f0abd61 100644 --- a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public RecommenderSettings recommenderSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RecommenderSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringAutoConfiguration.java index 1a2e96bb82..64fb2f762d 100644 --- a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public CloudRedisSettings cloudRedisSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudRedisSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringAutoConfiguration.java index 1aaa3e4349..a9ead77334 100644 --- a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public ResourceSettingsServiceSettings resourceSettingsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ResourceSettingsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/AnalyticsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/AnalyticsServiceSpringAutoConfiguration.java index cbff3a3cbd..6d29ce5ed3 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/AnalyticsServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/AnalyticsServiceSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public AnalyticsServiceSettings analyticsServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AnalyticsServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringAutoConfiguration.java index 2e66be58f5..f38ca32f7a 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CatalogServiceSettings catalogServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CatalogServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java index 2b06023152..0c70a29f2a 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public CompletionServiceSettings completionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CompletionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java index 6f2d744d2a..09d18fe6e3 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ControlServiceSettings controlServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ControlServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ModelServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ModelServiceSpringAutoConfiguration.java index 4704653aef..3f332fbe28 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ModelServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ModelServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ModelServiceSettings modelServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ModelServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java index 9877b053bf..48f653ec6a 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public PredictionServiceSettings predictionServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PredictionServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java index a7ed975bae..5ca40b31f3 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ProductServiceSettings productServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ProductServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java index 2035c86896..f1164fc4fa 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public SearchServiceSettings searchServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SearchServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java index 2176fb3b02..4d37816e88 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public ServingConfigServiceSettings servingConfigServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServingConfigServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java index 8adf4b2c02..bd76fbfdeb 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public UserEventServiceSettings userEventServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(UserEventServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringAutoConfiguration.java index 30a43361f1..7b16250b88 100644 --- a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CloudSchedulerSettings cloudSchedulerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudSchedulerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/pom.xml new file mode 100644 index 0000000000..ae660310cb --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-securesourcemanager-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - securesourcemanager + Spring Boot Starter with AutoConfiguration for securesourcemanager + + + + + com.google.cloud + google-cloud-securesourcemanager + + + + 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-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringAutoConfiguration.java new file mode 100644 index 0000000000..b7ad51d710 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringAutoConfiguration.java @@ -0,0 +1,401 @@ +/* + * 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.securesourcemanager.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.securesourcemanager.v1.SecureSourceManagerClient; +import com.google.cloud.securesourcemanager.v1.SecureSourceManagerSettings; +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 SecureSourceManagerClient}. + * + *

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(SecureSourceManagerClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.securesourcemanager.v1.secure-source-manager.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SecureSourceManagerSpringProperties.class) +public class SecureSourceManagerSpringAutoConfiguration { + private final SecureSourceManagerSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(SecureSourceManagerSpringAutoConfiguration.class); + + protected SecureSourceManagerSpringAutoConfiguration( + SecureSourceManagerSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SecureSourceManager-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 = "defaultSecureSourceManagerTransportChannelProvider") + public TransportChannelProvider defaultSecureSourceManagerTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SecureSourceManagerSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SecureSourceManagerSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SecureSourceManagerSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultSecureSourceManagerTransportChannelProvider()). 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 SecureSourceManagerSpringProperties. 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 SecureSourceManagerSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SecureSourceManagerSettings secureSourceManagerSettings( + @Qualifier("defaultSecureSourceManagerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SecureSourceManagerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SecureSourceManagerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SecureSourceManagerSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SecureSourceManagerSettings.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 = + SecureSourceManagerSettings.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 listRepositoriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRepositoriesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listRepositoriesSettings() + .setRetrySettings(listRepositoriesRetrySettings); + + RetrySettings getRepositoryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRepositorySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRepositorySettings().setRetrySettings(getRepositoryRetrySettings); + + RetrySettings getIamPolicyRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicyRepoSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getIamPolicyRepoSettings() + .setRetrySettings(getIamPolicyRepoRetrySettings); + + RetrySettings setIamPolicyRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicyRepoSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .setIamPolicyRepoSettings() + .setRetrySettings(setIamPolicyRepoRetrySettings); + + RetrySettings testIamPermissionsRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsRepoSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .testIamPermissionsRepoSettings() + .setRetrySettings(testIamPermissionsRepoRetrySettings); + + 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 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 listRepositoriesRetry = clientProperties.getListRepositoriesRetry(); + if (listRepositoriesRetry != null) { + RetrySettings listRepositoriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRepositoriesSettings().getRetrySettings(), + listRepositoriesRetry); + clientSettingsBuilder + .listRepositoriesSettings() + .setRetrySettings(listRepositoriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listRepositories from properties."); + } + } + Retry getRepositoryRetry = clientProperties.getGetRepositoryRetry(); + if (getRepositoryRetry != null) { + RetrySettings getRepositoryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRepositorySettings().getRetrySettings(), getRepositoryRetry); + clientSettingsBuilder.getRepositorySettings().setRetrySettings(getRepositoryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRepository from properties."); + } + } + Retry getIamPolicyRepoRetry = clientProperties.getGetIamPolicyRepoRetry(); + if (getIamPolicyRepoRetry != null) { + RetrySettings getIamPolicyRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicyRepoSettings().getRetrySettings(), + getIamPolicyRepoRetry); + clientSettingsBuilder + .getIamPolicyRepoSettings() + .setRetrySettings(getIamPolicyRepoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getIamPolicyRepo from properties."); + } + } + Retry setIamPolicyRepoRetry = clientProperties.getSetIamPolicyRepoRetry(); + if (setIamPolicyRepoRetry != null) { + RetrySettings setIamPolicyRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicyRepoSettings().getRetrySettings(), + setIamPolicyRepoRetry); + clientSettingsBuilder + .setIamPolicyRepoSettings() + .setRetrySettings(setIamPolicyRepoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for setIamPolicyRepo from properties."); + } + } + Retry testIamPermissionsRepoRetry = clientProperties.getTestIamPermissionsRepoRetry(); + if (testIamPermissionsRepoRetry != null) { + RetrySettings testIamPermissionsRepoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsRepoSettings().getRetrySettings(), + testIamPermissionsRepoRetry); + clientSettingsBuilder + .testIamPermissionsRepoSettings() + .setRetrySettings(testIamPermissionsRepoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissionsRepo 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 SecureSourceManagerClient bean configured with SecureSourceManagerSettings. + * + * @param secureSourceManagerSettings settings to configure an instance of client bean. + * @return a {@link SecureSourceManagerClient} bean configured with {@link + * SecureSourceManagerSettings} + */ + @Bean + @ConditionalOnMissingBean + public SecureSourceManagerClient secureSourceManagerClient( + SecureSourceManagerSettings secureSourceManagerSettings) throws IOException { + return SecureSourceManagerClient.create(secureSourceManagerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-secure-source-manager"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringProperties.java b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringProperties.java new file mode 100644 index 0000000000..80190d340f --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/SecureSourceManagerSpringProperties.java @@ -0,0 +1,238 @@ +/* + * 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.securesourcemanager.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 SecureSourceManager client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.securesourcemanager.v1.secure-source-manager") +public class SecureSourceManagerSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listRepositories. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRepositoriesRetry; + /** + * Allow override of retry settings at method-level for getRepository. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRepositoryRetry; + /** + * Allow override of retry settings at method-level for getIamPolicyRepo. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRepoRetry; + /** + * Allow override of retry settings at method-level for setIamPolicyRepo. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRepoRetry; + /** + * Allow override of retry settings at method-level for testIamPermissionsRepo. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRepoRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListRepositoriesRetry() { + return this.listRepositoriesRetry; + } + + public void setListRepositoriesRetry(Retry listRepositoriesRetry) { + this.listRepositoriesRetry = listRepositoriesRetry; + } + + public Retry getGetRepositoryRetry() { + return this.getRepositoryRetry; + } + + public void setGetRepositoryRetry(Retry getRepositoryRetry) { + this.getRepositoryRetry = getRepositoryRetry; + } + + public Retry getGetIamPolicyRepoRetry() { + return this.getIamPolicyRepoRetry; + } + + public void setGetIamPolicyRepoRetry(Retry getIamPolicyRepoRetry) { + this.getIamPolicyRepoRetry = getIamPolicyRepoRetry; + } + + public Retry getSetIamPolicyRepoRetry() { + return this.setIamPolicyRepoRetry; + } + + public void setSetIamPolicyRepoRetry(Retry setIamPolicyRepoRetry) { + this.setIamPolicyRepoRetry = setIamPolicyRepoRetry; + } + + public Retry getTestIamPermissionsRepoRetry() { + return this.testIamPermissionsRepoRetry; + } + + public void setTestIamPermissionsRepoRetry(Retry testIamPermissionsRepoRetry) { + this.testIamPermissionsRepoRetry = testIamPermissionsRepoRetry; + } + + 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-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/v1/spring/package-info.java new file mode 100644 index 0000000000..c504966cb9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/java/com/google/cloud/securesourcemanager/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 securesourcemanager. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.securesourcemanager.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..ed7b6c8cd9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.securesourcemanager.v1.secure-source-manager.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud securesourcemanager/SecureSourceManager components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..2cfc016f8b --- /dev/null +++ b/spring-cloud-previews/google-cloud-securesourcemanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.securesourcemanager.v1.spring.SecureSourceManagerSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringAutoConfiguration.java index 7a2bd5bf4d..7828fb5580 100644 --- a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public CertificateAuthorityServiceSettings certificateAuthorityServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CertificateAuthorityServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v2/spring/SecurityCenterSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v2/spring/SecurityCenterSpringAutoConfiguration.java index fb0f1883a6..cb2475e0dd 100644 --- a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v2/spring/SecurityCenterSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v2/spring/SecurityCenterSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public SecurityCenterSettings securityCenterSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SecurityCenterSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/pom.xml new file mode 100644 index 0000000000..bec01426c3 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-securitycentermanagement-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - securitycentermanagement + Spring Boot Starter with AutoConfiguration for securitycentermanagement + + + + + com.google.cloud + google-cloud-securitycentermanagement + + + + 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-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringAutoConfiguration.java new file mode 100644 index 0000000000..07bd415e05 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringAutoConfiguration.java @@ -0,0 +1,774 @@ +/* + * 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.securitycentermanagement.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.securitycentermanagement.v1.SecurityCenterManagementClient; +import com.google.cloud.securitycentermanagement.v1.SecurityCenterManagementSettings; +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 SecurityCenterManagementClient}. + * + *

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(SecurityCenterManagementClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.securitycentermanagement.v1.security-center-management.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SecurityCenterManagementSpringProperties.class) +public class SecurityCenterManagementSpringAutoConfiguration { + private final SecurityCenterManagementSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(SecurityCenterManagementSpringAutoConfiguration.class); + + protected SecurityCenterManagementSpringAutoConfiguration( + SecurityCenterManagementSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SecurityCenterManagement-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 = "defaultSecurityCenterManagementTransportChannelProvider") + public TransportChannelProvider defaultSecurityCenterManagementTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SecurityCenterManagementSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SecurityCenterManagementSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SecurityCenterManagementSettings bean configured to use a DefaultCredentialsProvider + * and the client library's default transport channel provider + * (defaultSecurityCenterManagementTransportChannelProvider()). 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 SecurityCenterManagementSpringProperties. 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 SecurityCenterManagementSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SecurityCenterManagementSettings securityCenterManagementSettings( + @Qualifier("defaultSecurityCenterManagementTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SecurityCenterManagementSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SecurityCenterManagementSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SecurityCenterManagementSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SecurityCenterManagementSettings.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 = + SecurityCenterManagementSettings.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 listEffectiveSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEffectiveSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listEffectiveSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listEffectiveSecurityHealthAnalyticsCustomModulesRetrySettings); + + RetrySettings getEffectiveSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEffectiveSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getEffectiveSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(getEffectiveSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings listSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listSecurityHealthAnalyticsCustomModulesRetrySettings); + + RetrySettings listDescendantSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listDescendantSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listDescendantSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listDescendantSecurityHealthAnalyticsCustomModulesRetrySettings); + + RetrySettings getSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(getSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings createSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .createSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(createSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings updateSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(updateSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings deleteSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .deleteSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(deleteSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings simulateSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .simulateSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .simulateSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(simulateSecurityHealthAnalyticsCustomModuleRetrySettings); + + RetrySettings listEffectiveEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEffectiveEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listEffectiveEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listEffectiveEventThreatDetectionCustomModulesRetrySettings); + + RetrySettings getEffectiveEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEffectiveEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getEffectiveEventThreatDetectionCustomModuleSettings() + .setRetrySettings(getEffectiveEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings listEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listEventThreatDetectionCustomModulesRetrySettings); + + RetrySettings listDescendantEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listDescendantEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listDescendantEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listDescendantEventThreatDetectionCustomModulesRetrySettings); + + RetrySettings getEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getEventThreatDetectionCustomModuleSettings() + .setRetrySettings(getEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings createEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .createEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createEventThreatDetectionCustomModuleSettings() + .setRetrySettings(createEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings updateEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateEventThreatDetectionCustomModuleSettings() + .setRetrySettings(updateEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings deleteEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .deleteEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteEventThreatDetectionCustomModuleSettings() + .setRetrySettings(deleteEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings validateEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .validateEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .validateEventThreatDetectionCustomModuleSettings() + .setRetrySettings(validateEventThreatDetectionCustomModuleRetrySettings); + + RetrySettings getSecurityCenterServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSecurityCenterServiceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getSecurityCenterServiceSettings() + .setRetrySettings(getSecurityCenterServiceRetrySettings); + + RetrySettings listSecurityCenterServicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSecurityCenterServicesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listSecurityCenterServicesSettings() + .setRetrySettings(listSecurityCenterServicesRetrySettings); + + RetrySettings updateSecurityCenterServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSecurityCenterServiceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateSecurityCenterServiceSettings() + .setRetrySettings(updateSecurityCenterServiceRetrySettings); + + 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 listEffectiveSecurityHealthAnalyticsCustomModulesRetry = + clientProperties.getListEffectiveSecurityHealthAnalyticsCustomModulesRetry(); + if (listEffectiveSecurityHealthAnalyticsCustomModulesRetry != null) { + RetrySettings listEffectiveSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEffectiveSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + listEffectiveSecurityHealthAnalyticsCustomModulesRetry); + clientSettingsBuilder + .listEffectiveSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listEffectiveSecurityHealthAnalyticsCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEffectiveSecurityHealthAnalyticsCustomModules from properties."); + } + } + Retry getEffectiveSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getGetEffectiveSecurityHealthAnalyticsCustomModuleRetry(); + if (getEffectiveSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings getEffectiveSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEffectiveSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + getEffectiveSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .getEffectiveSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(getEffectiveSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEffectiveSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry listSecurityHealthAnalyticsCustomModulesRetry = + clientProperties.getListSecurityHealthAnalyticsCustomModulesRetry(); + if (listSecurityHealthAnalyticsCustomModulesRetry != null) { + RetrySettings listSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + listSecurityHealthAnalyticsCustomModulesRetry); + clientSettingsBuilder + .listSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listSecurityHealthAnalyticsCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSecurityHealthAnalyticsCustomModules from properties."); + } + } + Retry listDescendantSecurityHealthAnalyticsCustomModulesRetry = + clientProperties.getListDescendantSecurityHealthAnalyticsCustomModulesRetry(); + if (listDescendantSecurityHealthAnalyticsCustomModulesRetry != null) { + RetrySettings listDescendantSecurityHealthAnalyticsCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listDescendantSecurityHealthAnalyticsCustomModulesSettings() + .getRetrySettings(), + listDescendantSecurityHealthAnalyticsCustomModulesRetry); + clientSettingsBuilder + .listDescendantSecurityHealthAnalyticsCustomModulesSettings() + .setRetrySettings(listDescendantSecurityHealthAnalyticsCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDescendantSecurityHealthAnalyticsCustomModules from properties."); + } + } + Retry getSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getGetSecurityHealthAnalyticsCustomModuleRetry(); + if (getSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings getSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + getSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .getSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(getSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry createSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getCreateSecurityHealthAnalyticsCustomModuleRetry(); + if (createSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings createSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .createSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + createSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .createSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(createSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry updateSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getUpdateSecurityHealthAnalyticsCustomModuleRetry(); + if (updateSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings updateSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + updateSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .updateSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(updateSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry deleteSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getDeleteSecurityHealthAnalyticsCustomModuleRetry(); + if (deleteSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings deleteSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .deleteSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + deleteSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .deleteSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(deleteSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry simulateSecurityHealthAnalyticsCustomModuleRetry = + clientProperties.getSimulateSecurityHealthAnalyticsCustomModuleRetry(); + if (simulateSecurityHealthAnalyticsCustomModuleRetry != null) { + RetrySettings simulateSecurityHealthAnalyticsCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .simulateSecurityHealthAnalyticsCustomModuleSettings() + .getRetrySettings(), + simulateSecurityHealthAnalyticsCustomModuleRetry); + clientSettingsBuilder + .simulateSecurityHealthAnalyticsCustomModuleSettings() + .setRetrySettings(simulateSecurityHealthAnalyticsCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for simulateSecurityHealthAnalyticsCustomModule from properties."); + } + } + Retry listEffectiveEventThreatDetectionCustomModulesRetry = + clientProperties.getListEffectiveEventThreatDetectionCustomModulesRetry(); + if (listEffectiveEventThreatDetectionCustomModulesRetry != null) { + RetrySettings listEffectiveEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEffectiveEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + listEffectiveEventThreatDetectionCustomModulesRetry); + clientSettingsBuilder + .listEffectiveEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listEffectiveEventThreatDetectionCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEffectiveEventThreatDetectionCustomModules from properties."); + } + } + Retry getEffectiveEventThreatDetectionCustomModuleRetry = + clientProperties.getGetEffectiveEventThreatDetectionCustomModuleRetry(); + if (getEffectiveEventThreatDetectionCustomModuleRetry != null) { + RetrySettings getEffectiveEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEffectiveEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + getEffectiveEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .getEffectiveEventThreatDetectionCustomModuleSettings() + .setRetrySettings(getEffectiveEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEffectiveEventThreatDetectionCustomModule from properties."); + } + } + Retry listEventThreatDetectionCustomModulesRetry = + clientProperties.getListEventThreatDetectionCustomModulesRetry(); + if (listEventThreatDetectionCustomModulesRetry != null) { + RetrySettings listEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + listEventThreatDetectionCustomModulesRetry); + clientSettingsBuilder + .listEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listEventThreatDetectionCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEventThreatDetectionCustomModules from properties."); + } + } + Retry listDescendantEventThreatDetectionCustomModulesRetry = + clientProperties.getListDescendantEventThreatDetectionCustomModulesRetry(); + if (listDescendantEventThreatDetectionCustomModulesRetry != null) { + RetrySettings listDescendantEventThreatDetectionCustomModulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .listDescendantEventThreatDetectionCustomModulesSettings() + .getRetrySettings(), + listDescendantEventThreatDetectionCustomModulesRetry); + clientSettingsBuilder + .listDescendantEventThreatDetectionCustomModulesSettings() + .setRetrySettings(listDescendantEventThreatDetectionCustomModulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDescendantEventThreatDetectionCustomModules from properties."); + } + } + Retry getEventThreatDetectionCustomModuleRetry = + clientProperties.getGetEventThreatDetectionCustomModuleRetry(); + if (getEventThreatDetectionCustomModuleRetry != null) { + RetrySettings getEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + getEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .getEventThreatDetectionCustomModuleSettings() + .setRetrySettings(getEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEventThreatDetectionCustomModule from properties."); + } + } + Retry createEventThreatDetectionCustomModuleRetry = + clientProperties.getCreateEventThreatDetectionCustomModuleRetry(); + if (createEventThreatDetectionCustomModuleRetry != null) { + RetrySettings createEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .createEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + createEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .createEventThreatDetectionCustomModuleSettings() + .setRetrySettings(createEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createEventThreatDetectionCustomModule from properties."); + } + } + Retry updateEventThreatDetectionCustomModuleRetry = + clientProperties.getUpdateEventThreatDetectionCustomModuleRetry(); + if (updateEventThreatDetectionCustomModuleRetry != null) { + RetrySettings updateEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + updateEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .updateEventThreatDetectionCustomModuleSettings() + .setRetrySettings(updateEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateEventThreatDetectionCustomModule from properties."); + } + } + Retry deleteEventThreatDetectionCustomModuleRetry = + clientProperties.getDeleteEventThreatDetectionCustomModuleRetry(); + if (deleteEventThreatDetectionCustomModuleRetry != null) { + RetrySettings deleteEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .deleteEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + deleteEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .deleteEventThreatDetectionCustomModuleSettings() + .setRetrySettings(deleteEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteEventThreatDetectionCustomModule from properties."); + } + } + Retry validateEventThreatDetectionCustomModuleRetry = + clientProperties.getValidateEventThreatDetectionCustomModuleRetry(); + if (validateEventThreatDetectionCustomModuleRetry != null) { + RetrySettings validateEventThreatDetectionCustomModuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .validateEventThreatDetectionCustomModuleSettings() + .getRetrySettings(), + validateEventThreatDetectionCustomModuleRetry); + clientSettingsBuilder + .validateEventThreatDetectionCustomModuleSettings() + .setRetrySettings(validateEventThreatDetectionCustomModuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for validateEventThreatDetectionCustomModule from properties."); + } + } + Retry getSecurityCenterServiceRetry = clientProperties.getGetSecurityCenterServiceRetry(); + if (getSecurityCenterServiceRetry != null) { + RetrySettings getSecurityCenterServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSecurityCenterServiceSettings().getRetrySettings(), + getSecurityCenterServiceRetry); + clientSettingsBuilder + .getSecurityCenterServiceSettings() + .setRetrySettings(getSecurityCenterServiceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getSecurityCenterService from properties."); + } + } + Retry listSecurityCenterServicesRetry = clientProperties.getListSecurityCenterServicesRetry(); + if (listSecurityCenterServicesRetry != null) { + RetrySettings listSecurityCenterServicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSecurityCenterServicesSettings().getRetrySettings(), + listSecurityCenterServicesRetry); + clientSettingsBuilder + .listSecurityCenterServicesSettings() + .setRetrySettings(listSecurityCenterServicesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSecurityCenterServices from properties."); + } + } + Retry updateSecurityCenterServiceRetry = clientProperties.getUpdateSecurityCenterServiceRetry(); + if (updateSecurityCenterServiceRetry != null) { + RetrySettings updateSecurityCenterServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSecurityCenterServiceSettings().getRetrySettings(), + updateSecurityCenterServiceRetry); + clientSettingsBuilder + .updateSecurityCenterServiceSettings() + .setRetrySettings(updateSecurityCenterServiceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateSecurityCenterService 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 SecurityCenterManagementClient bean configured with + * SecurityCenterManagementSettings. + * + * @param securityCenterManagementSettings settings to configure an instance of client bean. + * @return a {@link SecurityCenterManagementClient} bean configured with {@link + * SecurityCenterManagementSettings} + */ + @Bean + @ConditionalOnMissingBean + public SecurityCenterManagementClient securityCenterManagementClient( + SecurityCenterManagementSettings securityCenterManagementSettings) throws IOException { + return SecurityCenterManagementClient.create(securityCenterManagementSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-security-center-management"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringProperties.java b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringProperties.java new file mode 100644 index 0000000000..eda1a62f10 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/SecurityCenterManagementSpringProperties.java @@ -0,0 +1,419 @@ +/* + * 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.securitycentermanagement.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 SecurityCenterManagement client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.securitycentermanagement.v1.security-center-management") +public class SecurityCenterManagementSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 + * listEffectiveSecurityHealthAnalyticsCustomModules. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEffectiveSecurityHealthAnalyticsCustomModulesRetry; + /** + * Allow override of retry settings at method-level for + * getEffectiveSecurityHealthAnalyticsCustomModule. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEffectiveSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for listSecurityHealthAnalyticsCustomModules. + * If defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSecurityHealthAnalyticsCustomModulesRetry; + /** + * Allow override of retry settings at method-level for + * listDescendantSecurityHealthAnalyticsCustomModules. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty + private Retry listDescendantSecurityHealthAnalyticsCustomModulesRetry; + /** + * Allow override of retry settings at method-level for getSecurityHealthAnalyticsCustomModule. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for createSecurityHealthAnalyticsCustomModule. + * If defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for updateSecurityHealthAnalyticsCustomModule. + * If defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for deleteSecurityHealthAnalyticsCustomModule. + * If defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for + * simulateSecurityHealthAnalyticsCustomModule. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry simulateSecurityHealthAnalyticsCustomModuleRetry; + /** + * Allow override of retry settings at method-level for + * listEffectiveEventThreatDetectionCustomModules. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEffectiveEventThreatDetectionCustomModulesRetry; + /** + * Allow override of retry settings at method-level for + * getEffectiveEventThreatDetectionCustomModule. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEffectiveEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for listEventThreatDetectionCustomModules. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEventThreatDetectionCustomModulesRetry; + /** + * Allow override of retry settings at method-level for + * listDescendantEventThreatDetectionCustomModules. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDescendantEventThreatDetectionCustomModulesRetry; + /** + * Allow override of retry settings at method-level for getEventThreatDetectionCustomModule. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for createEventThreatDetectionCustomModule. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for updateEventThreatDetectionCustomModule. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for deleteEventThreatDetectionCustomModule. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for validateEventThreatDetectionCustomModule. + * If defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry validateEventThreatDetectionCustomModuleRetry; + /** + * Allow override of retry settings at method-level for getSecurityCenterService. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSecurityCenterServiceRetry; + /** + * Allow override of retry settings at method-level for listSecurityCenterServices. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSecurityCenterServicesRetry; + /** + * Allow override of retry settings at method-level for updateSecurityCenterService. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateSecurityCenterServiceRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListEffectiveSecurityHealthAnalyticsCustomModulesRetry() { + return this.listEffectiveSecurityHealthAnalyticsCustomModulesRetry; + } + + public void setListEffectiveSecurityHealthAnalyticsCustomModulesRetry( + Retry listEffectiveSecurityHealthAnalyticsCustomModulesRetry) { + this.listEffectiveSecurityHealthAnalyticsCustomModulesRetry = + listEffectiveSecurityHealthAnalyticsCustomModulesRetry; + } + + public Retry getGetEffectiveSecurityHealthAnalyticsCustomModuleRetry() { + return this.getEffectiveSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setGetEffectiveSecurityHealthAnalyticsCustomModuleRetry( + Retry getEffectiveSecurityHealthAnalyticsCustomModuleRetry) { + this.getEffectiveSecurityHealthAnalyticsCustomModuleRetry = + getEffectiveSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getListSecurityHealthAnalyticsCustomModulesRetry() { + return this.listSecurityHealthAnalyticsCustomModulesRetry; + } + + public void setListSecurityHealthAnalyticsCustomModulesRetry( + Retry listSecurityHealthAnalyticsCustomModulesRetry) { + this.listSecurityHealthAnalyticsCustomModulesRetry = + listSecurityHealthAnalyticsCustomModulesRetry; + } + + public Retry getListDescendantSecurityHealthAnalyticsCustomModulesRetry() { + return this.listDescendantSecurityHealthAnalyticsCustomModulesRetry; + } + + public void setListDescendantSecurityHealthAnalyticsCustomModulesRetry( + Retry listDescendantSecurityHealthAnalyticsCustomModulesRetry) { + this.listDescendantSecurityHealthAnalyticsCustomModulesRetry = + listDescendantSecurityHealthAnalyticsCustomModulesRetry; + } + + public Retry getGetSecurityHealthAnalyticsCustomModuleRetry() { + return this.getSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setGetSecurityHealthAnalyticsCustomModuleRetry( + Retry getSecurityHealthAnalyticsCustomModuleRetry) { + this.getSecurityHealthAnalyticsCustomModuleRetry = getSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getCreateSecurityHealthAnalyticsCustomModuleRetry() { + return this.createSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setCreateSecurityHealthAnalyticsCustomModuleRetry( + Retry createSecurityHealthAnalyticsCustomModuleRetry) { + this.createSecurityHealthAnalyticsCustomModuleRetry = + createSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getUpdateSecurityHealthAnalyticsCustomModuleRetry() { + return this.updateSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setUpdateSecurityHealthAnalyticsCustomModuleRetry( + Retry updateSecurityHealthAnalyticsCustomModuleRetry) { + this.updateSecurityHealthAnalyticsCustomModuleRetry = + updateSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getDeleteSecurityHealthAnalyticsCustomModuleRetry() { + return this.deleteSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setDeleteSecurityHealthAnalyticsCustomModuleRetry( + Retry deleteSecurityHealthAnalyticsCustomModuleRetry) { + this.deleteSecurityHealthAnalyticsCustomModuleRetry = + deleteSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getSimulateSecurityHealthAnalyticsCustomModuleRetry() { + return this.simulateSecurityHealthAnalyticsCustomModuleRetry; + } + + public void setSimulateSecurityHealthAnalyticsCustomModuleRetry( + Retry simulateSecurityHealthAnalyticsCustomModuleRetry) { + this.simulateSecurityHealthAnalyticsCustomModuleRetry = + simulateSecurityHealthAnalyticsCustomModuleRetry; + } + + public Retry getListEffectiveEventThreatDetectionCustomModulesRetry() { + return this.listEffectiveEventThreatDetectionCustomModulesRetry; + } + + public void setListEffectiveEventThreatDetectionCustomModulesRetry( + Retry listEffectiveEventThreatDetectionCustomModulesRetry) { + this.listEffectiveEventThreatDetectionCustomModulesRetry = + listEffectiveEventThreatDetectionCustomModulesRetry; + } + + public Retry getGetEffectiveEventThreatDetectionCustomModuleRetry() { + return this.getEffectiveEventThreatDetectionCustomModuleRetry; + } + + public void setGetEffectiveEventThreatDetectionCustomModuleRetry( + Retry getEffectiveEventThreatDetectionCustomModuleRetry) { + this.getEffectiveEventThreatDetectionCustomModuleRetry = + getEffectiveEventThreatDetectionCustomModuleRetry; + } + + public Retry getListEventThreatDetectionCustomModulesRetry() { + return this.listEventThreatDetectionCustomModulesRetry; + } + + public void setListEventThreatDetectionCustomModulesRetry( + Retry listEventThreatDetectionCustomModulesRetry) { + this.listEventThreatDetectionCustomModulesRetry = listEventThreatDetectionCustomModulesRetry; + } + + public Retry getListDescendantEventThreatDetectionCustomModulesRetry() { + return this.listDescendantEventThreatDetectionCustomModulesRetry; + } + + public void setListDescendantEventThreatDetectionCustomModulesRetry( + Retry listDescendantEventThreatDetectionCustomModulesRetry) { + this.listDescendantEventThreatDetectionCustomModulesRetry = + listDescendantEventThreatDetectionCustomModulesRetry; + } + + public Retry getGetEventThreatDetectionCustomModuleRetry() { + return this.getEventThreatDetectionCustomModuleRetry; + } + + public void setGetEventThreatDetectionCustomModuleRetry( + Retry getEventThreatDetectionCustomModuleRetry) { + this.getEventThreatDetectionCustomModuleRetry = getEventThreatDetectionCustomModuleRetry; + } + + public Retry getCreateEventThreatDetectionCustomModuleRetry() { + return this.createEventThreatDetectionCustomModuleRetry; + } + + public void setCreateEventThreatDetectionCustomModuleRetry( + Retry createEventThreatDetectionCustomModuleRetry) { + this.createEventThreatDetectionCustomModuleRetry = createEventThreatDetectionCustomModuleRetry; + } + + public Retry getUpdateEventThreatDetectionCustomModuleRetry() { + return this.updateEventThreatDetectionCustomModuleRetry; + } + + public void setUpdateEventThreatDetectionCustomModuleRetry( + Retry updateEventThreatDetectionCustomModuleRetry) { + this.updateEventThreatDetectionCustomModuleRetry = updateEventThreatDetectionCustomModuleRetry; + } + + public Retry getDeleteEventThreatDetectionCustomModuleRetry() { + return this.deleteEventThreatDetectionCustomModuleRetry; + } + + public void setDeleteEventThreatDetectionCustomModuleRetry( + Retry deleteEventThreatDetectionCustomModuleRetry) { + this.deleteEventThreatDetectionCustomModuleRetry = deleteEventThreatDetectionCustomModuleRetry; + } + + public Retry getValidateEventThreatDetectionCustomModuleRetry() { + return this.validateEventThreatDetectionCustomModuleRetry; + } + + public void setValidateEventThreatDetectionCustomModuleRetry( + Retry validateEventThreatDetectionCustomModuleRetry) { + this.validateEventThreatDetectionCustomModuleRetry = + validateEventThreatDetectionCustomModuleRetry; + } + + public Retry getGetSecurityCenterServiceRetry() { + return this.getSecurityCenterServiceRetry; + } + + public void setGetSecurityCenterServiceRetry(Retry getSecurityCenterServiceRetry) { + this.getSecurityCenterServiceRetry = getSecurityCenterServiceRetry; + } + + public Retry getListSecurityCenterServicesRetry() { + return this.listSecurityCenterServicesRetry; + } + + public void setListSecurityCenterServicesRetry(Retry listSecurityCenterServicesRetry) { + this.listSecurityCenterServicesRetry = listSecurityCenterServicesRetry; + } + + public Retry getUpdateSecurityCenterServiceRetry() { + return this.updateSecurityCenterServiceRetry; + } + + public void setUpdateSecurityCenterServiceRetry(Retry updateSecurityCenterServiceRetry) { + this.updateSecurityCenterServiceRetry = updateSecurityCenterServiceRetry; + } + + 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-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/v1/spring/package-info.java new file mode 100644 index 0000000000..5e72345af4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/java/com/google/cloud/securitycentermanagement/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 securitycentermanagement. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.securitycentermanagement.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..2a406a6cde --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.securitycentermanagement.v1.security-center-management.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud securitycentermanagement/SecurityCenterManagement components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..e3c47c090b --- /dev/null +++ b/spring-cloud-previews/google-cloud-securitycentermanagement-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.securitycentermanagement.v1.spring.SecurityCenterManagementSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-securityposture-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-securityposture-spring-starter/pom.xml new file mode 100644 index 0000000000..6d3c5ab97c --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-securityposture-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - securityposture + Spring Boot Starter with AutoConfiguration for securityposture + + + + + com.google.cloud + google-cloud-securityposture + + + + 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-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringAutoConfiguration.java new file mode 100644 index 0000000000..d99a32bfd1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringAutoConfiguration.java @@ -0,0 +1,357 @@ +/* + * 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.securityposture.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.securityposture.v1.SecurityPostureClient; +import com.google.cloud.securityposture.v1.SecurityPostureSettings; +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 SecurityPostureClient}. + * + *

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(SecurityPostureClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.securityposture.v1.security-posture.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SecurityPostureSpringProperties.class) +public class SecurityPostureSpringAutoConfiguration { + private final SecurityPostureSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(SecurityPostureSpringAutoConfiguration.class); + + protected SecurityPostureSpringAutoConfiguration( + SecurityPostureSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SecurityPosture-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 = "defaultSecurityPostureTransportChannelProvider") + public TransportChannelProvider defaultSecurityPostureTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return SecurityPostureSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return SecurityPostureSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SecurityPostureSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultSecurityPostureTransportChannelProvider()). 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 SecurityPostureSpringProperties. 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 SecurityPostureSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public SecurityPostureSettings securityPostureSettings( + @Qualifier("defaultSecurityPostureTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SecurityPostureSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SecurityPostureSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SecurityPostureSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SecurityPostureSettings.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 = + SecurityPostureSettings.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 listPosturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPosturesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listPosturesSettings().setRetrySettings(listPosturesRetrySettings); + + RetrySettings listPostureRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureRevisionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPostureRevisionsSettings() + .setRetrySettings(listPostureRevisionsRetrySettings); + + RetrySettings getPostureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPostureSettings().setRetrySettings(getPostureRetrySettings); + + RetrySettings listPostureDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureDeploymentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPostureDeploymentsSettings() + .setRetrySettings(listPostureDeploymentsRetrySettings); + + RetrySettings getPostureDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getPostureDeploymentSettings() + .setRetrySettings(getPostureDeploymentRetrySettings); + + RetrySettings listPostureTemplatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureTemplatesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPostureTemplatesSettings() + .setRetrySettings(listPostureTemplatesRetrySettings); + + RetrySettings getPostureTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureTemplateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getPostureTemplateSettings() + .setRetrySettings(getPostureTemplateRetrySettings); + + 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 listPosturesRetry = clientProperties.getListPosturesRetry(); + if (listPosturesRetry != null) { + RetrySettings listPosturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPosturesSettings().getRetrySettings(), listPosturesRetry); + clientSettingsBuilder.listPosturesSettings().setRetrySettings(listPosturesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listPostures from properties."); + } + } + Retry listPostureRevisionsRetry = clientProperties.getListPostureRevisionsRetry(); + if (listPostureRevisionsRetry != null) { + RetrySettings listPostureRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureRevisionsSettings().getRetrySettings(), + listPostureRevisionsRetry); + clientSettingsBuilder + .listPostureRevisionsSettings() + .setRetrySettings(listPostureRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPostureRevisions from properties."); + } + } + Retry getPostureRetry = clientProperties.getGetPostureRetry(); + if (getPostureRetry != null) { + RetrySettings getPostureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureSettings().getRetrySettings(), getPostureRetry); + clientSettingsBuilder.getPostureSettings().setRetrySettings(getPostureRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPosture from properties."); + } + } + Retry listPostureDeploymentsRetry = clientProperties.getListPostureDeploymentsRetry(); + if (listPostureDeploymentsRetry != null) { + RetrySettings listPostureDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureDeploymentsSettings().getRetrySettings(), + listPostureDeploymentsRetry); + clientSettingsBuilder + .listPostureDeploymentsSettings() + .setRetrySettings(listPostureDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPostureDeployments from properties."); + } + } + Retry getPostureDeploymentRetry = clientProperties.getGetPostureDeploymentRetry(); + if (getPostureDeploymentRetry != null) { + RetrySettings getPostureDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureDeploymentSettings().getRetrySettings(), + getPostureDeploymentRetry); + clientSettingsBuilder + .getPostureDeploymentSettings() + .setRetrySettings(getPostureDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPostureDeployment from properties."); + } + } + Retry listPostureTemplatesRetry = clientProperties.getListPostureTemplatesRetry(); + if (listPostureTemplatesRetry != null) { + RetrySettings listPostureTemplatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPostureTemplatesSettings().getRetrySettings(), + listPostureTemplatesRetry); + clientSettingsBuilder + .listPostureTemplatesSettings() + .setRetrySettings(listPostureTemplatesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPostureTemplates from properties."); + } + } + Retry getPostureTemplateRetry = clientProperties.getGetPostureTemplateRetry(); + if (getPostureTemplateRetry != null) { + RetrySettings getPostureTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPostureTemplateSettings().getRetrySettings(), + getPostureTemplateRetry); + clientSettingsBuilder + .getPostureTemplateSettings() + .setRetrySettings(getPostureTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPostureTemplate 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 SecurityPostureClient bean configured with SecurityPostureSettings. + * + * @param securityPostureSettings settings to configure an instance of client bean. + * @return a {@link SecurityPostureClient} bean configured with {@link SecurityPostureSettings} + */ + @Bean + @ConditionalOnMissingBean + public SecurityPostureClient securityPostureClient( + SecurityPostureSettings securityPostureSettings) throws IOException { + return SecurityPostureClient.create(securityPostureSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-security-posture"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringProperties.java b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringProperties.java new file mode 100644 index 0000000000..97bf9fcc9f --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/SecurityPostureSpringProperties.java @@ -0,0 +1,199 @@ +/* + * 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.securityposture.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 SecurityPosture client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.securityposture.v1.security-posture") +public class SecurityPostureSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listPostures. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPosturesRetry; + /** + * Allow override of retry settings at method-level for listPostureRevisions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPostureRevisionsRetry; + /** + * Allow override of retry settings at method-level for getPosture. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPostureRetry; + /** + * Allow override of retry settings at method-level for listPostureDeployments. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPostureDeploymentsRetry; + /** + * Allow override of retry settings at method-level for getPostureDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPostureDeploymentRetry; + /** + * Allow override of retry settings at method-level for listPostureTemplates. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPostureTemplatesRetry; + /** + * Allow override of retry settings at method-level for getPostureTemplate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPostureTemplateRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListPosturesRetry() { + return this.listPosturesRetry; + } + + public void setListPosturesRetry(Retry listPosturesRetry) { + this.listPosturesRetry = listPosturesRetry; + } + + public Retry getListPostureRevisionsRetry() { + return this.listPostureRevisionsRetry; + } + + public void setListPostureRevisionsRetry(Retry listPostureRevisionsRetry) { + this.listPostureRevisionsRetry = listPostureRevisionsRetry; + } + + public Retry getGetPostureRetry() { + return this.getPostureRetry; + } + + public void setGetPostureRetry(Retry getPostureRetry) { + this.getPostureRetry = getPostureRetry; + } + + public Retry getListPostureDeploymentsRetry() { + return this.listPostureDeploymentsRetry; + } + + public void setListPostureDeploymentsRetry(Retry listPostureDeploymentsRetry) { + this.listPostureDeploymentsRetry = listPostureDeploymentsRetry; + } + + public Retry getGetPostureDeploymentRetry() { + return this.getPostureDeploymentRetry; + } + + public void setGetPostureDeploymentRetry(Retry getPostureDeploymentRetry) { + this.getPostureDeploymentRetry = getPostureDeploymentRetry; + } + + public Retry getListPostureTemplatesRetry() { + return this.listPostureTemplatesRetry; + } + + public void setListPostureTemplatesRetry(Retry listPostureTemplatesRetry) { + this.listPostureTemplatesRetry = listPostureTemplatesRetry; + } + + public Retry getGetPostureTemplateRetry() { + return this.getPostureTemplateRetry; + } + + public void setGetPostureTemplateRetry(Retry getPostureTemplateRetry) { + this.getPostureTemplateRetry = getPostureTemplateRetry; + } + + 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-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/v1/spring/package-info.java new file mode 100644 index 0000000000..6a09bb1a1d --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/java/com/google/cloud/securityposture/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 securityposture. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.securityposture.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..699f2b0ae6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.securityposture.v1.security-posture.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud securityposture/SecurityPosture components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..7b16afaee0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-securityposture-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.securityposture.v1.spring.SecurityPostureSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringAutoConfiguration.java index 6ba6a068f3..f324d1f4e7 100644 --- a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public ServiceControllerSettings serviceControllerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServiceControllerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringAutoConfiguration.java index 6e2f0174a2..5b1c14e938 100644 --- a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ServiceManagerSettings serviceManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServiceManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringAutoConfiguration.java index de76eee9b1..f4ee699b1d 100644 --- a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public ServiceUsageSettings serviceUsageSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ServiceUsageSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringAutoConfiguration.java index 264bcbe3ea..26cf7be50e 100644 --- a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public LookupServiceSettings lookupServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(LookupServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java index c16236843d..a15df4c7ff 100644 --- a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public RegistrationServiceSettings registrationServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(RegistrationServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringAutoConfiguration.java index 0c5923d86a..241670cbf1 100644 --- a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public CloudShellServiceSettings cloudShellServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudShellServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringAutoConfiguration.java index 59ca7a3395..08a5228073 100644 --- a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public SpeechSettings speechSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(SpeechSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringAutoConfiguration.java index d5785b0acd..608b4ea158 100644 --- a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public StorageTransferServiceSettings storageTransferServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(StorageTransferServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringAutoConfiguration.java index 0167348c7a..80e673e5f4 100644 --- a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public CompanyServiceSettings companyServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CompanyServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java index 8f5f24eee0..3cb22e1bd3 100644 --- a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public CompletionSettings completionSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CompletionSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java index 73da3eb476..fabd8960b2 100644 --- a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public EventServiceSettings eventServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(EventServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java index c9bfb97cf0..139c715b53 100644 --- a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public JobServiceSettings jobServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(JobServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java index 7b50a6e8fe..0e9732d17d 100644 --- a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public TenantServiceSettings tenantServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TenantServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringAutoConfiguration.java index 28e4dfb816..31014d48c5 100644 --- a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public CloudTasksSettings cloudTasksSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(CloudTasksSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/pom.xml new file mode 100644 index 0000000000..8a6cf74bb5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-telcoautomation-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - telcoautomation + Spring Boot Starter with AutoConfiguration for telcoautomation + + + + + com.google.cloud + google-cloud-telcoautomation + + + + 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-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringAutoConfiguration.java new file mode 100644 index 0000000000..1ea9cf6b5d --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringAutoConfiguration.java @@ -0,0 +1,869 @@ +/* + * 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.telcoautomation.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.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 com.google.cloud.telcoautomation.v1.TelcoAutomationClient; +import com.google.cloud.telcoautomation.v1.TelcoAutomationSettings; +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 TelcoAutomationClient}. + * + *

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(TelcoAutomationClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.telcoautomation.v1.telco-automation.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(TelcoAutomationSpringProperties.class) +public class TelcoAutomationSpringAutoConfiguration { + private final TelcoAutomationSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(TelcoAutomationSpringAutoConfiguration.class); + + protected TelcoAutomationSpringAutoConfiguration( + TelcoAutomationSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from TelcoAutomation-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 = "defaultTelcoAutomationTransportChannelProvider") + public TransportChannelProvider defaultTelcoAutomationTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return TelcoAutomationSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return TelcoAutomationSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a TelcoAutomationSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultTelcoAutomationTransportChannelProvider()). 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 TelcoAutomationSpringProperties. 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 TelcoAutomationSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public TelcoAutomationSettings telcoAutomationSettings( + @Qualifier("defaultTelcoAutomationTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + TelcoAutomationSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = TelcoAutomationSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = TelcoAutomationSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TelcoAutomationSettings.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 = + TelcoAutomationSettings.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 listOrchestrationClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listOrchestrationClustersSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listOrchestrationClustersSettings() + .setRetrySettings(listOrchestrationClustersRetrySettings); + + RetrySettings getOrchestrationClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getOrchestrationClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getOrchestrationClusterSettings() + .setRetrySettings(getOrchestrationClusterRetrySettings); + + RetrySettings listEdgeSlmsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEdgeSlmsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listEdgeSlmsSettings().setRetrySettings(listEdgeSlmsRetrySettings); + + RetrySettings getEdgeSlmRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEdgeSlmSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEdgeSlmSettings().setRetrySettings(getEdgeSlmRetrySettings); + + RetrySettings createBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createBlueprintSettings() + .setRetrySettings(createBlueprintRetrySettings); + + RetrySettings updateBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateBlueprintSettings() + .setRetrySettings(updateBlueprintRetrySettings); + + RetrySettings getBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getBlueprintSettings().setRetrySettings(getBlueprintRetrySettings); + + RetrySettings deleteBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteBlueprintSettings() + .setRetrySettings(deleteBlueprintRetrySettings); + + RetrySettings listBlueprintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBlueprintsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listBlueprintsSettings().setRetrySettings(listBlueprintsRetrySettings); + + RetrySettings approveBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.approveBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .approveBlueprintSettings() + .setRetrySettings(approveBlueprintRetrySettings); + + RetrySettings proposeBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.proposeBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .proposeBlueprintSettings() + .setRetrySettings(proposeBlueprintRetrySettings); + + RetrySettings rejectBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rejectBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .rejectBlueprintSettings() + .setRetrySettings(rejectBlueprintRetrySettings); + + RetrySettings listBlueprintRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBlueprintRevisionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listBlueprintRevisionsSettings() + .setRetrySettings(listBlueprintRevisionsRetrySettings); + + RetrySettings searchBlueprintRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchBlueprintRevisionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .searchBlueprintRevisionsSettings() + .setRetrySettings(searchBlueprintRevisionsRetrySettings); + + RetrySettings searchDeploymentRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchDeploymentRevisionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .searchDeploymentRevisionsSettings() + .setRetrySettings(searchDeploymentRevisionsRetrySettings); + + RetrySettings discardBlueprintChangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.discardBlueprintChangesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .discardBlueprintChangesSettings() + .setRetrySettings(discardBlueprintChangesRetrySettings); + + RetrySettings listPublicBlueprintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPublicBlueprintsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPublicBlueprintsSettings() + .setRetrySettings(listPublicBlueprintsRetrySettings); + + RetrySettings getPublicBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPublicBlueprintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getPublicBlueprintSettings() + .setRetrySettings(getPublicBlueprintRetrySettings); + + RetrySettings createDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createDeploymentSettings() + .setRetrySettings(createDeploymentRetrySettings); + + RetrySettings updateDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateDeploymentSettings() + .setRetrySettings(updateDeploymentRetrySettings); + + RetrySettings getDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings); + + RetrySettings removeDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .removeDeploymentSettings() + .setRetrySettings(removeDeploymentRetrySettings); + + RetrySettings listDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDeploymentsSettings() + .setRetrySettings(listDeploymentsRetrySettings); + + RetrySettings listDeploymentRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentRevisionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listDeploymentRevisionsSettings() + .setRetrySettings(listDeploymentRevisionsRetrySettings); + + RetrySettings discardDeploymentChangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.discardDeploymentChangesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .discardDeploymentChangesSettings() + .setRetrySettings(discardDeploymentChangesRetrySettings); + + RetrySettings applyDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.applyDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .applyDeploymentSettings() + .setRetrySettings(applyDeploymentRetrySettings); + + RetrySettings computeDeploymentStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.computeDeploymentStatusSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .computeDeploymentStatusSettings() + .setRetrySettings(computeDeploymentStatusRetrySettings); + + RetrySettings rollbackDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rollbackDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .rollbackDeploymentSettings() + .setRetrySettings(rollbackDeploymentRetrySettings); + + RetrySettings getHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHydratedDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getHydratedDeploymentSettings() + .setRetrySettings(getHydratedDeploymentRetrySettings); + + RetrySettings listHydratedDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHydratedDeploymentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listHydratedDeploymentsSettings() + .setRetrySettings(listHydratedDeploymentsRetrySettings); + + RetrySettings updateHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateHydratedDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateHydratedDeploymentSettings() + .setRetrySettings(updateHydratedDeploymentRetrySettings); + + RetrySettings applyHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.applyHydratedDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .applyHydratedDeploymentSettings() + .setRetrySettings(applyHydratedDeploymentRetrySettings); + + 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 listOrchestrationClustersRetry = clientProperties.getListOrchestrationClustersRetry(); + if (listOrchestrationClustersRetry != null) { + RetrySettings listOrchestrationClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listOrchestrationClustersSettings().getRetrySettings(), + listOrchestrationClustersRetry); + clientSettingsBuilder + .listOrchestrationClustersSettings() + .setRetrySettings(listOrchestrationClustersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listOrchestrationClusters from properties."); + } + } + Retry getOrchestrationClusterRetry = clientProperties.getGetOrchestrationClusterRetry(); + if (getOrchestrationClusterRetry != null) { + RetrySettings getOrchestrationClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getOrchestrationClusterSettings().getRetrySettings(), + getOrchestrationClusterRetry); + clientSettingsBuilder + .getOrchestrationClusterSettings() + .setRetrySettings(getOrchestrationClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getOrchestrationCluster from properties."); + } + } + Retry listEdgeSlmsRetry = clientProperties.getListEdgeSlmsRetry(); + if (listEdgeSlmsRetry != null) { + RetrySettings listEdgeSlmsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEdgeSlmsSettings().getRetrySettings(), listEdgeSlmsRetry); + clientSettingsBuilder.listEdgeSlmsSettings().setRetrySettings(listEdgeSlmsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEdgeSlms from properties."); + } + } + Retry getEdgeSlmRetry = clientProperties.getGetEdgeSlmRetry(); + if (getEdgeSlmRetry != null) { + RetrySettings getEdgeSlmRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEdgeSlmSettings().getRetrySettings(), getEdgeSlmRetry); + clientSettingsBuilder.getEdgeSlmSettings().setRetrySettings(getEdgeSlmRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEdgeSlm from properties."); + } + } + Retry createBlueprintRetry = clientProperties.getCreateBlueprintRetry(); + if (createBlueprintRetry != null) { + RetrySettings createBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBlueprintSettings().getRetrySettings(), + createBlueprintRetry); + clientSettingsBuilder + .createBlueprintSettings() + .setRetrySettings(createBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createBlueprint from properties."); + } + } + Retry updateBlueprintRetry = clientProperties.getUpdateBlueprintRetry(); + if (updateBlueprintRetry != null) { + RetrySettings updateBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateBlueprintSettings().getRetrySettings(), + updateBlueprintRetry); + clientSettingsBuilder + .updateBlueprintSettings() + .setRetrySettings(updateBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateBlueprint from properties."); + } + } + Retry getBlueprintRetry = clientProperties.getGetBlueprintRetry(); + if (getBlueprintRetry != null) { + RetrySettings getBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBlueprintSettings().getRetrySettings(), getBlueprintRetry); + clientSettingsBuilder.getBlueprintSettings().setRetrySettings(getBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getBlueprint from properties."); + } + } + Retry deleteBlueprintRetry = clientProperties.getDeleteBlueprintRetry(); + if (deleteBlueprintRetry != null) { + RetrySettings deleteBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteBlueprintSettings().getRetrySettings(), + deleteBlueprintRetry); + clientSettingsBuilder + .deleteBlueprintSettings() + .setRetrySettings(deleteBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteBlueprint from properties."); + } + } + Retry listBlueprintsRetry = clientProperties.getListBlueprintsRetry(); + if (listBlueprintsRetry != null) { + RetrySettings listBlueprintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBlueprintsSettings().getRetrySettings(), + listBlueprintsRetry); + clientSettingsBuilder.listBlueprintsSettings().setRetrySettings(listBlueprintsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listBlueprints from properties."); + } + } + Retry approveBlueprintRetry = clientProperties.getApproveBlueprintRetry(); + if (approveBlueprintRetry != null) { + RetrySettings approveBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.approveBlueprintSettings().getRetrySettings(), + approveBlueprintRetry); + clientSettingsBuilder + .approveBlueprintSettings() + .setRetrySettings(approveBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for approveBlueprint from properties."); + } + } + Retry proposeBlueprintRetry = clientProperties.getProposeBlueprintRetry(); + if (proposeBlueprintRetry != null) { + RetrySettings proposeBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.proposeBlueprintSettings().getRetrySettings(), + proposeBlueprintRetry); + clientSettingsBuilder + .proposeBlueprintSettings() + .setRetrySettings(proposeBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for proposeBlueprint from properties."); + } + } + Retry rejectBlueprintRetry = clientProperties.getRejectBlueprintRetry(); + if (rejectBlueprintRetry != null) { + RetrySettings rejectBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rejectBlueprintSettings().getRetrySettings(), + rejectBlueprintRetry); + clientSettingsBuilder + .rejectBlueprintSettings() + .setRetrySettings(rejectBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for rejectBlueprint from properties."); + } + } + Retry listBlueprintRevisionsRetry = clientProperties.getListBlueprintRevisionsRetry(); + if (listBlueprintRevisionsRetry != null) { + RetrySettings listBlueprintRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBlueprintRevisionsSettings().getRetrySettings(), + listBlueprintRevisionsRetry); + clientSettingsBuilder + .listBlueprintRevisionsSettings() + .setRetrySettings(listBlueprintRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listBlueprintRevisions from properties."); + } + } + Retry searchBlueprintRevisionsRetry = clientProperties.getSearchBlueprintRevisionsRetry(); + if (searchBlueprintRevisionsRetry != null) { + RetrySettings searchBlueprintRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchBlueprintRevisionsSettings().getRetrySettings(), + searchBlueprintRevisionsRetry); + clientSettingsBuilder + .searchBlueprintRevisionsSettings() + .setRetrySettings(searchBlueprintRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for searchBlueprintRevisions from properties."); + } + } + Retry searchDeploymentRevisionsRetry = clientProperties.getSearchDeploymentRevisionsRetry(); + if (searchDeploymentRevisionsRetry != null) { + RetrySettings searchDeploymentRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchDeploymentRevisionsSettings().getRetrySettings(), + searchDeploymentRevisionsRetry); + clientSettingsBuilder + .searchDeploymentRevisionsSettings() + .setRetrySettings(searchDeploymentRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for searchDeploymentRevisions from properties."); + } + } + Retry discardBlueprintChangesRetry = clientProperties.getDiscardBlueprintChangesRetry(); + if (discardBlueprintChangesRetry != null) { + RetrySettings discardBlueprintChangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.discardBlueprintChangesSettings().getRetrySettings(), + discardBlueprintChangesRetry); + clientSettingsBuilder + .discardBlueprintChangesSettings() + .setRetrySettings(discardBlueprintChangesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for discardBlueprintChanges from properties."); + } + } + Retry listPublicBlueprintsRetry = clientProperties.getListPublicBlueprintsRetry(); + if (listPublicBlueprintsRetry != null) { + RetrySettings listPublicBlueprintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPublicBlueprintsSettings().getRetrySettings(), + listPublicBlueprintsRetry); + clientSettingsBuilder + .listPublicBlueprintsSettings() + .setRetrySettings(listPublicBlueprintsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPublicBlueprints from properties."); + } + } + Retry getPublicBlueprintRetry = clientProperties.getGetPublicBlueprintRetry(); + if (getPublicBlueprintRetry != null) { + RetrySettings getPublicBlueprintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPublicBlueprintSettings().getRetrySettings(), + getPublicBlueprintRetry); + clientSettingsBuilder + .getPublicBlueprintSettings() + .setRetrySettings(getPublicBlueprintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPublicBlueprint from properties."); + } + } + Retry createDeploymentRetry = clientProperties.getCreateDeploymentRetry(); + if (createDeploymentRetry != null) { + RetrySettings createDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDeploymentSettings().getRetrySettings(), + createDeploymentRetry); + clientSettingsBuilder + .createDeploymentSettings() + .setRetrySettings(createDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createDeployment from properties."); + } + } + Retry updateDeploymentRetry = clientProperties.getUpdateDeploymentRetry(); + if (updateDeploymentRetry != null) { + RetrySettings updateDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDeploymentSettings().getRetrySettings(), + updateDeploymentRetry); + clientSettingsBuilder + .updateDeploymentSettings() + .setRetrySettings(updateDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateDeployment from properties."); + } + } + Retry getDeploymentRetry = clientProperties.getGetDeploymentRetry(); + if (getDeploymentRetry != null) { + RetrySettings getDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), getDeploymentRetry); + clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDeployment from properties."); + } + } + Retry removeDeploymentRetry = clientProperties.getRemoveDeploymentRetry(); + if (removeDeploymentRetry != null) { + RetrySettings removeDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeDeploymentSettings().getRetrySettings(), + removeDeploymentRetry); + clientSettingsBuilder + .removeDeploymentSettings() + .setRetrySettings(removeDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for removeDeployment from properties."); + } + } + Retry listDeploymentsRetry = clientProperties.getListDeploymentsRetry(); + if (listDeploymentsRetry != null) { + RetrySettings listDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(), + listDeploymentsRetry); + clientSettingsBuilder + .listDeploymentsSettings() + .setRetrySettings(listDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDeployments from properties."); + } + } + Retry listDeploymentRevisionsRetry = clientProperties.getListDeploymentRevisionsRetry(); + if (listDeploymentRevisionsRetry != null) { + RetrySettings listDeploymentRevisionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentRevisionsSettings().getRetrySettings(), + listDeploymentRevisionsRetry); + clientSettingsBuilder + .listDeploymentRevisionsSettings() + .setRetrySettings(listDeploymentRevisionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDeploymentRevisions from properties."); + } + } + Retry discardDeploymentChangesRetry = clientProperties.getDiscardDeploymentChangesRetry(); + if (discardDeploymentChangesRetry != null) { + RetrySettings discardDeploymentChangesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.discardDeploymentChangesSettings().getRetrySettings(), + discardDeploymentChangesRetry); + clientSettingsBuilder + .discardDeploymentChangesSettings() + .setRetrySettings(discardDeploymentChangesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for discardDeploymentChanges from properties."); + } + } + Retry applyDeploymentRetry = clientProperties.getApplyDeploymentRetry(); + if (applyDeploymentRetry != null) { + RetrySettings applyDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.applyDeploymentSettings().getRetrySettings(), + applyDeploymentRetry); + clientSettingsBuilder + .applyDeploymentSettings() + .setRetrySettings(applyDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for applyDeployment from properties."); + } + } + Retry computeDeploymentStatusRetry = clientProperties.getComputeDeploymentStatusRetry(); + if (computeDeploymentStatusRetry != null) { + RetrySettings computeDeploymentStatusRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.computeDeploymentStatusSettings().getRetrySettings(), + computeDeploymentStatusRetry); + clientSettingsBuilder + .computeDeploymentStatusSettings() + .setRetrySettings(computeDeploymentStatusRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for computeDeploymentStatus from properties."); + } + } + Retry rollbackDeploymentRetry = clientProperties.getRollbackDeploymentRetry(); + if (rollbackDeploymentRetry != null) { + RetrySettings rollbackDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rollbackDeploymentSettings().getRetrySettings(), + rollbackDeploymentRetry); + clientSettingsBuilder + .rollbackDeploymentSettings() + .setRetrySettings(rollbackDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for rollbackDeployment from properties."); + } + } + Retry getHydratedDeploymentRetry = clientProperties.getGetHydratedDeploymentRetry(); + if (getHydratedDeploymentRetry != null) { + RetrySettings getHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHydratedDeploymentSettings().getRetrySettings(), + getHydratedDeploymentRetry); + clientSettingsBuilder + .getHydratedDeploymentSettings() + .setRetrySettings(getHydratedDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getHydratedDeployment from properties."); + } + } + Retry listHydratedDeploymentsRetry = clientProperties.getListHydratedDeploymentsRetry(); + if (listHydratedDeploymentsRetry != null) { + RetrySettings listHydratedDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHydratedDeploymentsSettings().getRetrySettings(), + listHydratedDeploymentsRetry); + clientSettingsBuilder + .listHydratedDeploymentsSettings() + .setRetrySettings(listHydratedDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listHydratedDeployments from properties."); + } + } + Retry updateHydratedDeploymentRetry = clientProperties.getUpdateHydratedDeploymentRetry(); + if (updateHydratedDeploymentRetry != null) { + RetrySettings updateHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateHydratedDeploymentSettings().getRetrySettings(), + updateHydratedDeploymentRetry); + clientSettingsBuilder + .updateHydratedDeploymentSettings() + .setRetrySettings(updateHydratedDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateHydratedDeployment from properties."); + } + } + Retry applyHydratedDeploymentRetry = clientProperties.getApplyHydratedDeploymentRetry(); + if (applyHydratedDeploymentRetry != null) { + RetrySettings applyHydratedDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.applyHydratedDeploymentSettings().getRetrySettings(), + applyHydratedDeploymentRetry); + clientSettingsBuilder + .applyHydratedDeploymentSettings() + .setRetrySettings(applyHydratedDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for applyHydratedDeployment 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 TelcoAutomationClient bean configured with TelcoAutomationSettings. + * + * @param telcoAutomationSettings settings to configure an instance of client bean. + * @return a {@link TelcoAutomationClient} bean configured with {@link TelcoAutomationSettings} + */ + @Bean + @ConditionalOnMissingBean + public TelcoAutomationClient telcoAutomationClient( + TelcoAutomationSettings telcoAutomationSettings) throws IOException { + return TelcoAutomationClient.create(telcoAutomationSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-telco-automation"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringProperties.java b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringProperties.java new file mode 100644 index 0000000000..383f8b0d51 --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/TelcoAutomationSpringProperties.java @@ -0,0 +1,524 @@ +/* + * 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.telcoautomation.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 TelcoAutomation client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.telcoautomation.v1.telco-automation") +public class TelcoAutomationSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 listOrchestrationClusters. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listOrchestrationClustersRetry; + /** + * Allow override of retry settings at method-level for getOrchestrationCluster. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getOrchestrationClusterRetry; + /** + * Allow override of retry settings at method-level for listEdgeSlms. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEdgeSlmsRetry; + /** + * Allow override of retry settings at method-level for getEdgeSlm. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEdgeSlmRetry; + /** + * Allow override of retry settings at method-level for createBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createBlueprintRetry; + /** + * Allow override of retry settings at method-level for updateBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateBlueprintRetry; + /** + * Allow override of retry settings at method-level for getBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getBlueprintRetry; + /** + * Allow override of retry settings at method-level for deleteBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteBlueprintRetry; + /** + * Allow override of retry settings at method-level for listBlueprints. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBlueprintsRetry; + /** + * Allow override of retry settings at method-level for approveBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry approveBlueprintRetry; + /** + * Allow override of retry settings at method-level for proposeBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry proposeBlueprintRetry; + /** + * Allow override of retry settings at method-level for rejectBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry rejectBlueprintRetry; + /** + * Allow override of retry settings at method-level for listBlueprintRevisions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBlueprintRevisionsRetry; + /** + * Allow override of retry settings at method-level for searchBlueprintRevisions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchBlueprintRevisionsRetry; + /** + * Allow override of retry settings at method-level for searchDeploymentRevisions. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchDeploymentRevisionsRetry; + /** + * Allow override of retry settings at method-level for discardBlueprintChanges. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry discardBlueprintChangesRetry; + /** + * Allow override of retry settings at method-level for listPublicBlueprints. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPublicBlueprintsRetry; + /** + * Allow override of retry settings at method-level for getPublicBlueprint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPublicBlueprintRetry; + /** + * Allow override of retry settings at method-level for createDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createDeploymentRetry; + /** + * Allow override of retry settings at method-level for updateDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDeploymentRetry; + /** + * Allow override of retry settings at method-level for getDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDeploymentRetry; + /** + * Allow override of retry settings at method-level for removeDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry removeDeploymentRetry; + /** + * Allow override of retry settings at method-level for listDeployments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDeploymentsRetry; + /** + * Allow override of retry settings at method-level for listDeploymentRevisions. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDeploymentRevisionsRetry; + /** + * Allow override of retry settings at method-level for discardDeploymentChanges. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry discardDeploymentChangesRetry; + /** + * Allow override of retry settings at method-level for applyDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry applyDeploymentRetry; + /** + * Allow override of retry settings at method-level for computeDeploymentStatus. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry computeDeploymentStatusRetry; + /** + * Allow override of retry settings at method-level for rollbackDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry rollbackDeploymentRetry; + /** + * Allow override of retry settings at method-level for getHydratedDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getHydratedDeploymentRetry; + /** + * Allow override of retry settings at method-level for listHydratedDeployments. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listHydratedDeploymentsRetry; + /** + * Allow override of retry settings at method-level for updateHydratedDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateHydratedDeploymentRetry; + /** + * Allow override of retry settings at method-level for applyHydratedDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry applyHydratedDeploymentRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getListOrchestrationClustersRetry() { + return this.listOrchestrationClustersRetry; + } + + public void setListOrchestrationClustersRetry(Retry listOrchestrationClustersRetry) { + this.listOrchestrationClustersRetry = listOrchestrationClustersRetry; + } + + public Retry getGetOrchestrationClusterRetry() { + return this.getOrchestrationClusterRetry; + } + + public void setGetOrchestrationClusterRetry(Retry getOrchestrationClusterRetry) { + this.getOrchestrationClusterRetry = getOrchestrationClusterRetry; + } + + public Retry getListEdgeSlmsRetry() { + return this.listEdgeSlmsRetry; + } + + public void setListEdgeSlmsRetry(Retry listEdgeSlmsRetry) { + this.listEdgeSlmsRetry = listEdgeSlmsRetry; + } + + public Retry getGetEdgeSlmRetry() { + return this.getEdgeSlmRetry; + } + + public void setGetEdgeSlmRetry(Retry getEdgeSlmRetry) { + this.getEdgeSlmRetry = getEdgeSlmRetry; + } + + public Retry getCreateBlueprintRetry() { + return this.createBlueprintRetry; + } + + public void setCreateBlueprintRetry(Retry createBlueprintRetry) { + this.createBlueprintRetry = createBlueprintRetry; + } + + public Retry getUpdateBlueprintRetry() { + return this.updateBlueprintRetry; + } + + public void setUpdateBlueprintRetry(Retry updateBlueprintRetry) { + this.updateBlueprintRetry = updateBlueprintRetry; + } + + public Retry getGetBlueprintRetry() { + return this.getBlueprintRetry; + } + + public void setGetBlueprintRetry(Retry getBlueprintRetry) { + this.getBlueprintRetry = getBlueprintRetry; + } + + public Retry getDeleteBlueprintRetry() { + return this.deleteBlueprintRetry; + } + + public void setDeleteBlueprintRetry(Retry deleteBlueprintRetry) { + this.deleteBlueprintRetry = deleteBlueprintRetry; + } + + public Retry getListBlueprintsRetry() { + return this.listBlueprintsRetry; + } + + public void setListBlueprintsRetry(Retry listBlueprintsRetry) { + this.listBlueprintsRetry = listBlueprintsRetry; + } + + public Retry getApproveBlueprintRetry() { + return this.approveBlueprintRetry; + } + + public void setApproveBlueprintRetry(Retry approveBlueprintRetry) { + this.approveBlueprintRetry = approveBlueprintRetry; + } + + public Retry getProposeBlueprintRetry() { + return this.proposeBlueprintRetry; + } + + public void setProposeBlueprintRetry(Retry proposeBlueprintRetry) { + this.proposeBlueprintRetry = proposeBlueprintRetry; + } + + public Retry getRejectBlueprintRetry() { + return this.rejectBlueprintRetry; + } + + public void setRejectBlueprintRetry(Retry rejectBlueprintRetry) { + this.rejectBlueprintRetry = rejectBlueprintRetry; + } + + public Retry getListBlueprintRevisionsRetry() { + return this.listBlueprintRevisionsRetry; + } + + public void setListBlueprintRevisionsRetry(Retry listBlueprintRevisionsRetry) { + this.listBlueprintRevisionsRetry = listBlueprintRevisionsRetry; + } + + public Retry getSearchBlueprintRevisionsRetry() { + return this.searchBlueprintRevisionsRetry; + } + + public void setSearchBlueprintRevisionsRetry(Retry searchBlueprintRevisionsRetry) { + this.searchBlueprintRevisionsRetry = searchBlueprintRevisionsRetry; + } + + public Retry getSearchDeploymentRevisionsRetry() { + return this.searchDeploymentRevisionsRetry; + } + + public void setSearchDeploymentRevisionsRetry(Retry searchDeploymentRevisionsRetry) { + this.searchDeploymentRevisionsRetry = searchDeploymentRevisionsRetry; + } + + public Retry getDiscardBlueprintChangesRetry() { + return this.discardBlueprintChangesRetry; + } + + public void setDiscardBlueprintChangesRetry(Retry discardBlueprintChangesRetry) { + this.discardBlueprintChangesRetry = discardBlueprintChangesRetry; + } + + public Retry getListPublicBlueprintsRetry() { + return this.listPublicBlueprintsRetry; + } + + public void setListPublicBlueprintsRetry(Retry listPublicBlueprintsRetry) { + this.listPublicBlueprintsRetry = listPublicBlueprintsRetry; + } + + public Retry getGetPublicBlueprintRetry() { + return this.getPublicBlueprintRetry; + } + + public void setGetPublicBlueprintRetry(Retry getPublicBlueprintRetry) { + this.getPublicBlueprintRetry = getPublicBlueprintRetry; + } + + public Retry getCreateDeploymentRetry() { + return this.createDeploymentRetry; + } + + public void setCreateDeploymentRetry(Retry createDeploymentRetry) { + this.createDeploymentRetry = createDeploymentRetry; + } + + public Retry getUpdateDeploymentRetry() { + return this.updateDeploymentRetry; + } + + public void setUpdateDeploymentRetry(Retry updateDeploymentRetry) { + this.updateDeploymentRetry = updateDeploymentRetry; + } + + public Retry getGetDeploymentRetry() { + return this.getDeploymentRetry; + } + + public void setGetDeploymentRetry(Retry getDeploymentRetry) { + this.getDeploymentRetry = getDeploymentRetry; + } + + public Retry getRemoveDeploymentRetry() { + return this.removeDeploymentRetry; + } + + public void setRemoveDeploymentRetry(Retry removeDeploymentRetry) { + this.removeDeploymentRetry = removeDeploymentRetry; + } + + public Retry getListDeploymentsRetry() { + return this.listDeploymentsRetry; + } + + public void setListDeploymentsRetry(Retry listDeploymentsRetry) { + this.listDeploymentsRetry = listDeploymentsRetry; + } + + public Retry getListDeploymentRevisionsRetry() { + return this.listDeploymentRevisionsRetry; + } + + public void setListDeploymentRevisionsRetry(Retry listDeploymentRevisionsRetry) { + this.listDeploymentRevisionsRetry = listDeploymentRevisionsRetry; + } + + public Retry getDiscardDeploymentChangesRetry() { + return this.discardDeploymentChangesRetry; + } + + public void setDiscardDeploymentChangesRetry(Retry discardDeploymentChangesRetry) { + this.discardDeploymentChangesRetry = discardDeploymentChangesRetry; + } + + public Retry getApplyDeploymentRetry() { + return this.applyDeploymentRetry; + } + + public void setApplyDeploymentRetry(Retry applyDeploymentRetry) { + this.applyDeploymentRetry = applyDeploymentRetry; + } + + public Retry getComputeDeploymentStatusRetry() { + return this.computeDeploymentStatusRetry; + } + + public void setComputeDeploymentStatusRetry(Retry computeDeploymentStatusRetry) { + this.computeDeploymentStatusRetry = computeDeploymentStatusRetry; + } + + public Retry getRollbackDeploymentRetry() { + return this.rollbackDeploymentRetry; + } + + public void setRollbackDeploymentRetry(Retry rollbackDeploymentRetry) { + this.rollbackDeploymentRetry = rollbackDeploymentRetry; + } + + public Retry getGetHydratedDeploymentRetry() { + return this.getHydratedDeploymentRetry; + } + + public void setGetHydratedDeploymentRetry(Retry getHydratedDeploymentRetry) { + this.getHydratedDeploymentRetry = getHydratedDeploymentRetry; + } + + public Retry getListHydratedDeploymentsRetry() { + return this.listHydratedDeploymentsRetry; + } + + public void setListHydratedDeploymentsRetry(Retry listHydratedDeploymentsRetry) { + this.listHydratedDeploymentsRetry = listHydratedDeploymentsRetry; + } + + public Retry getUpdateHydratedDeploymentRetry() { + return this.updateHydratedDeploymentRetry; + } + + public void setUpdateHydratedDeploymentRetry(Retry updateHydratedDeploymentRetry) { + this.updateHydratedDeploymentRetry = updateHydratedDeploymentRetry; + } + + public Retry getApplyHydratedDeploymentRetry() { + return this.applyHydratedDeploymentRetry; + } + + public void setApplyHydratedDeploymentRetry(Retry applyHydratedDeploymentRetry) { + this.applyHydratedDeploymentRetry = applyHydratedDeploymentRetry; + } + + 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-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/v1/spring/package-info.java new file mode 100644 index 0000000000..01a2b742a6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/java/com/google/cloud/telcoautomation/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 telcoautomation. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.telcoautomation.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..135b443c80 --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.telcoautomation.v1.telco-automation.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud telcoautomation/TelcoAutomation components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..84cada78dc --- /dev/null +++ b/spring-cloud-previews/google-cloud-telcoautomation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.telcoautomation.v1.spring.TelcoAutomationSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringAutoConfiguration.java index 5376cd65e7..e67bdef953 100644 --- a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSe clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TextToSpeechLongAudioSynthesizeSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java index 80c5dd5ddb..7893afec8f 100644 --- a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public TextToSpeechSettings textToSpeechSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TextToSpeechSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringAutoConfiguration.java index f1a6fbb119..c7ca512c5d 100644 --- a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public TpuSettings tpuSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TpuSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringAutoConfiguration.java index d5154e4d74..cf1977f33e 100644 --- a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public TraceServiceSettings traceServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TraceServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-translate-spring-starter/src/main/java/com/google/cloud/translate/v3/spring/TranslationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-translate-spring-starter/src/main/java/com/google/cloud/translate/v3/spring/TranslationServiceSpringAutoConfiguration.java index 4a37c15245..c83e413c1b 100644 --- a/spring-cloud-previews/google-cloud-translate-spring-starter/src/main/java/com/google/cloud/translate/v3/spring/TranslationServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-translate-spring-starter/src/main/java/com/google/cloud/translate/v3/spring/TranslationServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public TranslationServiceSettings translationServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TranslationServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringAutoConfiguration.java index 94b37ae666..85016b04eb 100644 --- a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public VideoIntelligenceServiceSettings videoIntelligenceServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VideoIntelligenceServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/pom.xml new file mode 100644 index 0000000000..7182219e0c --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-video-stitcher-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - videostitcher + Spring Boot Starter with AutoConfiguration for videostitcher + + + + + com.google.cloud + google-cloud-video-stitcher + + + + 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-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..0117e6ffdc --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringAutoConfiguration.java @@ -0,0 +1,508 @@ +/* + * 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.video.stitcher.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.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 com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient; +import com.google.cloud.video.stitcher.v1.VideoStitcherServiceSettings; +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 VideoStitcherServiceClient}. + * + *

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(VideoStitcherServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.video.stitcher.v1.video-stitcher-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(VideoStitcherServiceSpringProperties.class) +public class VideoStitcherServiceSpringAutoConfiguration { + private final VideoStitcherServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(VideoStitcherServiceSpringAutoConfiguration.class); + + protected VideoStitcherServiceSpringAutoConfiguration( + VideoStitcherServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from VideoStitcherService-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 = "defaultVideoStitcherServiceTransportChannelProvider") + public TransportChannelProvider defaultVideoStitcherServiceTransportChannelProvider() { + return VideoStitcherServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a VideoStitcherServiceSettings bean configured to use a DefaultCredentialsProvider and + * the client library's default transport channel provider + * (defaultVideoStitcherServiceTransportChannelProvider()). 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 VideoStitcherServiceSpringProperties. 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 VideoStitcherServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public VideoStitcherServiceSettings videoStitcherServiceSettings( + @Qualifier("defaultVideoStitcherServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + VideoStitcherServiceSettings.Builder clientSettingsBuilder = + VideoStitcherServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VideoStitcherServiceSettings.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 = + VideoStitcherServiceSettings.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 listCdnKeysRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCdnKeysSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listCdnKeysSettings().setRetrySettings(listCdnKeysRetrySettings); + + RetrySettings getCdnKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCdnKeySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getCdnKeySettings().setRetrySettings(getCdnKeyRetrySettings); + + RetrySettings createVodSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createVodSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createVodSessionSettings() + .setRetrySettings(createVodSessionRetrySettings); + + RetrySettings getVodSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getVodSessionSettings().setRetrySettings(getVodSessionRetrySettings); + + RetrySettings listVodStitchDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodStitchDetailsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listVodStitchDetailsSettings() + .setRetrySettings(listVodStitchDetailsRetrySettings); + + RetrySettings getVodStitchDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodStitchDetailSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getVodStitchDetailSettings() + .setRetrySettings(getVodStitchDetailRetrySettings); + + RetrySettings listVodAdTagDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodAdTagDetailsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listVodAdTagDetailsSettings() + .setRetrySettings(listVodAdTagDetailsRetrySettings); + + RetrySettings getVodAdTagDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodAdTagDetailSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getVodAdTagDetailSettings() + .setRetrySettings(getVodAdTagDetailRetrySettings); + + RetrySettings listLiveAdTagDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLiveAdTagDetailsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listLiveAdTagDetailsSettings() + .setRetrySettings(listLiveAdTagDetailsRetrySettings); + + RetrySettings getLiveAdTagDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveAdTagDetailSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getLiveAdTagDetailSettings() + .setRetrySettings(getLiveAdTagDetailRetrySettings); + + RetrySettings listSlatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSlatesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSlatesSettings().setRetrySettings(listSlatesRetrySettings); + + RetrySettings getSlateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSlateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSlateSettings().setRetrySettings(getSlateRetrySettings); + + RetrySettings createLiveSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createLiveSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createLiveSessionSettings() + .setRetrySettings(createLiveSessionRetrySettings); + + RetrySettings getLiveSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveSessionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLiveSessionSettings().setRetrySettings(getLiveSessionRetrySettings); + + RetrySettings listLiveConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLiveConfigsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listLiveConfigsSettings() + .setRetrySettings(listLiveConfigsRetrySettings); + + RetrySettings getLiveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLiveConfigSettings().setRetrySettings(getLiveConfigRetrySettings); + + RetrySettings listVodConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodConfigsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listVodConfigsSettings().setRetrySettings(listVodConfigsRetrySettings); + + RetrySettings getVodConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getVodConfigSettings().setRetrySettings(getVodConfigRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listCdnKeysRetry = clientProperties.getListCdnKeysRetry(); + if (listCdnKeysRetry != null) { + RetrySettings listCdnKeysRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCdnKeysSettings().getRetrySettings(), listCdnKeysRetry); + clientSettingsBuilder.listCdnKeysSettings().setRetrySettings(listCdnKeysRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listCdnKeys from properties."); + } + } + Retry getCdnKeyRetry = clientProperties.getGetCdnKeyRetry(); + if (getCdnKeyRetry != null) { + RetrySettings getCdnKeyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCdnKeySettings().getRetrySettings(), getCdnKeyRetry); + clientSettingsBuilder.getCdnKeySettings().setRetrySettings(getCdnKeyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCdnKey from properties."); + } + } + Retry createVodSessionRetry = clientProperties.getCreateVodSessionRetry(); + if (createVodSessionRetry != null) { + RetrySettings createVodSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createVodSessionSettings().getRetrySettings(), + createVodSessionRetry); + clientSettingsBuilder + .createVodSessionSettings() + .setRetrySettings(createVodSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createVodSession from properties."); + } + } + Retry getVodSessionRetry = clientProperties.getGetVodSessionRetry(); + if (getVodSessionRetry != null) { + RetrySettings getVodSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodSessionSettings().getRetrySettings(), getVodSessionRetry); + clientSettingsBuilder.getVodSessionSettings().setRetrySettings(getVodSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getVodSession from properties."); + } + } + Retry listVodStitchDetailsRetry = clientProperties.getListVodStitchDetailsRetry(); + if (listVodStitchDetailsRetry != null) { + RetrySettings listVodStitchDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodStitchDetailsSettings().getRetrySettings(), + listVodStitchDetailsRetry); + clientSettingsBuilder + .listVodStitchDetailsSettings() + .setRetrySettings(listVodStitchDetailsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listVodStitchDetails from properties."); + } + } + Retry getVodStitchDetailRetry = clientProperties.getGetVodStitchDetailRetry(); + if (getVodStitchDetailRetry != null) { + RetrySettings getVodStitchDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodStitchDetailSettings().getRetrySettings(), + getVodStitchDetailRetry); + clientSettingsBuilder + .getVodStitchDetailSettings() + .setRetrySettings(getVodStitchDetailRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getVodStitchDetail from properties."); + } + } + Retry listVodAdTagDetailsRetry = clientProperties.getListVodAdTagDetailsRetry(); + if (listVodAdTagDetailsRetry != null) { + RetrySettings listVodAdTagDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodAdTagDetailsSettings().getRetrySettings(), + listVodAdTagDetailsRetry); + clientSettingsBuilder + .listVodAdTagDetailsSettings() + .setRetrySettings(listVodAdTagDetailsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listVodAdTagDetails from properties."); + } + } + Retry getVodAdTagDetailRetry = clientProperties.getGetVodAdTagDetailRetry(); + if (getVodAdTagDetailRetry != null) { + RetrySettings getVodAdTagDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodAdTagDetailSettings().getRetrySettings(), + getVodAdTagDetailRetry); + clientSettingsBuilder + .getVodAdTagDetailSettings() + .setRetrySettings(getVodAdTagDetailRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getVodAdTagDetail from properties."); + } + } + Retry listLiveAdTagDetailsRetry = clientProperties.getListLiveAdTagDetailsRetry(); + if (listLiveAdTagDetailsRetry != null) { + RetrySettings listLiveAdTagDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLiveAdTagDetailsSettings().getRetrySettings(), + listLiveAdTagDetailsRetry); + clientSettingsBuilder + .listLiveAdTagDetailsSettings() + .setRetrySettings(listLiveAdTagDetailsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listLiveAdTagDetails from properties."); + } + } + Retry getLiveAdTagDetailRetry = clientProperties.getGetLiveAdTagDetailRetry(); + if (getLiveAdTagDetailRetry != null) { + RetrySettings getLiveAdTagDetailRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveAdTagDetailSettings().getRetrySettings(), + getLiveAdTagDetailRetry); + clientSettingsBuilder + .getLiveAdTagDetailSettings() + .setRetrySettings(getLiveAdTagDetailRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getLiveAdTagDetail from properties."); + } + } + Retry listSlatesRetry = clientProperties.getListSlatesRetry(); + if (listSlatesRetry != null) { + RetrySettings listSlatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSlatesSettings().getRetrySettings(), listSlatesRetry); + clientSettingsBuilder.listSlatesSettings().setRetrySettings(listSlatesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSlates from properties."); + } + } + Retry getSlateRetry = clientProperties.getGetSlateRetry(); + if (getSlateRetry != null) { + RetrySettings getSlateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSlateSettings().getRetrySettings(), getSlateRetry); + clientSettingsBuilder.getSlateSettings().setRetrySettings(getSlateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSlate from properties."); + } + } + Retry createLiveSessionRetry = clientProperties.getCreateLiveSessionRetry(); + if (createLiveSessionRetry != null) { + RetrySettings createLiveSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createLiveSessionSettings().getRetrySettings(), + createLiveSessionRetry); + clientSettingsBuilder + .createLiveSessionSettings() + .setRetrySettings(createLiveSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createLiveSession from properties."); + } + } + Retry getLiveSessionRetry = clientProperties.getGetLiveSessionRetry(); + if (getLiveSessionRetry != null) { + RetrySettings getLiveSessionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveSessionSettings().getRetrySettings(), + getLiveSessionRetry); + clientSettingsBuilder.getLiveSessionSettings().setRetrySettings(getLiveSessionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLiveSession from properties."); + } + } + Retry listLiveConfigsRetry = clientProperties.getListLiveConfigsRetry(); + if (listLiveConfigsRetry != null) { + RetrySettings listLiveConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLiveConfigsSettings().getRetrySettings(), + listLiveConfigsRetry); + clientSettingsBuilder + .listLiveConfigsSettings() + .setRetrySettings(listLiveConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLiveConfigs from properties."); + } + } + Retry getLiveConfigRetry = clientProperties.getGetLiveConfigRetry(); + if (getLiveConfigRetry != null) { + RetrySettings getLiveConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLiveConfigSettings().getRetrySettings(), getLiveConfigRetry); + clientSettingsBuilder.getLiveConfigSettings().setRetrySettings(getLiveConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLiveConfig from properties."); + } + } + Retry listVodConfigsRetry = clientProperties.getListVodConfigsRetry(); + if (listVodConfigsRetry != null) { + RetrySettings listVodConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listVodConfigsSettings().getRetrySettings(), + listVodConfigsRetry); + clientSettingsBuilder.listVodConfigsSettings().setRetrySettings(listVodConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listVodConfigs from properties."); + } + } + Retry getVodConfigRetry = clientProperties.getGetVodConfigRetry(); + if (getVodConfigRetry != null) { + RetrySettings getVodConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getVodConfigSettings().getRetrySettings(), getVodConfigRetry); + clientSettingsBuilder.getVodConfigSettings().setRetrySettings(getVodConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getVodConfig from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a VideoStitcherServiceClient bean configured with VideoStitcherServiceSettings. + * + * @param videoStitcherServiceSettings settings to configure an instance of client bean. + * @return a {@link VideoStitcherServiceClient} bean configured with {@link + * VideoStitcherServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public VideoStitcherServiceClient videoStitcherServiceClient( + VideoStitcherServiceSettings videoStitcherServiceSettings) throws IOException { + return VideoStitcherServiceClient.create(videoStitcherServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-video-stitcher-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringProperties.java b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringProperties.java new file mode 100644 index 0000000000..aea94d37a4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/VideoStitcherServiceSpringProperties.java @@ -0,0 +1,306 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.video.stitcher.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 VideoStitcherService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.video.stitcher.v1.video-stitcher-service") +public class VideoStitcherServiceSpringProperties 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 listCdnKeys. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCdnKeysRetry; + /** + * Allow override of retry settings at method-level for getCdnKey. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCdnKeyRetry; + /** + * Allow override of retry settings at method-level for createVodSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createVodSessionRetry; + /** + * Allow override of retry settings at method-level for getVodSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getVodSessionRetry; + /** + * Allow override of retry settings at method-level for listVodStitchDetails. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listVodStitchDetailsRetry; + /** + * Allow override of retry settings at method-level for getVodStitchDetail. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getVodStitchDetailRetry; + /** + * Allow override of retry settings at method-level for listVodAdTagDetails. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listVodAdTagDetailsRetry; + /** + * Allow override of retry settings at method-level for getVodAdTagDetail. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getVodAdTagDetailRetry; + /** + * Allow override of retry settings at method-level for listLiveAdTagDetails. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLiveAdTagDetailsRetry; + /** + * Allow override of retry settings at method-level for getLiveAdTagDetail. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLiveAdTagDetailRetry; + /** + * Allow override of retry settings at method-level for listSlates. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSlatesRetry; + /** + * Allow override of retry settings at method-level for getSlate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSlateRetry; + /** + * Allow override of retry settings at method-level for createLiveSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createLiveSessionRetry; + /** + * Allow override of retry settings at method-level for getLiveSession. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLiveSessionRetry; + /** + * Allow override of retry settings at method-level for listLiveConfigs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLiveConfigsRetry; + /** + * Allow override of retry settings at method-level for getLiveConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLiveConfigRetry; + /** + * Allow override of retry settings at method-level for listVodConfigs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listVodConfigsRetry; + /** + * Allow override of retry settings at method-level for getVodConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getVodConfigRetry; + + @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 getListCdnKeysRetry() { + return this.listCdnKeysRetry; + } + + public void setListCdnKeysRetry(Retry listCdnKeysRetry) { + this.listCdnKeysRetry = listCdnKeysRetry; + } + + public Retry getGetCdnKeyRetry() { + return this.getCdnKeyRetry; + } + + public void setGetCdnKeyRetry(Retry getCdnKeyRetry) { + this.getCdnKeyRetry = getCdnKeyRetry; + } + + public Retry getCreateVodSessionRetry() { + return this.createVodSessionRetry; + } + + public void setCreateVodSessionRetry(Retry createVodSessionRetry) { + this.createVodSessionRetry = createVodSessionRetry; + } + + public Retry getGetVodSessionRetry() { + return this.getVodSessionRetry; + } + + public void setGetVodSessionRetry(Retry getVodSessionRetry) { + this.getVodSessionRetry = getVodSessionRetry; + } + + public Retry getListVodStitchDetailsRetry() { + return this.listVodStitchDetailsRetry; + } + + public void setListVodStitchDetailsRetry(Retry listVodStitchDetailsRetry) { + this.listVodStitchDetailsRetry = listVodStitchDetailsRetry; + } + + public Retry getGetVodStitchDetailRetry() { + return this.getVodStitchDetailRetry; + } + + public void setGetVodStitchDetailRetry(Retry getVodStitchDetailRetry) { + this.getVodStitchDetailRetry = getVodStitchDetailRetry; + } + + public Retry getListVodAdTagDetailsRetry() { + return this.listVodAdTagDetailsRetry; + } + + public void setListVodAdTagDetailsRetry(Retry listVodAdTagDetailsRetry) { + this.listVodAdTagDetailsRetry = listVodAdTagDetailsRetry; + } + + public Retry getGetVodAdTagDetailRetry() { + return this.getVodAdTagDetailRetry; + } + + public void setGetVodAdTagDetailRetry(Retry getVodAdTagDetailRetry) { + this.getVodAdTagDetailRetry = getVodAdTagDetailRetry; + } + + public Retry getListLiveAdTagDetailsRetry() { + return this.listLiveAdTagDetailsRetry; + } + + public void setListLiveAdTagDetailsRetry(Retry listLiveAdTagDetailsRetry) { + this.listLiveAdTagDetailsRetry = listLiveAdTagDetailsRetry; + } + + public Retry getGetLiveAdTagDetailRetry() { + return this.getLiveAdTagDetailRetry; + } + + public void setGetLiveAdTagDetailRetry(Retry getLiveAdTagDetailRetry) { + this.getLiveAdTagDetailRetry = getLiveAdTagDetailRetry; + } + + public Retry getListSlatesRetry() { + return this.listSlatesRetry; + } + + public void setListSlatesRetry(Retry listSlatesRetry) { + this.listSlatesRetry = listSlatesRetry; + } + + public Retry getGetSlateRetry() { + return this.getSlateRetry; + } + + public void setGetSlateRetry(Retry getSlateRetry) { + this.getSlateRetry = getSlateRetry; + } + + public Retry getCreateLiveSessionRetry() { + return this.createLiveSessionRetry; + } + + public void setCreateLiveSessionRetry(Retry createLiveSessionRetry) { + this.createLiveSessionRetry = createLiveSessionRetry; + } + + public Retry getGetLiveSessionRetry() { + return this.getLiveSessionRetry; + } + + public void setGetLiveSessionRetry(Retry getLiveSessionRetry) { + this.getLiveSessionRetry = getLiveSessionRetry; + } + + public Retry getListLiveConfigsRetry() { + return this.listLiveConfigsRetry; + } + + public void setListLiveConfigsRetry(Retry listLiveConfigsRetry) { + this.listLiveConfigsRetry = listLiveConfigsRetry; + } + + public Retry getGetLiveConfigRetry() { + return this.getLiveConfigRetry; + } + + public void setGetLiveConfigRetry(Retry getLiveConfigRetry) { + this.getLiveConfigRetry = getLiveConfigRetry; + } + + public Retry getListVodConfigsRetry() { + return this.listVodConfigsRetry; + } + + public void setListVodConfigsRetry(Retry listVodConfigsRetry) { + this.listVodConfigsRetry = listVodConfigsRetry; + } + + public Retry getGetVodConfigRetry() { + return this.getVodConfigRetry; + } + + public void setGetVodConfigRetry(Retry getVodConfigRetry) { + this.getVodConfigRetry = getVodConfigRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/v1/spring/package-info.java new file mode 100644 index 0000000000..0466ebe31d --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/java/com/google/cloud/video/stitcher/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 videostitcher. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.video.stitcher.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..100a091954 --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.video.stitcher.v1.video-stitcher-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud videostitcher/VideoStitcherService components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..d7e19cec96 --- /dev/null +++ b/spring-cloud-previews/google-cloud-video-stitcher-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.video.stitcher.v1.spring.VideoStitcherServiceSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringAutoConfiguration.java index 8f8eec8648..eebb306aeb 100644 --- a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public TranscoderServiceSettings transcoderServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(TranscoderServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringAutoConfiguration.java index 67bbda74b7..f77ae81870 100644 --- a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public VmMigrationSettings vmMigrationSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VmMigrationSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringAutoConfiguration.java index aac1ad89ec..7441ecdfcd 100644 --- a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public VpcAccessServiceSettings vpcAccessServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(VpcAccessServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringAutoConfiguration.java index 2876d706c3..1004a30d0b 100644 --- a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringAutoConfiguration.java @@ -135,6 +135,7 @@ public WebRiskServiceSettings webRiskServiceSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(WebRiskServiceSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringAutoConfiguration.java index b776d156dd..3811d95fd1 100644 --- a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringAutoConfiguration.java @@ -136,6 +136,7 @@ public WebSecurityScannerSettings webSecurityScannerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(WebSecurityScannerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringAutoConfiguration.java index cc4b5e9ee1..ba1248f91e 100644 --- a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringAutoConfiguration.java @@ -134,6 +134,7 @@ public ExecutionsSettings executionsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(ExecutionsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringAutoConfiguration.java index be2d944ca8..f4d0313124 100644 --- a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringAutoConfiguration.java @@ -132,6 +132,7 @@ public WorkflowsSettings workflowsSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(WorkflowsSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-cloud-workstations-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-workstations-spring-starter/pom.xml new file mode 100644 index 0000000000..3395f6b528 --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.google.cloud + spring-cloud-gcp-starters + 5.4.4-SNAPSHOT + ../../spring-cloud-gcp-starters/pom.xml + + google-cloud-workstations-spring-starter + ${project.parent.version}-preview + Spring Boot Starter - workstations + Spring Boot Starter with AutoConfiguration for workstations + + + + + com.google.cloud + google-cloud-workstations + + + + 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-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringAutoConfiguration.java new file mode 100644 index 0000000000..808b466181 --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringAutoConfiguration.java @@ -0,0 +1,430 @@ +/* + * 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.workstations.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.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 com.google.cloud.workstations.v1.WorkstationsClient; +import com.google.cloud.workstations.v1.WorkstationsSettings; +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 WorkstationsClient}. + * + *

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(WorkstationsClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.workstations.v1.workstations.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(WorkstationsSpringProperties.class) +public class WorkstationsSpringAutoConfiguration { + private final WorkstationsSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(WorkstationsSpringAutoConfiguration.class); + + protected WorkstationsSpringAutoConfiguration( + WorkstationsSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from Workstations-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 = "defaultWorkstationsTransportChannelProvider") + public TransportChannelProvider defaultWorkstationsTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return WorkstationsSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return WorkstationsSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a WorkstationsSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultWorkstationsTransportChannelProvider()). 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 WorkstationsSpringProperties. 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 WorkstationsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public WorkstationsSettings workstationsSettings( + @Qualifier("defaultWorkstationsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + WorkstationsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = WorkstationsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = WorkstationsSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(WorkstationsSettings.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 = + WorkstationsSettings.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 getWorkstationClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getWorkstationClusterSettings() + .setRetrySettings(getWorkstationClusterRetrySettings); + + RetrySettings listWorkstationClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationClustersSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listWorkstationClustersSettings() + .setRetrySettings(listWorkstationClustersRetrySettings); + + RetrySettings getWorkstationConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationConfigSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getWorkstationConfigSettings() + .setRetrySettings(getWorkstationConfigRetrySettings); + + RetrySettings listWorkstationConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationConfigsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listWorkstationConfigsSettings() + .setRetrySettings(listWorkstationConfigsRetrySettings); + + RetrySettings listUsableWorkstationConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableWorkstationConfigsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listUsableWorkstationConfigsSettings() + .setRetrySettings(listUsableWorkstationConfigsRetrySettings); + + RetrySettings getWorkstationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getWorkstationSettings().setRetrySettings(getWorkstationRetrySettings); + + RetrySettings listWorkstationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listWorkstationsSettings() + .setRetrySettings(listWorkstationsRetrySettings); + + RetrySettings listUsableWorkstationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableWorkstationsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listUsableWorkstationsSettings() + .setRetrySettings(listUsableWorkstationsRetrySettings); + + RetrySettings generateAccessTokenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .generateAccessTokenSettings() + .setRetrySettings(generateAccessTokenRetrySettings); + + 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 getWorkstationClusterRetry = clientProperties.getGetWorkstationClusterRetry(); + if (getWorkstationClusterRetry != null) { + RetrySettings getWorkstationClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationClusterSettings().getRetrySettings(), + getWorkstationClusterRetry); + clientSettingsBuilder + .getWorkstationClusterSettings() + .setRetrySettings(getWorkstationClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getWorkstationCluster from properties."); + } + } + Retry listWorkstationClustersRetry = clientProperties.getListWorkstationClustersRetry(); + if (listWorkstationClustersRetry != null) { + RetrySettings listWorkstationClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationClustersSettings().getRetrySettings(), + listWorkstationClustersRetry); + clientSettingsBuilder + .listWorkstationClustersSettings() + .setRetrySettings(listWorkstationClustersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listWorkstationClusters from properties."); + } + } + Retry getWorkstationConfigRetry = clientProperties.getGetWorkstationConfigRetry(); + if (getWorkstationConfigRetry != null) { + RetrySettings getWorkstationConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationConfigSettings().getRetrySettings(), + getWorkstationConfigRetry); + clientSettingsBuilder + .getWorkstationConfigSettings() + .setRetrySettings(getWorkstationConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getWorkstationConfig from properties."); + } + } + Retry listWorkstationConfigsRetry = clientProperties.getListWorkstationConfigsRetry(); + if (listWorkstationConfigsRetry != null) { + RetrySettings listWorkstationConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationConfigsSettings().getRetrySettings(), + listWorkstationConfigsRetry); + clientSettingsBuilder + .listWorkstationConfigsSettings() + .setRetrySettings(listWorkstationConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listWorkstationConfigs from properties."); + } + } + Retry listUsableWorkstationConfigsRetry = + clientProperties.getListUsableWorkstationConfigsRetry(); + if (listUsableWorkstationConfigsRetry != null) { + RetrySettings listUsableWorkstationConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableWorkstationConfigsSettings().getRetrySettings(), + listUsableWorkstationConfigsRetry); + clientSettingsBuilder + .listUsableWorkstationConfigsSettings() + .setRetrySettings(listUsableWorkstationConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listUsableWorkstationConfigs from properties."); + } + } + Retry getWorkstationRetry = clientProperties.getGetWorkstationRetry(); + if (getWorkstationRetry != null) { + RetrySettings getWorkstationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getWorkstationSettings().getRetrySettings(), + getWorkstationRetry); + clientSettingsBuilder.getWorkstationSettings().setRetrySettings(getWorkstationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getWorkstation from properties."); + } + } + Retry listWorkstationsRetry = clientProperties.getListWorkstationsRetry(); + if (listWorkstationsRetry != null) { + RetrySettings listWorkstationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listWorkstationsSettings().getRetrySettings(), + listWorkstationsRetry); + clientSettingsBuilder + .listWorkstationsSettings() + .setRetrySettings(listWorkstationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listWorkstations from properties."); + } + } + Retry listUsableWorkstationsRetry = clientProperties.getListUsableWorkstationsRetry(); + if (listUsableWorkstationsRetry != null) { + RetrySettings listUsableWorkstationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableWorkstationsSettings().getRetrySettings(), + listUsableWorkstationsRetry); + clientSettingsBuilder + .listUsableWorkstationsSettings() + .setRetrySettings(listUsableWorkstationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listUsableWorkstations from properties."); + } + } + Retry generateAccessTokenRetry = clientProperties.getGenerateAccessTokenRetry(); + if (generateAccessTokenRetry != null) { + RetrySettings generateAccessTokenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(), + generateAccessTokenRetry); + clientSettingsBuilder + .generateAccessTokenSettings() + .setRetrySettings(generateAccessTokenRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for generateAccessToken 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 WorkstationsClient bean configured with WorkstationsSettings. + * + * @param workstationsSettings settings to configure an instance of client bean. + * @return a {@link WorkstationsClient} bean configured with {@link WorkstationsSettings} + */ + @Bean + @ConditionalOnMissingBean + public WorkstationsClient workstationsClient(WorkstationsSettings workstationsSettings) + throws IOException { + return WorkstationsClient.create(workstationsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-workstations"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringProperties.java b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringProperties.java new file mode 100644 index 0000000000..49f5949e5a --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/WorkstationsSpringProperties.java @@ -0,0 +1,238 @@ +/* + * 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.workstations.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 Workstations client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.workstations.v1.workstations") +public class WorkstationsSpringProperties 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 default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** 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 getWorkstationCluster. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getWorkstationClusterRetry; + /** + * Allow override of retry settings at method-level for listWorkstationClusters. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listWorkstationClustersRetry; + /** + * Allow override of retry settings at method-level for getWorkstationConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getWorkstationConfigRetry; + /** + * Allow override of retry settings at method-level for listWorkstationConfigs. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listWorkstationConfigsRetry; + /** + * Allow override of retry settings at method-level for listUsableWorkstationConfigs. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listUsableWorkstationConfigsRetry; + /** + * Allow override of retry settings at method-level for getWorkstation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getWorkstationRetry; + /** + * Allow override of retry settings at method-level for listWorkstations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listWorkstationsRetry; + /** + * Allow override of retry settings at method-level for listUsableWorkstations. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listUsableWorkstationsRetry; + /** + * Allow override of retry settings at method-level for generateAccessToken. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry generateAccessTokenRetry; + /** + * 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 boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + 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 getGetWorkstationClusterRetry() { + return this.getWorkstationClusterRetry; + } + + public void setGetWorkstationClusterRetry(Retry getWorkstationClusterRetry) { + this.getWorkstationClusterRetry = getWorkstationClusterRetry; + } + + public Retry getListWorkstationClustersRetry() { + return this.listWorkstationClustersRetry; + } + + public void setListWorkstationClustersRetry(Retry listWorkstationClustersRetry) { + this.listWorkstationClustersRetry = listWorkstationClustersRetry; + } + + public Retry getGetWorkstationConfigRetry() { + return this.getWorkstationConfigRetry; + } + + public void setGetWorkstationConfigRetry(Retry getWorkstationConfigRetry) { + this.getWorkstationConfigRetry = getWorkstationConfigRetry; + } + + public Retry getListWorkstationConfigsRetry() { + return this.listWorkstationConfigsRetry; + } + + public void setListWorkstationConfigsRetry(Retry listWorkstationConfigsRetry) { + this.listWorkstationConfigsRetry = listWorkstationConfigsRetry; + } + + public Retry getListUsableWorkstationConfigsRetry() { + return this.listUsableWorkstationConfigsRetry; + } + + public void setListUsableWorkstationConfigsRetry(Retry listUsableWorkstationConfigsRetry) { + this.listUsableWorkstationConfigsRetry = listUsableWorkstationConfigsRetry; + } + + public Retry getGetWorkstationRetry() { + return this.getWorkstationRetry; + } + + public void setGetWorkstationRetry(Retry getWorkstationRetry) { + this.getWorkstationRetry = getWorkstationRetry; + } + + public Retry getListWorkstationsRetry() { + return this.listWorkstationsRetry; + } + + public void setListWorkstationsRetry(Retry listWorkstationsRetry) { + this.listWorkstationsRetry = listWorkstationsRetry; + } + + public Retry getListUsableWorkstationsRetry() { + return this.listUsableWorkstationsRetry; + } + + public void setListUsableWorkstationsRetry(Retry listUsableWorkstationsRetry) { + this.listUsableWorkstationsRetry = listUsableWorkstationsRetry; + } + + public Retry getGenerateAccessTokenRetry() { + return this.generateAccessTokenRetry; + } + + public void setGenerateAccessTokenRetry(Retry generateAccessTokenRetry) { + this.generateAccessTokenRetry = generateAccessTokenRetry; + } + + 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-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/v1/spring/package-info.java new file mode 100644 index 0000000000..e9f3ea41dd --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/java/com/google/cloud/workstations/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 workstations. */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +package com.google.cloud.workstations.v1.spring; + +import com.google.api.core.BetaApi; +import javax.annotation.Generated; diff --git a/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..086c1da91f --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "name": "com.google.cloud.workstations.v1.workstations.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud workstations/Workstations components.", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..6fca4ea225 --- /dev/null +++ b/spring-cloud-previews/google-cloud-workstations-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.google.cloud.workstations.v1.spring.WorkstationsSpringAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringAutoConfiguration.java b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringAutoConfiguration.java index 8b9996f019..7d04b25343 100644 --- a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringAutoConfiguration.java @@ -119,6 +119,7 @@ public IAMSettings iAMSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(IAMSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-iam-policy-spring-starter/src/main/java/com/google/iam/v2/spring/PoliciesSpringAutoConfiguration.java b/spring-cloud-previews/google-iam-policy-spring-starter/src/main/java/com/google/iam/v2/spring/PoliciesSpringAutoConfiguration.java index bc4e18953a..c14526bffd 100644 --- a/spring-cloud-previews/google-iam-policy-spring-starter/src/main/java/com/google/iam/v2/spring/PoliciesSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-iam-policy-spring-starter/src/main/java/com/google/iam/v2/spring/PoliciesSpringAutoConfiguration.java @@ -130,6 +130,7 @@ public PoliciesSettings policiesSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(PoliciesSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringAutoConfiguration.java index c001557a3a..74aa275c4a 100644 --- a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringAutoConfiguration.java @@ -137,6 +137,7 @@ public AccessContextManagerSettings accessContextManagerSettings( clientSettingsBuilder .setCredentialsProvider(this.credentialsProvider) .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(AccessContextManagerSettings.getDefaultEndpoint()) .setHeaderProvider(this.userAgentHeaderProvider()); if (this.clientProperties.getQuotaProjectId() != null) { clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); diff --git a/spring-cloud-previews/pom.xml b/spring-cloud-previews/pom.xml index 1d87a6242c..6e105d06cc 100644 --- a/spring-cloud-previews/pom.xml +++ b/spring-cloud-previews/pom.xml @@ -13,6 +13,7 @@ pom + google-cloud-workstations-spring-starter google-cloud-workflows-spring-starter google-cloud-workflow-executions-spring-starter google-cloud-websecurityscanner-spring-starter @@ -20,11 +21,13 @@ google-cloud-vpcaccess-spring-starter google-cloud-vmmigration-spring-starter google-cloud-video-transcoder-spring-starter + google-cloud-video-stitcher-spring-starter google-cloud-video-intelligence-spring-starter google-cloud-translate-spring-starter google-cloud-trace-spring-starter google-cloud-tpu-spring-starter google-cloud-texttospeech-spring-starter + google-cloud-telcoautomation-spring-starter google-cloud-tasks-spring-starter google-cloud-talent-spring-starter google-cloud-storage-transfer-spring-starter @@ -34,14 +37,18 @@ google-cloud-service-usage-spring-starter google-cloud-service-management-spring-starter google-cloud-service-control-spring-starter + google-cloud-securityposture-spring-starter + google-cloud-securitycentermanagement-spring-starter google-cloud-securitycenter-spring-starter google-cloud-security-private-ca-spring-starter + google-cloud-securesourcemanager-spring-starter google-cloud-scheduler-spring-starter google-cloud-retail-spring-starter google-cloud-resource-settings-spring-starter google-cloud-redis-spring-starter google-cloud-recommender-spring-starter google-cloud-recaptchaenterprise-spring-starter + google-cloud-publicca-spring-starter google-cloud-profiler-spring-starter google-cloud-policy-troubleshooter-spring-starter google-cloud-os-login-spring-starter @@ -51,13 +58,16 @@ google-cloud-optimization-spring-starter google-cloud-notebooks-spring-starter google-cloud-networkconnectivity-spring-starter + google-cloud-network-security-spring-starter google-cloud-network-management-spring-starter google-cloud-monitoring-dashboard-spring-starter google-cloud-memcache-spring-starter google-cloud-managed-identities-spring-starter google-cloud-language-spring-starter google-cloud-iot-spring-starter + google-cloud-infra-manager-spring-starter google-cloud-ids-spring-starter + google-cloud-iap-spring-starter google-cloud-iamcredentials-spring-starter google-iam-admin-spring-starter google-iam-policy-spring-starter @@ -67,10 +77,13 @@ google-cloud-filestore-spring-starter google-cloud-eventarc-spring-starter google-cloud-essential-contacts-spring-starter + google-cloud-edgenetwork-spring-starter google-cloud-domains-spring-starter google-cloud-document-ai-spring-starter google-cloud-dms-spring-starter google-cloud-dlp-spring-starter + google-cloud-distributedcloudedge-spring-starter + google-cloud-discoveryengine-spring-starter google-cloud-dialogflow-spring-starter google-cloud-deploy-spring-starter google-cloud-debugger-client-spring-starter @@ -78,12 +91,15 @@ google-cloud-dataproc-metastore-spring-starter google-cloud-dataproc-spring-starter google-cloud-dataplex-spring-starter + google-cloud-datalineage-spring-starter google-cloud-datacatalog-spring-starter google-cloud-data-fusion-spring-starter google-cloud-containeranalysis-spring-starter google-cloud-container-spring-starter google-cloud-contact-center-insights-spring-starter google-cloud-compute-spring-starter + google-cloud-cloudquotas-spring-starter + google-cloud-cloudcontrolspartner-spring-starter google-cloud-build-spring-starter google-cloud-channel-spring-starter google-cloud-binary-authorization-spring-starter @@ -92,14 +108,18 @@ google-cloud-bigqueryreservation-spring-starter google-cloud-bigquerydatatransfer-spring-starter google-cloud-bigqueryconnection-spring-starter + google-cloud-backupdr-spring-starter google-cloud-automl-spring-starter google-cloud-assured-workloads-spring-starter google-cloud-asset-spring-starter google-cloud-artifact-registry-spring-starter google-cloud-appengine-admin-spring-starter + google-cloud-apikeys-spring-starter google-cloud-apigee-connect-spring-starter google-cloud-api-gateway-spring-starter + google-cloud-analyticshub-spring-starter google-cloud-aiplatform-spring-starter + google-cloud-advisorynotifications-spring-starter google-identity-accesscontextmanager-spring-starter google-cloud-accessapproval-spring-starter