From e9378a9a4282f4ea37196d3087f85f719fc09b92 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 5 Feb 2024 21:07:50 +0000 Subject: [PATCH] chore: update starter modules in spring-cloud-previews (#2580) * chore: update starter modules in spring-cloud-previews * chore: Add endpointcontext mock * chore: Add endpointcontext mock to test template --------- Co-authored-by: Cloud Java Bot --- .../LanguageAutoConfigurationTests.java | 1 + spring-cloud-previews/README.md | 174 +++++----- ...rcePoolServiceSpringAutoConfiguration.java | 328 ++++++++++++++++++ ...ntResourcePoolServiceSpringProperties.java | 176 ++++++++++ ...itional-spring-configuration-metadata.json | 6 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../CloudBillingSpringAutoConfiguration.java | 21 ++ .../spring/CloudBillingSpringProperties.java | 13 + ...BackendBucketsSpringAutoConfiguration.java | 51 +++ .../BackendBucketsSpringProperties.java | 39 +++ ...ackendServicesSpringAutoConfiguration.java | 36 ++ .../BackendServicesSpringProperties.java | 26 ++ .../InterconnectsSpringAutoConfiguration.java | 20 ++ .../spring/InterconnectsSpringProperties.java | 13 + ...ackendServicesSpringAutoConfiguration.java | 36 ++ ...RegionBackendServicesSpringProperties.java | 26 ++ ...EndpointGroupsSpringAutoConfiguration.java | 22 ++ ...NetworkEndpointGroupsSpringProperties.java | 13 + ...curityPoliciesSpringAutoConfiguration.java | 15 + ...egionSecurityPoliciesSpringProperties.java | 13 + .../RoutersSpringAutoConfiguration.java | 15 + .../v1/spring/RoutersSpringProperties.java | 13 + ...ettingsServiceSpringAutoConfiguration.java | 195 +++++++++++ ...apshotSettingsServiceSpringProperties.java | 87 +++++ ...itional-spring-configuration-metadata.json | 6 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../CloudDeploySpringAutoConfiguration.java | 43 +++ .../spring/CloudDeploySpringProperties.java | 26 ++ .../OrgPolicySpringAutoConfiguration.java | 109 ++++++ .../v2/spring/OrgPolicySpringProperties.java | 65 ++++ .../ExportServiceSpringAutoConfiguration.java | 202 +++++++++++ .../spring/ExportServiceSpringProperties.java | 98 ++++++ ...itional-spring-configuration-metadata.json | 6 + ...ot.autoconfigure.AutoConfiguration.imports | 3 +- 34 files changed, 1811 insertions(+), 88 deletions(-) create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringProperties.java create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringProperties.java diff --git a/spring-cloud-generator/spring-cloud-previews-template/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java b/spring-cloud-generator/spring-cloud-previews-template/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java index 571ce862ec..2038fb7438 100644 --- a/spring-cloud-generator/spring-cloud-previews-template/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java +++ b/spring-cloud-generator/spring-cloud-previews-template/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java @@ -195,6 +195,7 @@ void testCustomTransportChannelProviderUsedWhenProvided() throws IOException { when(mockTransportChannel.getEmptyCallContext()).thenReturn(mockApiCallContext); when(mockApiCallContext.withCredentials(any())).thenReturn(mockApiCallContext); when(mockApiCallContext.withTransportChannel(any())).thenReturn(mockApiCallContext); + when(mockApiCallContext.withEndpointContext(any())).thenReturn(mockApiCallContext); contextRunner .withBean( diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md index 6f255df5ad..ca3b5401f9 100644 --- a/spring-cloud-previews/README.md +++ b/spring-cloud-previews/README.md @@ -16,90 +16,90 @@ add the following dependency to your `pom.xml`: | Client Library | Starter Maven Artifact | |----------------| -----------------------| -|[java-accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| -|[java-accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| -|[java-aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.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.25.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.25.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.25.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.25.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.25.0/java-automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| -|[java-bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| -|[java-bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| -|[java-bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| -|[java-billing](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| -|[java-billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| -|[java-cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| -|[java-compute](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-container/README.md)|com.google.cloud:google-cloud-container-spring-starter| -|[java-containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| -|[java-dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| -|[java-datastream](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| -|[java-dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| -|[java-dlp](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| -|[java-dms](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.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.25.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.25.0/java-eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| -|[java-filestore](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| -|[java-functions](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| -|[java-gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| -|[java-iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| -|[java-ids](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| -|[java-iot](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| -|[java-language](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.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.25.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.25.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.25.0/java-networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| -|[java-notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| -|[java-optimization](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.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.25.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.25.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.25.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.25.0/java-profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| -|[java-recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| -|[java-recommender](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| -|[java-redis](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| -|[java-scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.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.25.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.25.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.25.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.25.0/java-servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| -|[java-shell](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| -|[java-speech](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| -|[java-tasks](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| -|[java-texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| -|[java-tpu](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| -|[java-trace](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| -|[java-video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| -|[java-vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| -|[java-webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.25.0/java-webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| -|[java-websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.25.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.25.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.25.0/java-workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java-accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| +|[java-accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| +|[java-aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.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.28.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.28.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.28.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.28.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.28.0/java-automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| +|[java-bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| +|[java-bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| +|[java-bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| +|[java-billing](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| +|[java-billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| +|[java-cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| +|[java-compute](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-container/README.md)|com.google.cloud:google-cloud-container-spring-starter| +|[java-containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| +|[java-dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| +|[java-datastream](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| +|[java-dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| +|[java-dlp](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| +|[java-dms](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.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.28.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.28.0/java-eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| +|[java-filestore](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| +|[java-functions](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| +|[java-gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| +|[java-iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| +|[java-ids](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| +|[java-iot](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| +|[java-language](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.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.28.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.28.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.28.0/java-networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| +|[java-notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| +|[java-optimization](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.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.28.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.28.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.28.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.28.0/java-profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| +|[java-recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| +|[java-recommender](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| +|[java-redis](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| +|[java-scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.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.28.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.28.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.28.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.28.0/java-servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| +|[java-shell](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| +|[java-speech](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| +|[java-tasks](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| +|[java-texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| +|[java-tpu](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| +|[java-trace](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| +|[java-video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| +|[java-vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| +|[java-webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.28.0/java-webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| +|[java-websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.28.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.28.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.28.0/java-workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..030d399a9e --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringAutoConfiguration.java @@ -0,0 +1,328 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.aiplatform.v1.DeploymentResourcePoolServiceClient; +import com.google.cloud.aiplatform.v1.DeploymentResourcePoolServiceSettings; +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 DeploymentResourcePoolServiceClient}. + * + *

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(DeploymentResourcePoolServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.aiplatform.v1.deployment-resource-pool-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(DeploymentResourcePoolServiceSpringProperties.class) +public class DeploymentResourcePoolServiceSpringAutoConfiguration { + private final DeploymentResourcePoolServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(DeploymentResourcePoolServiceSpringAutoConfiguration.class); + + protected DeploymentResourcePoolServiceSpringAutoConfiguration( + DeploymentResourcePoolServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from DeploymentResourcePoolService-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 = "defaultDeploymentResourcePoolServiceTransportChannelProvider") + public TransportChannelProvider defaultDeploymentResourcePoolServiceTransportChannelProvider() { + return DeploymentResourcePoolServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a DeploymentResourcePoolServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultDeploymentResourcePoolServiceTransportChannelProvider()). 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 DeploymentResourcePoolServiceSpringProperties. 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 DeploymentResourcePoolServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettings( + @Qualifier("defaultDeploymentResourcePoolServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DeploymentResourcePoolServiceSettings.Builder clientSettingsBuilder = + DeploymentResourcePoolServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + DeploymentResourcePoolServiceSettings.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 getDeploymentResourcePoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentResourcePoolSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getDeploymentResourcePoolSettings() + .setRetrySettings(getDeploymentResourcePoolRetrySettings); + + RetrySettings listDeploymentResourcePoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentResourcePoolsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listDeploymentResourcePoolsSettings() + .setRetrySettings(listDeploymentResourcePoolsRetrySettings); + + RetrySettings queryDeployedModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryDeployedModelsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .queryDeployedModelsSettings() + .setRetrySettings(queryDeployedModelsRetrySettings); + + 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 getDeploymentResourcePoolRetry = clientProperties.getGetDeploymentResourcePoolRetry(); + if (getDeploymentResourcePoolRetry != null) { + RetrySettings getDeploymentResourcePoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeploymentResourcePoolSettings().getRetrySettings(), + getDeploymentResourcePoolRetry); + clientSettingsBuilder + .getDeploymentResourcePoolSettings() + .setRetrySettings(getDeploymentResourcePoolRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getDeploymentResourcePool from properties."); + } + } + Retry listDeploymentResourcePoolsRetry = clientProperties.getListDeploymentResourcePoolsRetry(); + if (listDeploymentResourcePoolsRetry != null) { + RetrySettings listDeploymentResourcePoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeploymentResourcePoolsSettings().getRetrySettings(), + listDeploymentResourcePoolsRetry); + clientSettingsBuilder + .listDeploymentResourcePoolsSettings() + .setRetrySettings(listDeploymentResourcePoolsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDeploymentResourcePools from properties."); + } + } + Retry queryDeployedModelsRetry = clientProperties.getQueryDeployedModelsRetry(); + if (queryDeployedModelsRetry != null) { + RetrySettings queryDeployedModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryDeployedModelsSettings().getRetrySettings(), + queryDeployedModelsRetry); + clientSettingsBuilder + .queryDeployedModelsSettings() + .setRetrySettings(queryDeployedModelsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for queryDeployedModels 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 DeploymentResourcePoolServiceClient bean configured with + * DeploymentResourcePoolServiceSettings. + * + * @param deploymentResourcePoolServiceSettings settings to configure an instance of client bean. + * @return a {@link DeploymentResourcePoolServiceClient} bean configured with {@link + * DeploymentResourcePoolServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient( + DeploymentResourcePoolServiceSettings deploymentResourcePoolServiceSettings) + throws IOException { + return DeploymentResourcePoolServiceClient.create(deploymentResourcePoolServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-deployment-resource-pool-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringProperties.java new file mode 100644 index 0000000000..f8c72e2287 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DeploymentResourcePoolServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.aiplatform.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for DeploymentResourcePoolService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.deployment-resource-pool-service") +public class DeploymentResourcePoolServiceSpringProperties 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 getDeploymentResourcePool. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDeploymentResourcePoolRetry; + /** + * Allow override of retry settings at method-level for listDeploymentResourcePools. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDeploymentResourcePoolsRetry; + /** + * Allow override of retry settings at method-level for queryDeployedModels. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry queryDeployedModelsRetry; + /** + * 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 getGetDeploymentResourcePoolRetry() { + return this.getDeploymentResourcePoolRetry; + } + + public void setGetDeploymentResourcePoolRetry(Retry getDeploymentResourcePoolRetry) { + this.getDeploymentResourcePoolRetry = getDeploymentResourcePoolRetry; + } + + public Retry getListDeploymentResourcePoolsRetry() { + return this.listDeploymentResourcePoolsRetry; + } + + public void setListDeploymentResourcePoolsRetry(Retry listDeploymentResourcePoolsRetry) { + this.listDeploymentResourcePoolsRetry = listDeploymentResourcePoolsRetry; + } + + public Retry getQueryDeployedModelsRetry() { + return this.queryDeployedModelsRetry; + } + + public void setQueryDeployedModelsRetry(Retry queryDeployedModelsRetry) { + this.queryDeployedModelsRetry = queryDeployedModelsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index b28bc2b2dd..e74d2d4e88 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -6,6 +6,12 @@ "description": "Auto-configure Google Cloud aiplatform/DatasetService components.", "defaultValue": true }, + { + "name": "com.google.cloud.aiplatform.v1.deployment-resource-pool-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud aiplatform/DeploymentResourcePoolService components.", + "defaultValue": true + }, { "name": "com.google.cloud.aiplatform.v1.endpoint-service.enabled", "type": "java.lang.Boolean", diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index ccc82336ac..461de70264 100644 --- a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,5 @@ com.google.cloud.aiplatform.v1.spring.DatasetServiceSpringAutoConfiguration +com.google.cloud.aiplatform.v1.spring.DeploymentResourcePoolServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.EndpointServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.FeatureOnlineStoreAdminServiceSpringAutoConfiguration com.google.cloud.aiplatform.v1.spring.FeatureOnlineStoreServiceSpringAutoConfiguration 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 94296c0cea..26a19a856f 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 @@ -230,6 +230,13 @@ public CloudBillingSettings cloudBillingSettings( .testIamPermissionsSettings() .setRetrySettings(testIamPermissionsRetrySettings); + RetrySettings moveBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.moveBillingAccountSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .moveBillingAccountSettings() + .setRetrySettings(moveBillingAccountRetrySettings); + if (LOGGER.isTraceEnabled()) { LOGGER.trace("Configured service-level retry settings from properties."); } @@ -366,6 +373,20 @@ public CloudBillingSettings cloudBillingSettings( "Configured method-level retry settings for testIamPermissions from properties."); } } + Retry moveBillingAccountRetry = clientProperties.getMoveBillingAccountRetry(); + if (moveBillingAccountRetry != null) { + RetrySettings moveBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.moveBillingAccountSettings().getRetrySettings(), + moveBillingAccountRetry); + clientSettingsBuilder + .moveBillingAccountSettings() + .setRetrySettings(moveBillingAccountRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for moveBillingAccount from properties."); + } + } return clientSettingsBuilder.build(); } diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java index 8c53015c05..01f8092658 100644 --- a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java +++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java @@ -95,6 +95,11 @@ public class CloudBillingSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry testIamPermissionsRetry; + /** + * Allow override of retry settings at method-level for moveBillingAccount. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry moveBillingAccountRetry; @Override public Credentials getCredentials() { @@ -212,4 +217,12 @@ public Retry getTestIamPermissionsRetry() { public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { this.testIamPermissionsRetry = testIamPermissionsRetry; } + + public Retry getMoveBillingAccountRetry() { + return this.moveBillingAccountRetry; + } + + public void setMoveBillingAccountRetry(Retry moveBillingAccountRetry) { + this.moveBillingAccountRetry = moveBillingAccountRetry; + } } 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 38c919ad58..1b20bbfe9f 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 @@ -153,11 +153,28 @@ public BackendBucketsSettings backendBucketsSettings( clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + RetrySettings listRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + 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."); } @@ -172,6 +189,16 @@ public BackendBucketsSettings backendBucketsSettings( LOGGER.trace("Configured method-level retry settings for get 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 listRetry = clientProperties.getListRetry(); if (listRetry != null) { RetrySettings listRetrySettings = @@ -182,6 +209,30 @@ public BackendBucketsSettings backendBucketsSettings( LOGGER.trace("Configured method-level retry settings for list 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(); } diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringProperties.java index ed534ddb37..d36225568d 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendBucketsSpringProperties.java @@ -47,11 +47,26 @@ public class BackendBucketsSpringProperties implements CredentialsSupplier { * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getRetry; + /** + * 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 list. If defined, this takes precedence * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listRetry; + /** + * 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() { @@ -90,6 +105,14 @@ public void setGetRetry(Retry getRetry) { this.getRetry = getRetry; } + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + public Retry getListRetry() { return this.listRetry; } @@ -97,4 +120,20 @@ public Retry getListRetry() { public void setListRetry(Retry listRetry) { this.listRetry = listRetry; } + + 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-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 fdc015c2bd..764e1e0afc 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 @@ -173,11 +173,23 @@ public BackendServicesSettings backendServicesSettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + RetrySettings listUsableRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listUsableSettings().setRetrySettings(listUsableRetrySettings); + 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."); } @@ -233,6 +245,16 @@ public BackendServicesSettings backendServicesSettings( LOGGER.trace("Configured method-level retry settings for list from properties."); } } + Retry listUsableRetry = clientProperties.getListUsableRetry(); + if (listUsableRetry != null) { + RetrySettings listUsableRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableSettings().getRetrySettings(), listUsableRetry); + clientSettingsBuilder.listUsableSettings().setRetrySettings(listUsableRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listUsable from properties."); + } + } Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); if (setIamPolicyRetry != null) { RetrySettings setIamPolicyRetrySettings = @@ -243,6 +265,20 @@ public BackendServicesSettings backendServicesSettings( 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(); } diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringProperties.java index f75b47ae4e..8e8cf7dbc8 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/BackendServicesSpringProperties.java @@ -67,11 +67,21 @@ public class BackendServicesSpringProperties implements CredentialsSupplier { * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listRetry; + /** + * Allow override of retry settings at method-level for listUsable. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listUsableRetry; /** * 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() { @@ -142,6 +152,14 @@ public void setListRetry(Retry listRetry) { this.listRetry = listRetry; } + public Retry getListUsableRetry() { + return this.listUsableRetry; + } + + public void setListUsableRetry(Retry listUsableRetry) { + this.listUsableRetry = listUsableRetry; + } + public Retry getSetIamPolicyRetry() { return this.setIamPolicyRetry; } @@ -149,4 +167,12 @@ public Retry getSetIamPolicyRetry() { 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-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 d5c5fb6f8d..c60809165f 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 @@ -158,6 +158,13 @@ public InterconnectsSettings interconnectsSettings( clientSettingsBuilder.getDiagnosticsSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getDiagnosticsSettings().setRetrySettings(getDiagnosticsRetrySettings); + RetrySettings getMacsecConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMacsecConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getMacsecConfigSettings() + .setRetrySettings(getMacsecConfigRetrySettings); + RetrySettings listRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); @@ -188,6 +195,19 @@ public InterconnectsSettings interconnectsSettings( LOGGER.trace("Configured method-level retry settings for getDiagnostics from properties."); } } + Retry getMacsecConfigRetry = clientProperties.getGetMacsecConfigRetry(); + if (getMacsecConfigRetry != null) { + RetrySettings getMacsecConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMacsecConfigSettings().getRetrySettings(), + getMacsecConfigRetry); + clientSettingsBuilder + .getMacsecConfigSettings() + .setRetrySettings(getMacsecConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getMacsecConfig from properties."); + } + } Retry listRetry = clientProperties.getListRetry(); if (listRetry != null) { RetrySettings listRetrySettings = diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringProperties.java index 0afefb3d58..00656b2eea 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/InterconnectsSpringProperties.java @@ -52,6 +52,11 @@ public class InterconnectsSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getDiagnosticsRetry; + /** + * Allow override of retry settings at method-level for getMacsecConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getMacsecConfigRetry; /** * Allow override of retry settings at method-level for list. If defined, this takes precedence * over service-level retry configurations for that RPC method. @@ -103,6 +108,14 @@ public void setGetDiagnosticsRetry(Retry getDiagnosticsRetry) { this.getDiagnosticsRetry = getDiagnosticsRetry; } + public Retry getGetMacsecConfigRetry() { + return this.getMacsecConfigRetry; + } + + public void setGetMacsecConfigRetry(Retry getMacsecConfigRetry) { + this.getMacsecConfigRetry = getMacsecConfigRetry; + } + public Retry getListRetry() { return this.listRetry; } 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 2629a9e472..9138bf4763 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 @@ -171,11 +171,23 @@ public RegionBackendServicesSettings regionBackendServicesSettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + RetrySettings listUsableRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listUsableSettings().setRetrySettings(listUsableRetrySettings); + 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."); } @@ -220,6 +232,16 @@ public RegionBackendServicesSettings regionBackendServicesSettings( LOGGER.trace("Configured method-level retry settings for list from properties."); } } + Retry listUsableRetry = clientProperties.getListUsableRetry(); + if (listUsableRetry != null) { + RetrySettings listUsableRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listUsableSettings().getRetrySettings(), listUsableRetry); + clientSettingsBuilder.listUsableSettings().setRetrySettings(listUsableRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listUsable from properties."); + } + } Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); if (setIamPolicyRetry != null) { RetrySettings setIamPolicyRetrySettings = @@ -230,6 +252,20 @@ public RegionBackendServicesSettings regionBackendServicesSettings( 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(); } diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringProperties.java index 1f5e9ef0d5..1a19725a10 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionBackendServicesSpringProperties.java @@ -62,11 +62,21 @@ public class RegionBackendServicesSpringProperties implements CredentialsSupplie * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listRetry; + /** + * Allow override of retry settings at method-level for listUsable. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listUsableRetry; /** * 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() { @@ -129,6 +139,14 @@ public void setListRetry(Retry listRetry) { this.listRetry = listRetry; } + public Retry getListUsableRetry() { + return this.listUsableRetry; + } + + public void setListUsableRetry(Retry listUsableRetry) { + this.listUsableRetry = listUsableRetry; + } + public Retry getSetIamPolicyRetry() { return this.setIamPolicyRetry; } @@ -136,4 +154,12 @@ public Retry getSetIamPolicyRetry() { 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-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 548296a79e..481c5d2fd3 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 @@ -161,6 +161,14 @@ public RegionNetworkEndpointGroupsSettings regionNetworkEndpointGroupsSettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings); + RetrySettings listNetworkEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNetworkEndpointsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listNetworkEndpointsSettings() + .setRetrySettings(listNetworkEndpointsRetrySettings); + if (LOGGER.isTraceEnabled()) { LOGGER.trace("Configured service-level retry settings from properties."); } @@ -185,6 +193,20 @@ public RegionNetworkEndpointGroupsSettings regionNetworkEndpointGroupsSettings( LOGGER.trace("Configured method-level retry settings for list from properties."); } } + Retry listNetworkEndpointsRetry = clientProperties.getListNetworkEndpointsRetry(); + if (listNetworkEndpointsRetry != null) { + RetrySettings listNetworkEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listNetworkEndpointsSettings().getRetrySettings(), + listNetworkEndpointsRetry); + clientSettingsBuilder + .listNetworkEndpointsSettings() + .setRetrySettings(listNetworkEndpointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listNetworkEndpoints from properties."); + } + } return clientSettingsBuilder.build(); } diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringProperties.java index b86fcfed53..a861ff9345 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionNetworkEndpointGroupsSpringProperties.java @@ -52,6 +52,11 @@ public class RegionNetworkEndpointGroupsSpringProperties implements CredentialsS * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry listRetry; + /** + * Allow override of retry settings at method-level for listNetworkEndpoints. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listNetworkEndpointsRetry; @Override public Credentials getCredentials() { @@ -97,4 +102,12 @@ public Retry getListRetry() { public void setListRetry(Retry listRetry) { this.listRetry = listRetry; } + + public Retry getListNetworkEndpointsRetry() { + return this.listNetworkEndpointsRetry; + } + + public void setListNetworkEndpointsRetry(Retry listNetworkEndpointsRetry) { + this.listNetworkEndpointsRetry = listNetworkEndpointsRetry; + } } 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 639007eee2..14274eeec3 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 @@ -156,6 +156,11 @@ public RegionSecurityPoliciesSettings regionSecurityPoliciesSettings( clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + RetrySettings getRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRuleSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRuleSettings().setRetrySettings(getRuleRetrySettings); + RetrySettings listRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry); @@ -175,6 +180,16 @@ public RegionSecurityPoliciesSettings regionSecurityPoliciesSettings( LOGGER.trace("Configured method-level retry settings for get from properties."); } } + Retry getRuleRetry = clientProperties.getGetRuleRetry(); + if (getRuleRetry != null) { + RetrySettings getRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRuleSettings().getRetrySettings(), getRuleRetry); + clientSettingsBuilder.getRuleSettings().setRetrySettings(getRuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRule from properties."); + } + } Retry listRetry = clientProperties.getListRetry(); if (listRetry != null) { RetrySettings listRetrySettings = diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringProperties.java index cb82aba775..f9ec06ce23 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RegionSecurityPoliciesSpringProperties.java @@ -47,6 +47,11 @@ public class RegionSecurityPoliciesSpringProperties implements CredentialsSuppli * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getRetry; + /** + * Allow override of retry settings at method-level for getRule. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRuleRetry; /** * Allow override of retry settings at method-level for list. If defined, this takes precedence * over service-level retry configurations for that RPC method. @@ -90,6 +95,14 @@ public void setGetRetry(Retry getRetry) { this.getRetry = getRetry; } + public Retry getGetRuleRetry() { + return this.getRuleRetry; + } + + public void setGetRuleRetry(Retry getRuleRetry) { + this.getRuleRetry = getRuleRetry; + } + public Retry getListRetry() { return this.listRetry; } 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 15bf405cfd..ec7639f308 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 @@ -153,6 +153,11 @@ public RoutersSettings routersSettings( clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + RetrySettings getNatIpInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNatIpInfoSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getNatIpInfoSettings().setRetrySettings(getNatIpInfoRetrySettings); + RetrySettings getNatMappingInfoRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.getNatMappingInfoSettings().getRetrySettings(), serviceRetry); @@ -202,6 +207,16 @@ public RoutersSettings routersSettings( LOGGER.trace("Configured method-level retry settings for get from properties."); } } + Retry getNatIpInfoRetry = clientProperties.getGetNatIpInfoRetry(); + if (getNatIpInfoRetry != null) { + RetrySettings getNatIpInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNatIpInfoSettings().getRetrySettings(), getNatIpInfoRetry); + clientSettingsBuilder.getNatIpInfoSettings().setRetrySettings(getNatIpInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getNatIpInfo from properties."); + } + } Retry getNatMappingInfoRetry = clientProperties.getGetNatMappingInfoRetry(); if (getNatMappingInfoRetry != null) { RetrySettings getNatMappingInfoRetrySettings = diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringProperties.java index 1e95d10708..6debd6bad3 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringProperties.java +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/RoutersSpringProperties.java @@ -52,6 +52,11 @@ public class RoutersSpringProperties implements CredentialsSupplier { * over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getRetry; + /** + * Allow override of retry settings at method-level for getNatIpInfo. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNatIpInfoRetry; /** * Allow override of retry settings at method-level for getNatMappingInfo. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -118,6 +123,14 @@ public void setGetRetry(Retry getRetry) { this.getRetry = getRetry; } + public Retry getGetNatIpInfoRetry() { + return this.getNatIpInfoRetry; + } + + public void setGetNatIpInfoRetry(Retry getNatIpInfoRetry) { + this.getNatIpInfoRetry = getNatIpInfoRetry; + } + public Retry getGetNatMappingInfoRetry() { return this.getNatMappingInfoRetry; } 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 new file mode 100644 index 0000000000..4a08992ebb --- /dev/null +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringAutoConfiguration.java @@ -0,0 +1,195 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.compute.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.compute.v1.SnapshotSettingsServiceClient; +import com.google.cloud.compute.v1.SnapshotSettingsServiceSettings; +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 SnapshotSettingsServiceClient}. + * + *

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(SnapshotSettingsServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.compute.v1.snapshot-settings-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(SnapshotSettingsServiceSpringProperties.class) +public class SnapshotSettingsServiceSpringAutoConfiguration { + private final SnapshotSettingsServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(SnapshotSettingsServiceSpringAutoConfiguration.class); + + protected SnapshotSettingsServiceSpringAutoConfiguration( + SnapshotSettingsServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from SnapshotSettingsService-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 = "defaultSnapshotSettingsServiceTransportChannelProvider") + public TransportChannelProvider defaultSnapshotSettingsServiceTransportChannelProvider() { + return SnapshotSettingsServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a SnapshotSettingsServiceSettings bean configured to use a DefaultCredentialsProvider + * and the client library's default transport channel provider + * (defaultSnapshotSettingsServiceTransportChannelProvider()). 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 SnapshotSettingsServiceSpringProperties. 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 SnapshotSettingsServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SnapshotSettingsServiceSettings snapshotSettingsServiceSettings( + @Qualifier("defaultSnapshotSettingsServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SnapshotSettingsServiceSettings.Builder clientSettingsBuilder = + SnapshotSettingsServiceSettings.newBuilder(); + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + SnapshotSettingsServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings getRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getRetry = clientProperties.getGetRetry(); + if (getRetry != null) { + RetrySettings getRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSettings().getRetrySettings(), getRetry); + clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for get from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SnapshotSettingsServiceClient bean configured with SnapshotSettingsServiceSettings. + * + * @param snapshotSettingsServiceSettings settings to configure an instance of client bean. + * @return a {@link SnapshotSettingsServiceClient} bean configured with {@link + * SnapshotSettingsServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SnapshotSettingsServiceClient snapshotSettingsServiceClient( + SnapshotSettingsServiceSettings snapshotSettingsServiceSettings) throws IOException { + return SnapshotSettingsServiceClient.create(snapshotSettingsServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-snapshot-settings-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringProperties.java new file mode 100644 index 0000000000..a8516e45b5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/java/com/google/cloud/compute/v1/spring/SnapshotSettingsServiceSpringProperties.java @@ -0,0 +1,87 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.compute.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for SnapshotSettingsService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.compute.v1.snapshot-settings-service") +public class SnapshotSettingsServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for get. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetRetry() { + return this.getRetry; + } + + public void setGetRetry(Retry getRetry) { + this.getRetry = getRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 22e9793742..ca7c826605 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -438,6 +438,12 @@ "description": "Auto-configure Google Cloud compute/ServiceAttachments components.", "defaultValue": true }, + { + "name": "com.google.cloud.compute.v1.snapshot-settings-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud compute/SnapshotSettingsService components.", + "defaultValue": true + }, { "name": "com.google.cloud.compute.v1.snapshots.enabled", "type": "java.lang.Boolean", diff --git a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 121b563619..7e66a3e2c0 100644 --- a/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-compute-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -71,6 +71,7 @@ com.google.cloud.compute.v1.spring.RoutersSpringAutoConfiguration com.google.cloud.compute.v1.spring.RoutesSpringAutoConfiguration com.google.cloud.compute.v1.spring.SecurityPoliciesSpringAutoConfiguration com.google.cloud.compute.v1.spring.ServiceAttachmentsSpringAutoConfiguration +com.google.cloud.compute.v1.spring.SnapshotSettingsServiceSpringAutoConfiguration com.google.cloud.compute.v1.spring.SnapshotsSpringAutoConfiguration com.google.cloud.compute.v1.spring.SslCertificatesSpringAutoConfiguration com.google.cloud.compute.v1.spring.SslPoliciesSpringAutoConfiguration 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 f63546b710..c62baab893 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 @@ -188,6 +188,21 @@ public CloudDeploySettings cloudDeploySettings( clientSettingsBuilder.getTargetSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getTargetSettings().setRetrySettings(getTargetRetrySettings); + RetrySettings listCustomTargetTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomTargetTypesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listCustomTargetTypesSettings() + .setRetrySettings(listCustomTargetTypesRetrySettings); + + RetrySettings getCustomTargetTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomTargetTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getCustomTargetTypeSettings() + .setRetrySettings(getCustomTargetTypeRetrySettings); + RetrySettings listReleasesRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listReleasesSettings().getRetrySettings(), serviceRetry); @@ -383,6 +398,34 @@ public CloudDeploySettings cloudDeploySettings( LOGGER.trace("Configured method-level retry settings for getTarget from properties."); } } + Retry listCustomTargetTypesRetry = clientProperties.getListCustomTargetTypesRetry(); + if (listCustomTargetTypesRetry != null) { + RetrySettings listCustomTargetTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomTargetTypesSettings().getRetrySettings(), + listCustomTargetTypesRetry); + clientSettingsBuilder + .listCustomTargetTypesSettings() + .setRetrySettings(listCustomTargetTypesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listCustomTargetTypes from properties."); + } + } + Retry getCustomTargetTypeRetry = clientProperties.getGetCustomTargetTypeRetry(); + if (getCustomTargetTypeRetry != null) { + RetrySettings getCustomTargetTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomTargetTypeSettings().getRetrySettings(), + getCustomTargetTypeRetry); + clientSettingsBuilder + .getCustomTargetTypeSettings() + .setRetrySettings(getCustomTargetTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getCustomTargetType from properties."); + } + } Retry listReleasesRetry = clientProperties.getListReleasesRetry(); if (listReleasesRetry != null) { RetrySettings listReleasesRetrySettings = diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java index 617ffd0800..7a78002d6c 100644 --- a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java +++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java @@ -67,6 +67,16 @@ public class CloudDeploySpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getTargetRetry; + /** + * Allow override of retry settings at method-level for listCustomTargetTypes. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCustomTargetTypesRetry; + /** + * Allow override of retry settings at method-level for getCustomTargetType. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCustomTargetTypeRetry; /** * Allow override of retry settings at method-level for listReleases. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -265,6 +275,22 @@ public void setGetTargetRetry(Retry getTargetRetry) { this.getTargetRetry = getTargetRetry; } + public Retry getListCustomTargetTypesRetry() { + return this.listCustomTargetTypesRetry; + } + + public void setListCustomTargetTypesRetry(Retry listCustomTargetTypesRetry) { + this.listCustomTargetTypesRetry = listCustomTargetTypesRetry; + } + + public Retry getGetCustomTargetTypeRetry() { + return this.getCustomTargetTypeRetry; + } + + public void setGetCustomTargetTypeRetry(Retry getCustomTargetTypeRetry) { + this.getCustomTargetTypeRetry = getCustomTargetTypeRetry; + } + public Retry getListReleasesRetry() { return this.listReleasesRetry; } 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 d2c736a522..db48afc499 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 @@ -195,6 +195,45 @@ public OrgPolicySettings orgPolicySettings( clientSettingsBuilder.deletePolicySettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.deletePolicySettings().setRetrySettings(deletePolicyRetrySettings); + RetrySettings createCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCustomConstraintSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createCustomConstraintSettings() + .setRetrySettings(createCustomConstraintRetrySettings); + + RetrySettings updateCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCustomConstraintSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateCustomConstraintSettings() + .setRetrySettings(updateCustomConstraintRetrySettings); + + RetrySettings getCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomConstraintSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getCustomConstraintSettings() + .setRetrySettings(getCustomConstraintRetrySettings); + + RetrySettings listCustomConstraintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomConstraintsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listCustomConstraintsSettings() + .setRetrySettings(listCustomConstraintsRetrySettings); + + RetrySettings deleteCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteCustomConstraintSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteCustomConstraintSettings() + .setRetrySettings(deleteCustomConstraintRetrySettings); + if (LOGGER.isTraceEnabled()) { LOGGER.trace("Configured service-level retry settings from properties."); } @@ -276,6 +315,76 @@ public OrgPolicySettings orgPolicySettings( LOGGER.trace("Configured method-level retry settings for deletePolicy from properties."); } } + Retry createCustomConstraintRetry = clientProperties.getCreateCustomConstraintRetry(); + if (createCustomConstraintRetry != null) { + RetrySettings createCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCustomConstraintSettings().getRetrySettings(), + createCustomConstraintRetry); + clientSettingsBuilder + .createCustomConstraintSettings() + .setRetrySettings(createCustomConstraintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createCustomConstraint from properties."); + } + } + Retry updateCustomConstraintRetry = clientProperties.getUpdateCustomConstraintRetry(); + if (updateCustomConstraintRetry != null) { + RetrySettings updateCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCustomConstraintSettings().getRetrySettings(), + updateCustomConstraintRetry); + clientSettingsBuilder + .updateCustomConstraintSettings() + .setRetrySettings(updateCustomConstraintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateCustomConstraint from properties."); + } + } + Retry getCustomConstraintRetry = clientProperties.getGetCustomConstraintRetry(); + if (getCustomConstraintRetry != null) { + RetrySettings getCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomConstraintSettings().getRetrySettings(), + getCustomConstraintRetry); + clientSettingsBuilder + .getCustomConstraintSettings() + .setRetrySettings(getCustomConstraintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getCustomConstraint from properties."); + } + } + Retry listCustomConstraintsRetry = clientProperties.getListCustomConstraintsRetry(); + if (listCustomConstraintsRetry != null) { + RetrySettings listCustomConstraintsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomConstraintsSettings().getRetrySettings(), + listCustomConstraintsRetry); + clientSettingsBuilder + .listCustomConstraintsSettings() + .setRetrySettings(listCustomConstraintsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listCustomConstraints from properties."); + } + } + Retry deleteCustomConstraintRetry = clientProperties.getDeleteCustomConstraintRetry(); + if (deleteCustomConstraintRetry != null) { + RetrySettings deleteCustomConstraintRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteCustomConstraintSettings().getRetrySettings(), + deleteCustomConstraintRetry); + clientSettingsBuilder + .deleteCustomConstraintSettings() + .setRetrySettings(deleteCustomConstraintRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteCustomConstraint from properties."); + } + } return clientSettingsBuilder.build(); } diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java index 445df2fef4..f927305771 100644 --- a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java +++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java @@ -77,6 +77,31 @@ public class OrgPolicySpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry deletePolicyRetry; + /** + * Allow override of retry settings at method-level for createCustomConstraint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createCustomConstraintRetry; + /** + * Allow override of retry settings at method-level for updateCustomConstraint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateCustomConstraintRetry; + /** + * Allow override of retry settings at method-level for getCustomConstraint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCustomConstraintRetry; + /** + * Allow override of retry settings at method-level for listCustomConstraints. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCustomConstraintsRetry; + /** + * Allow override of retry settings at method-level for deleteCustomConstraint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteCustomConstraintRetry; @Override public Credentials getCredentials() { @@ -170,4 +195,44 @@ public Retry getDeletePolicyRetry() { public void setDeletePolicyRetry(Retry deletePolicyRetry) { this.deletePolicyRetry = deletePolicyRetry; } + + public Retry getCreateCustomConstraintRetry() { + return this.createCustomConstraintRetry; + } + + public void setCreateCustomConstraintRetry(Retry createCustomConstraintRetry) { + this.createCustomConstraintRetry = createCustomConstraintRetry; + } + + public Retry getUpdateCustomConstraintRetry() { + return this.updateCustomConstraintRetry; + } + + public void setUpdateCustomConstraintRetry(Retry updateCustomConstraintRetry) { + this.updateCustomConstraintRetry = updateCustomConstraintRetry; + } + + public Retry getGetCustomConstraintRetry() { + return this.getCustomConstraintRetry; + } + + public void setGetCustomConstraintRetry(Retry getCustomConstraintRetry) { + this.getCustomConstraintRetry = getCustomConstraintRetry; + } + + public Retry getListCustomConstraintsRetry() { + return this.listCustomConstraintsRetry; + } + + public void setListCustomConstraintsRetry(Retry listCustomConstraintsRetry) { + this.listCustomConstraintsRetry = listCustomConstraintsRetry; + } + + public Retry getDeleteCustomConstraintRetry() { + return this.deleteCustomConstraintRetry; + } + + public void setDeleteCustomConstraintRetry(Retry deleteCustomConstraintRetry) { + this.deleteCustomConstraintRetry = deleteCustomConstraintRetry; + } } 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 new file mode 100644 index 0000000000..d4046e5e74 --- /dev/null +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringAutoConfiguration.java @@ -0,0 +1,202 @@ +/* + * Copyright 2023 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.devtools.cloudprofiler.v2.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.devtools.cloudprofiler.v2.ExportServiceClient; +import com.google.devtools.cloudprofiler.v2.ExportServiceSettings; +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 ExportServiceClient}. + * + *

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(ExportServiceClient.class) +@ConditionalOnProperty( + value = "com.google.devtools.cloudprofiler.v2.export-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(ExportServiceSpringProperties.class) +public class ExportServiceSpringAutoConfiguration { + private final ExportServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = LogFactory.getLog(ExportServiceSpringAutoConfiguration.class); + + protected ExportServiceSpringAutoConfiguration( + ExportServiceSpringProperties clientProperties, CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from ExportService-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 = "defaultExportServiceTransportChannelProvider") + public TransportChannelProvider defaultExportServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return ExportServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return ExportServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a ExportServiceSettings bean configured to use a DefaultCredentialsProvider and the + * client library's default transport channel provider + * (defaultExportServiceTransportChannelProvider()). 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 ExportServiceSpringProperties. 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 ExportServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ExportServiceSettings exportServiceSettings( + @Qualifier("defaultExportServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ExportServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ExportServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ExportServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + ExportServiceSettings.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 listProfilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProfilesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listProfilesSettings().setRetrySettings(listProfilesRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listProfilesRetry = clientProperties.getListProfilesRetry(); + if (listProfilesRetry != null) { + RetrySettings listProfilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProfilesSettings().getRetrySettings(), listProfilesRetry); + clientSettingsBuilder.listProfilesSettings().setRetrySettings(listProfilesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listProfiles from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ExportServiceClient bean configured with ExportServiceSettings. + * + * @param exportServiceSettings settings to configure an instance of client bean. + * @return a {@link ExportServiceClient} bean configured with {@link ExportServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ExportServiceClient exportServiceClient(ExportServiceSettings exportServiceSettings) + throws IOException { + return ExportServiceClient.create(exportServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-export-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringProperties.java b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringProperties.java new file mode 100644 index 0000000000..7aad84fcf2 --- /dev/null +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ExportServiceSpringProperties.java @@ -0,0 +1,98 @@ +/* + * Copyright 2023 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.devtools.cloudprofiler.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 ExportService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.devtools.cloudprofiler.v2.export-service") +public class ExportServiceSpringProperties 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/monitoring", + "https://www.googleapis.com/auth/monitoring.write"); + /** 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 listProfiles. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listProfilesRetry; + + @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 getListProfilesRetry() { + return this.listProfilesRetry; + } + + public void setListProfilesRetry(Retry listProfilesRetry) { + this.listProfilesRetry = listProfilesRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index a18ecd0f38..582de778e7 100644 --- a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -5,6 +5,12 @@ "type": "java.lang.Boolean", "description": "Auto-configure Google Cloud cloudprofiler/ProfilerService components.", "defaultValue": true + }, + { + "name": "com.google.devtools.cloudprofiler.v2.export-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud cloudprofiler/ExportService components.", + "defaultValue": true } ] } \ No newline at end of file diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 0c01f6b367..b5045c4d23 100644 --- a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1 +1,2 @@ -com.google.devtools.cloudprofiler.v2.spring.ProfilerServiceSpringAutoConfiguration \ No newline at end of file +com.google.devtools.cloudprofiler.v2.spring.ProfilerServiceSpringAutoConfiguration +com.google.devtools.cloudprofiler.v2.spring.ExportServiceSpringAutoConfiguration \ No newline at end of file