From 2a8b10395058168971a85b9bdc3cea65b32b0b59 Mon Sep 17 00:00:00 2001
From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com>
Date: Wed, 25 Jan 2023 12:46:43 -0500
Subject: [PATCH] feat(codegen): additional autoconfiguration starter modules
for preview (#1517)
This is an initial PR for additional starters (for preview) that provide dependencies and auto-configurations for working with corresponding Google Client Libraries.
* Documentation and release profile changes to follow in #1469, #1415
---
spring-cloud-previews/README.md | 87 ++
.../pom.xml | 35 +
...AccessApprovalSpringAutoConfiguration.java | 386 ++++++++
.../AccessApprovalSpringProperties.java | 199 ++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...DatasetServiceSpringAutoConfiguration.java | 398 ++++++++
.../DatasetServiceSpringProperties.java | 241 +++++
...ndpointServiceSpringAutoConfiguration.java | 302 ++++++
.../EndpointServiceSpringProperties.java | 176 ++++
...ServingServiceSpringAutoConfiguration.java | 309 ++++++
...eOnlineServingServiceSpringProperties.java | 163 ++++
...restoreServiceSpringAutoConfiguration.java | 417 +++++++++
.../FeaturestoreServiceSpringProperties.java | 254 +++++
...ndpointServiceSpringAutoConfiguration.java | 323 +++++++
.../IndexEndpointServiceSpringProperties.java | 176 ++++
.../IndexServiceSpringAutoConfiguration.java | 328 +++++++
.../spring/IndexServiceSpringProperties.java | 189 ++++
.../JobServiceSpringAutoConfiguration.java | 734 +++++++++++++++
.../v1/spring/JobServiceSpringProperties.java | 430 +++++++++
...etadataServiceSpringAutoConfiguration.java | 710 ++++++++++++++
.../MetadataServiceSpringProperties.java | 450 +++++++++
...grationServiceSpringAutoConfiguration.java | 279 ++++++
.../MigrationServiceSpringProperties.java | 150 +++
.../ModelServiceSpringAutoConfiguration.java | 475 ++++++++++
.../spring/ModelServiceSpringProperties.java | 281 ++++++
...ipelineServiceSpringAutoConfiguration.java | 422 +++++++++
.../PipelineServiceSpringProperties.java | 241 +++++
...dictionServiceSpringAutoConfiguration.java | 304 ++++++
.../PredictionServiceSpringProperties.java | 176 ++++
...istPoolServiceSpringAutoConfiguration.java | 302 ++++++
...SpecialistPoolServiceSpringProperties.java | 163 ++++
...orboardServiceSpringAutoConfiguration.java | 717 ++++++++++++++
.../TensorboardServiceSpringProperties.java | 414 ++++++++
.../VizierServiceSpringAutoConfiguration.java | 463 +++++++++
.../spring/VizierServiceSpringProperties.java | 306 ++++++
.../aiplatform/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 94 ++
...ot.autoconfigure.AutoConfiguration.imports | 15 +
.../pom.xml | 35 +
...GatewayServiceSpringAutoConfiguration.java | 279 ++++++
.../ApiGatewayServiceSpringProperties.java | 160 ++++
.../apigateway/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...nectionServiceSpringAutoConfiguration.java | 208 +++++
.../ConnectionServiceSpringProperties.java | 95 ++
.../spring/TetherSpringAutoConfiguration.java | 181 ++++
.../v1/spring/TetherSpringProperties.java | 82 ++
.../apigeeconnect/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
.../ApplicationsSpringAutoConfiguration.java | 202 ++++
.../spring/ApplicationsSpringProperties.java | 98 ++
...edCertificatesSpringAutoConfiguration.java | 299 ++++++
...uthorizedCertificatesSpringProperties.java | 150 +++
...horizedDomainsSpringAutoConfiguration.java | 210 +++++
.../AuthorizedDomainsSpringProperties.java | 98 ++
...DomainMappingsSpringAutoConfiguration.java | 228 +++++
.../DomainMappingsSpringProperties.java | 111 +++
.../FirewallSpringAutoConfiguration.java | 303 ++++++
.../v1/spring/FirewallSpringProperties.java | 163 ++++
.../InstancesSpringAutoConfiguration.java | 211 +++++
.../v1/spring/InstancesSpringProperties.java | 111 +++
.../ServicesSpringAutoConfiguration.java | 211 +++++
.../v1/spring/ServicesSpringProperties.java | 111 +++
.../VersionsSpringAutoConfiguration.java | 211 +++++
.../v1/spring/VersionsSpringProperties.java | 111 +++
.../appengine/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 52 ++
...ot.autoconfigure.AutoConfiguration.imports | 8 +
.../pom.xml | 35 +
...tifactRegistrySpringAutoConfiguration.java | 570 +++++++++++
.../ArtifactRegistrySpringProperties.java | 383 ++++++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-asset-spring-starter/pom.xml | 35 +
.../AssetServiceSpringAutoConfiguration.java | 514 ++++++++++
.../spring/AssetServiceSpringProperties.java | 316 +++++++
.../cloud/asset/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...rkloadsServiceSpringAutoConfiguration.java | 326 +++++++
...suredWorkloadsServiceSpringProperties.java | 186 ++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../spring/AutoMlSpringAutoConfiguration.java | 335 +++++++
.../v1/spring/AutoMlSpringProperties.java | 199 ++++
...dictionServiceSpringAutoConfiguration.java | 203 ++++
.../PredictionServiceSpringProperties.java | 95 ++
.../cloud/automl/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
...nectionServiceSpringAutoConfiguration.java | 337 +++++++
.../ConnectionServiceSpringProperties.java | 188 ++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ransferServiceSpringAutoConfiguration.java | 525 +++++++++++
.../DataTransferServiceSpringProperties.java | 303 ++++++
.../datatransfer/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...rvationServiceSpringAutoConfiguration.java | 626 +++++++++++++
.../ReservationServiceSpringProperties.java | 357 +++++++
.../reservation/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../CloudBillingSpringAutoConfiguration.java | 389 ++++++++
.../spring/CloudBillingSpringProperties.java | 215 +++++
.../CloudCatalogSpringAutoConfiguration.java | 216 +++++
.../spring/CloudCatalogSpringProperties.java | 111 +++
.../cloud/billing/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
.../BudgetServiceSpringAutoConfiguration.java | 261 ++++++
.../spring/BudgetServiceSpringProperties.java | 149 +++
.../budgets/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ementServiceV1SpringAutoConfiguration.java | 299 ++++++
...hzManagementServiceV1SpringProperties.java | 174 ++++
...SystemPolicyV1SpringAutoConfiguration.java | 206 ++++
.../SystemPolicyV1SpringProperties.java | 95 ++
...dationHelperV1SpringAutoConfiguration.java | 211 +++++
.../ValidationHelperV1SpringProperties.java | 96 ++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 22 +
...ot.autoconfigure.AutoConfiguration.imports | 3 +
.../google-cloud-build-spring-starter/pom.xml | 35 +
.../CloudBuildSpringAutoConfiguration.java | 391 ++++++++
.../v1/spring/CloudBuildSpringProperties.java | 225 +++++
.../cloudbuild/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ReportsServiceSpringAutoConfiguration.java | 226 +++++
...ChannelReportsServiceSpringProperties.java | 108 +++
...ChannelServiceSpringAutoConfiguration.java | 881 ++++++++++++++++++
.../CloudChannelServiceSpringProperties.java | 529 +++++++++++
.../cloud/channel/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
...CenterInsightsSpringAutoConfiguration.java | 704 ++++++++++++++
...ContactCenterInsightsSpringProperties.java | 459 +++++++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ClusterManagerSpringAutoConfiguration.java | 767 +++++++++++++++
.../ClusterManagerSpringProperties.java | 501 ++++++++++
.../container/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...tainerAnalysisSpringAutoConfiguration.java | 262 ++++++
.../ContainerAnalysisSpringProperties.java | 135 +++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../DataFusionSpringAutoConfiguration.java | 237 +++++
.../v1/spring/DataFusionSpringProperties.java | 121 +++
.../datafusion/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../DataCatalogSpringAutoConfiguration.java | 761 +++++++++++++++
.../spring/DataCatalogSpringProperties.java | 498 ++++++++++
...rSerializationSpringAutoConfiguration.java | 254 +++++
...gManagerSerializationSpringProperties.java | 121 +++
...licyTagManagerSpringAutoConfiguration.java | 408 ++++++++
.../PolicyTagManagerSpringProperties.java | 251 +++++
.../datacatalog/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 22 +
...ot.autoconfigure.AutoConfiguration.imports | 3 +
.../pom.xml | 35 +
...ContentServiceSpringAutoConfiguration.java | 342 +++++++
.../ContentServiceSpringProperties.java | 212 +++++
...ataScanServiceSpringAutoConfiguration.java | 298 ++++++
.../DataScanServiceSpringProperties.java | 173 ++++
...ataplexServiceSpringAutoConfiguration.java | 494 ++++++++++
.../DataplexServiceSpringProperties.java | 329 +++++++
...etadataServiceSpringAutoConfiguration.java | 362 +++++++
.../MetadataServiceSpringProperties.java | 225 +++++
.../dataplex/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 28 +
...ot.autoconfigure.AutoConfiguration.imports | 4 +
.../pom.xml | 35 +
...toreFederationSpringAutoConfiguration.java | 225 +++++
...ocMetastoreFederationSpringProperties.java | 108 +++
...aprocMetastoreSpringAutoConfiguration.java | 290 ++++++
.../DataprocMetastoreSpringProperties.java | 160 ++++
.../metastore/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
...gPolicyServiceSpringAutoConfiguration.java | 300 ++++++
...oscalingPolicyServiceSpringProperties.java | 147 +++
...atchControllerSpringAutoConfiguration.java | 231 +++++
.../BatchControllerSpringProperties.java | 121 +++
...sterControllerSpringAutoConfiguration.java | 218 +++++
.../ClusterControllerSpringProperties.java | 108 +++
.../JobControllerSpringAutoConfiguration.java | 276 ++++++
.../spring/JobControllerSpringProperties.java | 160 ++++
...roupControllerSpringAutoConfiguration.java | 203 ++++
.../NodeGroupControllerSpringProperties.java | 95 ++
...emplateServiceSpringAutoConfiguration.java | 298 ++++++
...rkflowTemplateServiceSpringProperties.java | 147 +++
.../dataproc/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 40 +
...ot.autoconfigure.AutoConfiguration.imports | 6 +
.../pom.xml | 35 +
.../DatastreamSpringAutoConfiguration.java | 504 ++++++++++
.../v1/spring/DatastreamSpringProperties.java | 303 ++++++
.../datastream/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../Controller2SpringAutoConfiguration.java | 250 +++++
.../spring/Controller2SpringProperties.java | 123 +++
.../Debugger2SpringAutoConfiguration.java | 269 ++++++
.../v2/spring/Debugger2SpringProperties.java | 149 +++
.../debugger/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
.../CloudDeploySpringAutoConfiguration.java | 491 ++++++++++
.../spring/CloudDeploySpringProperties.java | 329 +++++++
.../cloud/deploy/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../spring/AgentsSpringAutoConfiguration.java | 294 ++++++
.../v2/spring/AgentsSpringProperties.java | 175 ++++
.../AnswerRecordsSpringAutoConfiguration.java | 258 +++++
.../spring/AnswerRecordsSpringProperties.java | 136 +++
.../ContextsSpringAutoConfiguration.java | 309 ++++++
.../v2/spring/ContextsSpringProperties.java | 188 ++++
...sationDatasetsSpringAutoConfiguration.java | 263 ++++++
.../ConversationDatasetsSpringProperties.java | 136 +++
...ersationModelsSpringAutoConfiguration.java | 308 ++++++
.../ConversationModelsSpringProperties.java | 163 ++++
...sationProfilesSpringAutoConfiguration.java | 329 +++++++
.../ConversationProfilesSpringProperties.java | 175 ++++
.../ConversationsSpringAutoConfiguration.java | 315 +++++++
.../spring/ConversationsSpringProperties.java | 175 ++++
.../DocumentsSpringAutoConfiguration.java | 243 +++++
.../v2/spring/DocumentsSpringProperties.java | 136 +++
.../EntityTypesSpringAutoConfiguration.java | 313 +++++++
.../spring/EntityTypesSpringProperties.java | 175 ++++
.../EnvironmentsSpringAutoConfiguration.java | 338 +++++++
.../spring/EnvironmentsSpringProperties.java | 188 ++++
.../FulfillmentsSpringAutoConfiguration.java | 253 +++++
.../spring/FulfillmentsSpringProperties.java | 136 +++
.../IntentsSpringAutoConfiguration.java | 288 ++++++
.../v2/spring/IntentsSpringProperties.java | 175 ++++
...KnowledgeBasesSpringAutoConfiguration.java | 321 +++++++
.../KnowledgeBasesSpringProperties.java | 175 ++++
.../ParticipantsSpringAutoConfiguration.java | 373 ++++++++
.../spring/ParticipantsSpringProperties.java | 214 +++++
...ionEntityTypesSpringAutoConfiguration.java | 328 +++++++
.../SessionEntityTypesSpringProperties.java | 175 ++++
.../SessionsSpringAutoConfiguration.java | 228 +++++
.../v2/spring/SessionsSpringProperties.java | 123 +++
.../VersionsSpringAutoConfiguration.java | 288 ++++++
.../v2/spring/VersionsSpringProperties.java | 175 ++++
.../dialogflow/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 106 +++
...ot.autoconfigure.AutoConfiguration.imports | 17 +
.../google-cloud-dlp-spring-starter/pom.xml | 35 +
.../DlpServiceSpringAutoConfiguration.java | 850 +++++++++++++++++
.../v2/spring/DlpServiceSpringProperties.java | 524 +++++++++++
.../cloud/dlp/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-dms-spring-starter/pom.xml | 35 +
...grationServiceSpringAutoConfiguration.java | 285 ++++++
.../DataMigrationServiceSpringProperties.java | 137 +++
.../clouddms/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ocessorServiceSpringAutoConfiguration.java | 376 ++++++++
...umentProcessorServiceSpringProperties.java | 212 +++++
.../documentai/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../DomainsSpringAutoConfiguration.java | 325 +++++++
.../v1/spring/DomainsSpringProperties.java | 173 ++++
.../cloud/domains/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ontactsServiceSpringAutoConfiguration.java | 305 ++++++
...entialContactsServiceSpringProperties.java | 173 ++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../EventarcSpringAutoConfiguration.java | 442 +++++++++
.../v1/spring/EventarcSpringProperties.java | 277 ++++++
.../eventarc/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...lestoreManagerSpringAutoConfiguration.java | 249 +++++
...CloudFilestoreManagerSpringProperties.java | 134 +++
.../filestore/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...unctionServiceSpringAutoConfiguration.java | 339 +++++++
.../FunctionServiceSpringProperties.java | 199 ++++
.../functions/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...lustersServiceSpringAutoConfiguration.java | 303 ++++++
...ServerClustersServiceSpringProperties.java | 147 +++
...ConfigsServiceSpringAutoConfiguration.java | 233 +++++
...eServerConfigsServiceSpringProperties.java | 108 +++
...oymentsServiceSpringAutoConfiguration.java | 303 ++++++
...verDeploymentsServiceSpringProperties.java | 148 +++
.../RealmsServiceSpringAutoConfiguration.java | 237 +++++
.../spring/RealmsServiceSpringProperties.java | 121 +++
.../cloud/gaming/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 28 +
...ot.autoconfigure.AutoConfiguration.imports | 4 +
.../pom.xml | 35 +
.../spring/GkeHubSpringAutoConfiguration.java | 268 ++++++
.../v1/spring/GkeHubSpringProperties.java | 147 +++
.../cloud/gkehub/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../GSuiteAddOnsSpringAutoConfiguration.java | 368 ++++++++
.../spring/GSuiteAddOnsSpringProperties.java | 199 ++++
.../gsuiteaddons/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...IAMCredentialsSpringAutoConfiguration.java | 257 +++++
.../IAMCredentialsSpringProperties.java | 134 +++
.../credentials/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-ids-spring-starter/pom.xml | 35 +
.../v1/spring/IDSSpringAutoConfiguration.java | 211 +++++
.../ids/v1/spring/IDSSpringProperties.java | 108 +++
.../cloud/ids/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-iot-spring-starter/pom.xml | 35 +
.../DeviceManagerSpringAutoConfiguration.java | 550 +++++++++++
.../spring/DeviceManagerSpringProperties.java | 331 +++++++
.../cloud/iot/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...anguageServiceSpringAutoConfiguration.java | 294 ++++++
.../LanguageServiceSpringProperties.java | 162 ++++
.../language/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ntitiesServiceSpringAutoConfiguration.java | 231 +++++
...agedIdentitiesServiceSpringProperties.java | 111 +++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../CloudMemcacheSpringAutoConfiguration.java | 246 +++++
.../spring/CloudMemcacheSpringProperties.java | 134 +++
.../memcache/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...hboardsServiceSpringAutoConfiguration.java | 279 ++++++
.../DashboardsServiceSpringProperties.java | 151 +++
.../dashboard/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...abilityServiceSpringAutoConfiguration.java | 231 +++++
.../ReachabilityServiceSpringProperties.java | 108 +++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../HubServiceSpringAutoConfiguration.java | 234 +++++
.../v1/spring/HubServiceSpringProperties.java | 124 +++
...RoutingServiceSpringAutoConfiguration.java | 223 +++++
...cyBasedRoutingServiceSpringProperties.java | 98 ++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
...otebookServiceSpringAutoConfiguration.java | 312 +++++++
...anagedNotebookServiceSpringProperties.java | 176 ++++
...otebookServiceSpringAutoConfiguration.java | 449 +++++++++
.../NotebookServiceSpringProperties.java | 280 ++++++
.../notebooks/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
.../FleetRoutingSpringAutoConfiguration.java | 201 ++++
.../spring/FleetRoutingSpringProperties.java | 95 ++
.../optimization/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../EnvironmentsSpringAutoConfiguration.java | 223 +++++
.../spring/EnvironmentsSpringProperties.java | 108 +++
.../ImageVersionsSpringAutoConfiguration.java | 207 ++++
.../spring/ImageVersionsSpringProperties.java | 95 ++
.../service/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
.../OrgPolicySpringAutoConfiguration.java | 299 ++++++
.../v2/spring/OrgPolicySpringProperties.java | 173 ++++
.../orgpolicy/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...sConfigServiceSpringAutoConfiguration.java | 427 +++++++++
.../OsConfigServiceSpringProperties.java | 238 +++++
...igZonalServiceSpringAutoConfiguration.java | 380 ++++++++
.../OsConfigZonalServiceSpringProperties.java | 199 ++++
.../osconfig/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../pom.xml | 35 +
...OsLoginServiceSpringAutoConfiguration.java | 331 +++++++
.../OsLoginServiceSpringProperties.java | 177 ++++
.../cloud/oslogin/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../IamCheckerSpringAutoConfiguration.java | 207 ++++
.../v1/spring/IamCheckerSpringProperties.java | 95 ++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...rofilerServiceSpringAutoConfiguration.java | 238 +++++
.../ProfilerServiceSpringProperties.java | 124 +++
.../cloudprofiler/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...erpriseServiceSpringAutoConfiguration.java | 421 +++++++++
...tchaEnterpriseServiceSpringProperties.java | 243 +++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../RecommenderSpringAutoConfiguration.java | 432 +++++++++
.../spring/RecommenderSpringProperties.java | 238 +++++
.../recommender/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-redis-spring-starter/pom.xml | 35 +
.../CloudRedisSpringAutoConfiguration.java | 237 +++++
.../v1/spring/CloudRedisSpringProperties.java | 121 +++
.../cloud/redis/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ettingsServiceSpringAutoConfiguration.java | 234 +++++
...sourceSettingsServiceSpringProperties.java | 121 +++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...CatalogServiceSpringAutoConfiguration.java | 409 ++++++++
.../CatalogServiceSpringProperties.java | 225 +++++
...pletionServiceSpringAutoConfiguration.java | 203 ++++
.../CompletionServiceSpringProperties.java | 95 ++
...ControlServiceSpringAutoConfiguration.java | 261 ++++++
.../ControlServiceSpringProperties.java | 147 +++
...dictionServiceSpringAutoConfiguration.java | 203 ++++
.../PredictionServiceSpringProperties.java | 95 ++
...ProductServiceSpringAutoConfiguration.java | 261 ++++++
.../ProductServiceSpringProperties.java | 147 +++
.../SearchServiceSpringAutoConfiguration.java | 201 ++++
.../spring/SearchServiceSpringProperties.java | 95 ++
...gConfigServiceSpringAutoConfiguration.java | 324 +++++++
.../ServingConfigServiceSpringProperties.java | 173 ++++
...erEventServiceSpringAutoConfiguration.java | 224 +++++
.../UserEventServiceSpringProperties.java | 108 +++
.../cloud/retail/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 52 ++
...ot.autoconfigure.AutoConfiguration.imports | 8 +
.../pom.xml | 35 +
...CloudSchedulerSpringAutoConfiguration.java | 306 ++++++
.../CloudSchedulerSpringProperties.java | 186 ++++
.../scheduler/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...thorityServiceSpringAutoConfiguration.java | 573 ++++++++++++
...icateAuthorityServiceSpringProperties.java | 342 +++++++
.../privateca/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...SecurityCenterSpringAutoConfiguration.java | 825 ++++++++++++++++
.../SecurityCenterSpringProperties.java | 524 +++++++++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...viceControllerSpringAutoConfiguration.java | 218 +++++
.../ServiceControllerSpringProperties.java | 110 +++
.../v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ServiceManagerSpringAutoConfiguration.java | 343 +++++++
.../ServiceManagerSpringProperties.java | 190 ++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../ServiceUsageSpringAutoConfiguration.java | 237 +++++
.../spring/ServiceUsageSpringProperties.java | 124 +++
.../serviceusage/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../LookupServiceSpringAutoConfiguration.java | 202 ++++
.../spring/LookupServiceSpringProperties.java | 95 ++
...trationServiceSpringAutoConfiguration.java | 483 ++++++++++
.../RegistrationServiceSpringProperties.java | 316 +++++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../google-cloud-shell-spring-starter/pom.xml | 35 +
...udShellServiceSpringAutoConfiguration.java | 204 ++++
.../CloudShellServiceSpringProperties.java | 95 ++
.../cloud/shell/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../spring/SpeechSpringAutoConfiguration.java | 329 +++++++
.../v2/spring/SpeechSpringProperties.java | 199 ++++
.../cloud/speech/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ransferServiceSpringAutoConfiguration.java | 446 +++++++++
...torageTransferServiceSpringProperties.java | 251 +++++
.../v1/proto/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...CompanyServiceSpringAutoConfiguration.java | 261 ++++++
.../CompanyServiceSpringProperties.java | 148 +++
.../CompletionSpringAutoConfiguration.java | 200 ++++
.../v4/spring/CompletionSpringProperties.java | 96 ++
.../EventServiceSpringAutoConfiguration.java | 207 ++++
.../spring/EventServiceSpringProperties.java | 96 ++
.../JobServiceSpringAutoConfiguration.java | 296 ++++++
.../v4/spring/JobServiceSpringProperties.java | 174 ++++
.../TenantServiceSpringAutoConfiguration.java | 261 ++++++
.../spring/TenantServiceSpringProperties.java | 148 +++
.../cloud/talent/v4/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 34 +
...ot.autoconfigure.AutoConfiguration.imports | 5 +
.../google-cloud-tasks-spring-starter/pom.xml | 35 +
.../CloudTasksSpringAutoConfiguration.java | 431 +++++++++
.../v2/spring/CloudTasksSpringProperties.java | 290 ++++++
.../cloud/tasks/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...udioSynthesizeSpringAutoConfiguration.java | 193 ++++
...chLongAudioSynthesizeSpringProperties.java | 82 ++
.../TextToSpeechSpringAutoConfiguration.java | 222 +++++
.../spring/TextToSpeechSpringProperties.java | 108 +++
.../texttospeech/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 16 +
...ot.autoconfigure.AutoConfiguration.imports | 2 +
.../google-cloud-tpu-spring-starter/pom.xml | 35 +
.../v2/spring/TpuSpringAutoConfiguration.java | 369 ++++++++
.../tpu/v2/spring/TpuSpringProperties.java | 212 +++++
.../cloud/tpu/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-cloud-trace-spring-starter/pom.xml | 35 +
.../TraceServiceSpringAutoConfiguration.java | 221 +++++
.../spring/TraceServiceSpringProperties.java | 110 +++
.../cloud/trace/v2/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ligenceServiceSpringAutoConfiguration.java | 188 ++++
...eoIntelligenceServiceSpringProperties.java | 82 ++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...nscoderServiceSpringAutoConfiguration.java | 327 +++++++
.../TranscoderServiceSpringProperties.java | 186 ++++
.../transcoder/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../VmMigrationSpringAutoConfiguration.java | 566 +++++++++++
.../spring/VmMigrationSpringProperties.java | 355 +++++++
.../vmmigration/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...cAccessServiceSpringAutoConfiguration.java | 233 +++++
.../VpcAccessServiceSpringProperties.java | 121 +++
.../vpcaccess/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...WebRiskServiceSpringAutoConfiguration.java | 259 +++++
.../WebRiskServiceSpringProperties.java | 134 +++
.../cloud/webrisk/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ecurityScannerSpringAutoConfiguration.java | 418 +++++++++
.../WebSecurityScannerSpringProperties.java | 251 +++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../ExecutionsSpringAutoConfiguration.java | 256 +++++
.../v1/spring/ExecutionsSpringProperties.java | 134 +++
.../executions/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
.../WorkflowsSpringAutoConfiguration.java | 213 +++++
.../v1/spring/WorkflowsSpringProperties.java | 108 +++
.../workflows/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../google-iam-admin-spring-starter/pom.xml | 35 +
.../v1/spring/IAMSpringAutoConfiguration.java | 770 +++++++++++++++
.../admin/v1/spring/IAMSpringProperties.java | 475 ++++++++++
.../iam/admin/v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../pom.xml | 35 +
...ContextManagerSpringAutoConfiguration.java | 405 ++++++++
.../AccessContextManagerSpringProperties.java | 225 +++++
.../v1/spring/package-info.java | 23 +
...itional-spring-configuration-metadata.json | 10 +
...ot.autoconfigure.AutoConfiguration.imports | 1 +
spring-cloud-previews/pom.xml | 87 ++
674 files changed, 91426 insertions(+)
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/CloudBuildSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/CloudBuildSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerClustersServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerClustersServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/LanguageServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/LanguageServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/ManagedNotebookServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/ManagedNotebookServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/SecurityCenterSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/SecurityCenterSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringProperties.java
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringProperties.java
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/pom.xml
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringAutoConfiguration.java
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringProperties.java
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/package-info.java
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
create mode 100644 spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md
index 16523b3a1d..bede68dff1 100644
--- a/spring-cloud-previews/README.md
+++ b/spring-cloud-previews/README.md
@@ -4,3 +4,90 @@ This is a list of starters we provide with dependencies and auto-configurations
| Client Library | Starter Maven Artifact |
|----------------| -----------------------|
+|[java-accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter|
+|[java-accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter|
+|[java-aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.0/java-automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter|
+|[java-bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter|
+|[java-bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter|
+|[java-bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter|
+|[java-billing](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter|
+|[java-billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter|
+|[java-cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter|
+|[java-contact-center-insights](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.0/java-container/README.md)|com.google.cloud:google-cloud-container-spring-starter|
+|[java-containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter|
+|[java-dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter|
+|[java-datastream](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter|
+|[java-dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter|
+|[java-dlp](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter|
+|[java-dms](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.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.2.0/java-eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter|
+|[java-filestore](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter|
+|[java-functions](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter|
+|[java-game-servers](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-game-servers/README.md)|com.google.cloud:google-cloud-game-servers-spring-starter|
+|[java-gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.0/java-iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter|
+|[java-ids](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter|
+|[java-iot](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter|
+|[java-language](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.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.2.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.2.0/java-networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter|
+|[java-notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter|
+|[java-optimization](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.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.2.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.2.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.2.0/java-profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter|
+|[java-recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter|
+|[java-recommender](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter|
+|[java-redis](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter|
+|[java-scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.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.2.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.2.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.2.0/java-servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter|
+|[java-shell](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter|
+|[java-speech](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter|
+|[java-tasks](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter|
+|[java-texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter|
+|[java-tpu](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter|
+|[java-trace](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.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.2.0/java-vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter|
+|[java-vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter|
+|[java-webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.2.0/java-webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter|
+|[java-websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.2.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.2.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.2.0/java-workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter|
diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/pom.xml
new file mode 100644
index 0000000000..72d680b520
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in AccessApprovalSpringProperties. 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 AccessApprovalSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AccessApprovalAdminSettings accessApprovalSettings(
+ @Qualifier("defaultAccessApprovalTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ AccessApprovalAdminSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = AccessApprovalAdminSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = AccessApprovalAdminSettings.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 =
+ AccessApprovalAdminSettings.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 listApprovalRequestsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApprovalRequestsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listApprovalRequestsSettings()
+ .setRetrySettings(listApprovalRequestsRetrySettings);
+
+ RetrySettings getApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApprovalRequestSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getApprovalRequestSettings()
+ .setRetrySettings(getApprovalRequestRetrySettings);
+
+ RetrySettings approveApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.approveApprovalRequestSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .approveApprovalRequestSettings()
+ .setRetrySettings(approveApprovalRequestRetrySettings);
+
+ RetrySettings dismissApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.dismissApprovalRequestSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .dismissApprovalRequestSettings()
+ .setRetrySettings(dismissApprovalRequestRetrySettings);
+
+ RetrySettings invalidateApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.invalidateApprovalRequestSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .invalidateApprovalRequestSettings()
+ .setRetrySettings(invalidateApprovalRequestRetrySettings);
+
+ RetrySettings getAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessApprovalSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getAccessApprovalSettingsSettings()
+ .setRetrySettings(getAccessApprovalSettingsRetrySettings);
+
+ RetrySettings updateAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAccessApprovalSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateAccessApprovalSettingsSettings()
+ .setRetrySettings(updateAccessApprovalSettingsRetrySettings);
+
+ RetrySettings deleteAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAccessApprovalSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteAccessApprovalSettingsSettings()
+ .setRetrySettings(deleteAccessApprovalSettingsRetrySettings);
+
+ RetrySettings getAccessApprovalServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessApprovalServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getAccessApprovalServiceAccountSettings()
+ .setRetrySettings(getAccessApprovalServiceAccountRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listApprovalRequestsRetry = clientProperties.getListApprovalRequestsRetry();
+ if (listApprovalRequestsRetry != null) {
+ RetrySettings listApprovalRequestsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApprovalRequestsSettings().getRetrySettings(),
+ listApprovalRequestsRetry);
+ clientSettingsBuilder
+ .listApprovalRequestsSettings()
+ .setRetrySettings(listApprovalRequestsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listApprovalRequests from properties.");
+ }
+ }
+ Retry getApprovalRequestRetry = clientProperties.getGetApprovalRequestRetry();
+ if (getApprovalRequestRetry != null) {
+ RetrySettings getApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApprovalRequestSettings().getRetrySettings(),
+ getApprovalRequestRetry);
+ clientSettingsBuilder
+ .getApprovalRequestSettings()
+ .setRetrySettings(getApprovalRequestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getApprovalRequest from properties.");
+ }
+ }
+ Retry approveApprovalRequestRetry = clientProperties.getApproveApprovalRequestRetry();
+ if (approveApprovalRequestRetry != null) {
+ RetrySettings approveApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.approveApprovalRequestSettings().getRetrySettings(),
+ approveApprovalRequestRetry);
+ clientSettingsBuilder
+ .approveApprovalRequestSettings()
+ .setRetrySettings(approveApprovalRequestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for approveApprovalRequest from properties.");
+ }
+ }
+ Retry dismissApprovalRequestRetry = clientProperties.getDismissApprovalRequestRetry();
+ if (dismissApprovalRequestRetry != null) {
+ RetrySettings dismissApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.dismissApprovalRequestSettings().getRetrySettings(),
+ dismissApprovalRequestRetry);
+ clientSettingsBuilder
+ .dismissApprovalRequestSettings()
+ .setRetrySettings(dismissApprovalRequestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for dismissApprovalRequest from properties.");
+ }
+ }
+ Retry invalidateApprovalRequestRetry = clientProperties.getInvalidateApprovalRequestRetry();
+ if (invalidateApprovalRequestRetry != null) {
+ RetrySettings invalidateApprovalRequestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.invalidateApprovalRequestSettings().getRetrySettings(),
+ invalidateApprovalRequestRetry);
+ clientSettingsBuilder
+ .invalidateApprovalRequestSettings()
+ .setRetrySettings(invalidateApprovalRequestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for invalidateApprovalRequest from properties.");
+ }
+ }
+ Retry getAccessApprovalSettingsRetry = clientProperties.getGetAccessApprovalSettingsRetry();
+ if (getAccessApprovalSettingsRetry != null) {
+ RetrySettings getAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessApprovalSettingsSettings().getRetrySettings(),
+ getAccessApprovalSettingsRetry);
+ clientSettingsBuilder
+ .getAccessApprovalSettingsSettings()
+ .setRetrySettings(getAccessApprovalSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getAccessApprovalSettings from properties.");
+ }
+ }
+ Retry updateAccessApprovalSettingsRetry =
+ clientProperties.getUpdateAccessApprovalSettingsRetry();
+ if (updateAccessApprovalSettingsRetry != null) {
+ RetrySettings updateAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAccessApprovalSettingsSettings().getRetrySettings(),
+ updateAccessApprovalSettingsRetry);
+ clientSettingsBuilder
+ .updateAccessApprovalSettingsSettings()
+ .setRetrySettings(updateAccessApprovalSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateAccessApprovalSettings from properties.");
+ }
+ }
+ Retry deleteAccessApprovalSettingsRetry =
+ clientProperties.getDeleteAccessApprovalSettingsRetry();
+ if (deleteAccessApprovalSettingsRetry != null) {
+ RetrySettings deleteAccessApprovalSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAccessApprovalSettingsSettings().getRetrySettings(),
+ deleteAccessApprovalSettingsRetry);
+ clientSettingsBuilder
+ .deleteAccessApprovalSettingsSettings()
+ .setRetrySettings(deleteAccessApprovalSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteAccessApprovalSettings from properties.");
+ }
+ }
+ Retry getAccessApprovalServiceAccountRetry =
+ clientProperties.getGetAccessApprovalServiceAccountRetry();
+ if (getAccessApprovalServiceAccountRetry != null) {
+ RetrySettings getAccessApprovalServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessApprovalServiceAccountSettings().getRetrySettings(),
+ getAccessApprovalServiceAccountRetry);
+ clientSettingsBuilder
+ .getAccessApprovalServiceAccountSettings()
+ .setRetrySettings(getAccessApprovalServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getAccessApprovalServiceAccount from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a AccessApprovalClient bean configured with AccessApprovalSettings.
+ *
+ * @param accessApprovalSettings settings to configure an instance of client bean.
+ * @return a {@link AccessApprovalClient} bean configured with {@link AccessApprovalSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AccessApprovalAdminClient accessApprovalClient(
+ AccessApprovalAdminSettings accessApprovalSettings) throws IOException {
+ return AccessApprovalAdminClient.create(accessApprovalSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-access-approval";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringProperties.java b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringProperties.java
new file mode 100644
index 0000000000..5ec6b8cf57
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/AccessApprovalSpringProperties.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2022 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.accessapproval.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 AccessApproval client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.accessapproval.v1.access-approval")
+public class AccessApprovalSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listApprovalRequests. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listApprovalRequestsRetry;
+ /**
+ * Allow override of retry settings at method-level for getApprovalRequest. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getApprovalRequestRetry;
+ /**
+ * Allow override of retry settings at method-level for approveApprovalRequest. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry approveApprovalRequestRetry;
+ /**
+ * Allow override of retry settings at method-level for dismissApprovalRequest. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry dismissApprovalRequestRetry;
+ /**
+ * Allow override of retry settings at method-level for invalidateApprovalRequest. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry invalidateApprovalRequestRetry;
+ /**
+ * Allow override of retry settings at method-level for getAccessApprovalSettings. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAccessApprovalSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateAccessApprovalSettings. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateAccessApprovalSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteAccessApprovalSettings. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteAccessApprovalSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for getAccessApprovalServiceAccount. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAccessApprovalServiceAccountRetry;
+
+ @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 getListApprovalRequestsRetry() {
+ return this.listApprovalRequestsRetry;
+ }
+
+ public void setListApprovalRequestsRetry(Retry listApprovalRequestsRetry) {
+ this.listApprovalRequestsRetry = listApprovalRequestsRetry;
+ }
+
+ public Retry getGetApprovalRequestRetry() {
+ return this.getApprovalRequestRetry;
+ }
+
+ public void setGetApprovalRequestRetry(Retry getApprovalRequestRetry) {
+ this.getApprovalRequestRetry = getApprovalRequestRetry;
+ }
+
+ public Retry getApproveApprovalRequestRetry() {
+ return this.approveApprovalRequestRetry;
+ }
+
+ public void setApproveApprovalRequestRetry(Retry approveApprovalRequestRetry) {
+ this.approveApprovalRequestRetry = approveApprovalRequestRetry;
+ }
+
+ public Retry getDismissApprovalRequestRetry() {
+ return this.dismissApprovalRequestRetry;
+ }
+
+ public void setDismissApprovalRequestRetry(Retry dismissApprovalRequestRetry) {
+ this.dismissApprovalRequestRetry = dismissApprovalRequestRetry;
+ }
+
+ public Retry getInvalidateApprovalRequestRetry() {
+ return this.invalidateApprovalRequestRetry;
+ }
+
+ public void setInvalidateApprovalRequestRetry(Retry invalidateApprovalRequestRetry) {
+ this.invalidateApprovalRequestRetry = invalidateApprovalRequestRetry;
+ }
+
+ public Retry getGetAccessApprovalSettingsRetry() {
+ return this.getAccessApprovalSettingsRetry;
+ }
+
+ public void setGetAccessApprovalSettingsRetry(Retry getAccessApprovalSettingsRetry) {
+ this.getAccessApprovalSettingsRetry = getAccessApprovalSettingsRetry;
+ }
+
+ public Retry getUpdateAccessApprovalSettingsRetry() {
+ return this.updateAccessApprovalSettingsRetry;
+ }
+
+ public void setUpdateAccessApprovalSettingsRetry(Retry updateAccessApprovalSettingsRetry) {
+ this.updateAccessApprovalSettingsRetry = updateAccessApprovalSettingsRetry;
+ }
+
+ public Retry getDeleteAccessApprovalSettingsRetry() {
+ return this.deleteAccessApprovalSettingsRetry;
+ }
+
+ public void setDeleteAccessApprovalSettingsRetry(Retry deleteAccessApprovalSettingsRetry) {
+ this.deleteAccessApprovalSettingsRetry = deleteAccessApprovalSettingsRetry;
+ }
+
+ public Retry getGetAccessApprovalServiceAccountRetry() {
+ return this.getAccessApprovalServiceAccountRetry;
+ }
+
+ public void setGetAccessApprovalServiceAccountRetry(Retry getAccessApprovalServiceAccountRetry) {
+ this.getAccessApprovalServiceAccountRetry = getAccessApprovalServiceAccountRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/package-info.java
new file mode 100644
index 0000000000..ff51d5f02a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/java/com/google/cloud/accessapproval/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for accessapproval. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.accessapproval.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..34e777d986
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.accessapproval.v1.access-approval.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud accessapproval/AccessApproval components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1352ace403
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-accessapproval-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.accessapproval.v1.spring.AccessApprovalSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/pom.xml
new file mode 100644
index 0000000000..8005b3838d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DatasetServiceSpringProperties. 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 DatasetServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DatasetServiceSettings datasetServiceSettings( + @Qualifier("defaultDatasetServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DatasetServiceSettings.Builder clientSettingsBuilder = DatasetServiceSettings.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 = + DatasetServiceSettings.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 getDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDatasetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDatasetSettings().setRetrySettings(getDatasetRetrySettings); + + RetrySettings updateDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateDatasetSettings().setRetrySettings(updateDatasetRetrySettings); + + RetrySettings listDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDatasetsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDatasetsSettings().setRetrySettings(listDatasetsRetrySettings); + + RetrySettings listDataItemsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataItemsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDataItemsSettings().setRetrySettings(listDataItemsRetrySettings); + + RetrySettings searchDataItemsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchDataItemsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .searchDataItemsSettings() + .setRetrySettings(searchDataItemsRetrySettings); + + RetrySettings listSavedQueriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSavedQueriesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listSavedQueriesSettings() + .setRetrySettings(listSavedQueriesRetrySettings); + + RetrySettings getAnnotationSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnnotationSpecSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getAnnotationSpecSettings() + .setRetrySettings(getAnnotationSpecRetrySettings); + + RetrySettings listAnnotationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAnnotationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listAnnotationsSettings() + .setRetrySettings(listAnnotationsRetrySettings); + + 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 getDatasetRetry = clientProperties.getGetDatasetRetry(); + if (getDatasetRetry != null) { + RetrySettings getDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDatasetSettings().getRetrySettings(), getDatasetRetry); + clientSettingsBuilder.getDatasetSettings().setRetrySettings(getDatasetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataset from properties."); + } + } + Retry updateDatasetRetry = clientProperties.getUpdateDatasetRetry(); + if (updateDatasetRetry != null) { + RetrySettings updateDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetSettings().getRetrySettings(), updateDatasetRetry); + clientSettingsBuilder.updateDatasetSettings().setRetrySettings(updateDatasetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateDataset from properties."); + } + } + Retry listDatasetsRetry = clientProperties.getListDatasetsRetry(); + if (listDatasetsRetry != null) { + RetrySettings listDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDatasetsSettings().getRetrySettings(), listDatasetsRetry); + clientSettingsBuilder.listDatasetsSettings().setRetrySettings(listDatasetsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDatasets from properties."); + } + } + Retry listDataItemsRetry = clientProperties.getListDataItemsRetry(); + if (listDataItemsRetry != null) { + RetrySettings listDataItemsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataItemsSettings().getRetrySettings(), listDataItemsRetry); + clientSettingsBuilder.listDataItemsSettings().setRetrySettings(listDataItemsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDataItems from properties."); + } + } + Retry searchDataItemsRetry = clientProperties.getSearchDataItemsRetry(); + if (searchDataItemsRetry != null) { + RetrySettings searchDataItemsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchDataItemsSettings().getRetrySettings(), + searchDataItemsRetry); + clientSettingsBuilder + .searchDataItemsSettings() + .setRetrySettings(searchDataItemsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchDataItems from properties."); + } + } + Retry listSavedQueriesRetry = clientProperties.getListSavedQueriesRetry(); + if (listSavedQueriesRetry != null) { + RetrySettings listSavedQueriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSavedQueriesSettings().getRetrySettings(), + listSavedQueriesRetry); + clientSettingsBuilder + .listSavedQueriesSettings() + .setRetrySettings(listSavedQueriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSavedQueries from properties."); + } + } + Retry getAnnotationSpecRetry = clientProperties.getGetAnnotationSpecRetry(); + if (getAnnotationSpecRetry != null) { + RetrySettings getAnnotationSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnnotationSpecSettings().getRetrySettings(), + getAnnotationSpecRetry); + clientSettingsBuilder + .getAnnotationSpecSettings() + .setRetrySettings(getAnnotationSpecRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAnnotationSpec from properties."); + } + } + Retry listAnnotationsRetry = clientProperties.getListAnnotationsRetry(); + if (listAnnotationsRetry != null) { + RetrySettings listAnnotationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAnnotationsSettings().getRetrySettings(), + listAnnotationsRetry); + clientSettingsBuilder + .listAnnotationsSettings() + .setRetrySettings(listAnnotationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listAnnotations 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 DatasetServiceClient bean configured with DatasetServiceSettings. + * + * @param datasetServiceSettings settings to configure an instance of client bean. + * @return a {@link DatasetServiceClient} bean configured with {@link DatasetServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DatasetServiceClient datasetServiceClient(DatasetServiceSettings datasetServiceSettings) + throws IOException { + return DatasetServiceClient.create(datasetServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-dataset-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/DatasetServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java new file mode 100644 index 0000000000..f3fc90613f --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/DatasetServiceSpringProperties.java @@ -0,0 +1,241 @@ +/* + * Copyright 2022 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 DatasetService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.dataset-service") +public class DatasetServiceSpringProperties 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 getDataset. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDatasetRetry; + /** + * Allow override of retry settings at method-level for updateDataset. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDatasetRetry; + /** + * Allow override of retry settings at method-level for listDatasets. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDatasetsRetry; + /** + * Allow override of retry settings at method-level for listDataItems. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataItemsRetry; + /** + * Allow override of retry settings at method-level for searchDataItems. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchDataItemsRetry; + /** + * Allow override of retry settings at method-level for listSavedQueries. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSavedQueriesRetry; + /** + * Allow override of retry settings at method-level for getAnnotationSpec. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAnnotationSpecRetry; + /** + * Allow override of retry settings at method-level for listAnnotations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAnnotationsRetry; + /** + * 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 getGetDatasetRetry() { + return this.getDatasetRetry; + } + + public void setGetDatasetRetry(Retry getDatasetRetry) { + this.getDatasetRetry = getDatasetRetry; + } + + public Retry getUpdateDatasetRetry() { + return this.updateDatasetRetry; + } + + public void setUpdateDatasetRetry(Retry updateDatasetRetry) { + this.updateDatasetRetry = updateDatasetRetry; + } + + public Retry getListDatasetsRetry() { + return this.listDatasetsRetry; + } + + public void setListDatasetsRetry(Retry listDatasetsRetry) { + this.listDatasetsRetry = listDatasetsRetry; + } + + public Retry getListDataItemsRetry() { + return this.listDataItemsRetry; + } + + public void setListDataItemsRetry(Retry listDataItemsRetry) { + this.listDataItemsRetry = listDataItemsRetry; + } + + public Retry getSearchDataItemsRetry() { + return this.searchDataItemsRetry; + } + + public void setSearchDataItemsRetry(Retry searchDataItemsRetry) { + this.searchDataItemsRetry = searchDataItemsRetry; + } + + public Retry getListSavedQueriesRetry() { + return this.listSavedQueriesRetry; + } + + public void setListSavedQueriesRetry(Retry listSavedQueriesRetry) { + this.listSavedQueriesRetry = listSavedQueriesRetry; + } + + public Retry getGetAnnotationSpecRetry() { + return this.getAnnotationSpecRetry; + } + + public void setGetAnnotationSpecRetry(Retry getAnnotationSpecRetry) { + this.getAnnotationSpecRetry = getAnnotationSpecRetry; + } + + public Retry getListAnnotationsRetry() { + return this.listAnnotationsRetry; + } + + public void setListAnnotationsRetry(Retry listAnnotationsRetry) { + this.listAnnotationsRetry = listAnnotationsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..7cb0a5a9bc --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringAutoConfiguration.java @@ -0,0 +1,302 @@ +/* + * Copyright 2022 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.EndpointServiceClient; +import com.google.cloud.aiplatform.v1.EndpointServiceSettings; +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 EndpointServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in EndpointServiceSpringProperties. 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 EndpointServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EndpointServiceSettings endpointServiceSettings( + @Qualifier("defaultEndpointServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EndpointServiceSettings.Builder clientSettingsBuilder = EndpointServiceSettings.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 = + EndpointServiceSettings.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 getEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEndpointSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings); + + RetrySettings listEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings); + + RetrySettings updateEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEndpointSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateEndpointSettings().setRetrySettings(updateEndpointRetrySettings); + + 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 getEndpointRetry = clientProperties.getGetEndpointRetry(); + if (getEndpointRetry != null) { + RetrySettings getEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEndpointSettings().getRetrySettings(), getEndpointRetry); + clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEndpoint from properties."); + } + } + Retry listEndpointsRetry = clientProperties.getListEndpointsRetry(); + if (listEndpointsRetry != null) { + RetrySettings listEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), listEndpointsRetry); + clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEndpoints from properties."); + } + } + Retry updateEndpointRetry = clientProperties.getUpdateEndpointRetry(); + if (updateEndpointRetry != null) { + RetrySettings updateEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEndpointSettings().getRetrySettings(), + updateEndpointRetry); + clientSettingsBuilder.updateEndpointSettings().setRetrySettings(updateEndpointRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateEndpoint 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 EndpointServiceClient bean configured with EndpointServiceSettings. + * + * @param endpointServiceSettings settings to configure an instance of client bean. + * @return a {@link EndpointServiceClient} bean configured with {@link EndpointServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public EndpointServiceClient endpointServiceClient( + EndpointServiceSettings endpointServiceSettings) throws IOException { + return EndpointServiceClient.create(endpointServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-endpoint-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/EndpointServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringProperties.java new file mode 100644 index 0000000000..d849c9b62b --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/EndpointServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * Copyright 2022 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 EndpointService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.endpoint-service") +public class EndpointServiceSpringProperties 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 getEndpoint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEndpointRetry; + /** + * Allow override of retry settings at method-level for listEndpoints. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEndpointsRetry; + /** + * Allow override of retry settings at method-level for updateEndpoint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEndpointRetry; + /** + * 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 getGetEndpointRetry() { + return this.getEndpointRetry; + } + + public void setGetEndpointRetry(Retry getEndpointRetry) { + this.getEndpointRetry = getEndpointRetry; + } + + public Retry getListEndpointsRetry() { + return this.listEndpointsRetry; + } + + public void setListEndpointsRetry(Retry listEndpointsRetry) { + this.listEndpointsRetry = listEndpointsRetry; + } + + public Retry getUpdateEndpointRetry() { + return this.updateEndpointRetry; + } + + public void setUpdateEndpointRetry(Retry updateEndpointRetry) { + this.updateEndpointRetry = updateEndpointRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..7f7aa8907c --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringAutoConfiguration.java @@ -0,0 +1,309 @@ +/* + * Copyright 2022 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.FeaturestoreOnlineServingServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceSettings; +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 FeaturestoreOnlineServingServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in FeaturestoreOnlineServingServiceSpringProperties. 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 FeaturestoreOnlineServingServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings( + @Qualifier("defaultFeaturestoreOnlineServingServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + FeaturestoreOnlineServingServiceSettings.Builder clientSettingsBuilder = + FeaturestoreOnlineServingServiceSettings.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 = + FeaturestoreOnlineServingServiceSettings.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 readFeatureValuesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.readFeatureValuesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings(readFeatureValuesRetrySettings); + + RetrySettings writeFeatureValuesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeFeatureValuesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .writeFeatureValuesSettings() + .setRetrySettings(writeFeatureValuesRetrySettings); + + 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 readFeatureValuesRetry = clientProperties.getReadFeatureValuesRetry(); + if (readFeatureValuesRetry != null) { + RetrySettings readFeatureValuesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.readFeatureValuesSettings().getRetrySettings(), + readFeatureValuesRetry); + clientSettingsBuilder + .readFeatureValuesSettings() + .setRetrySettings(readFeatureValuesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for readFeatureValues from properties."); + } + } + Retry writeFeatureValuesRetry = clientProperties.getWriteFeatureValuesRetry(); + if (writeFeatureValuesRetry != null) { + RetrySettings writeFeatureValuesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeFeatureValuesSettings().getRetrySettings(), + writeFeatureValuesRetry); + clientSettingsBuilder + .writeFeatureValuesSettings() + .setRetrySettings(writeFeatureValuesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for writeFeatureValues 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 FeaturestoreOnlineServingServiceClient bean configured with + * FeaturestoreOnlineServingServiceSettings. + * + * @param featurestoreOnlineServingServiceSettings settings to configure an instance of client + * bean. + * @return a {@link FeaturestoreOnlineServingServiceClient} bean configured with {@link + * FeaturestoreOnlineServingServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient( + FeaturestoreOnlineServingServiceSettings featurestoreOnlineServingServiceSettings) + throws IOException { + return FeaturestoreOnlineServingServiceClient.create(featurestoreOnlineServingServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-featurestore-online-serving-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/FeaturestoreOnlineServingServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringProperties.java new file mode 100644 index 0000000000..a70d9eb823 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreOnlineServingServiceSpringProperties.java @@ -0,0 +1,163 @@ +/* + * Copyright 2022 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 FeaturestoreOnlineServingService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.featurestore-online-serving-service") +public class FeaturestoreOnlineServingServiceSpringProperties 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 readFeatureValues. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry readFeatureValuesRetry; + /** + * Allow override of retry settings at method-level for writeFeatureValues. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry writeFeatureValuesRetry; + /** + * 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 getReadFeatureValuesRetry() { + return this.readFeatureValuesRetry; + } + + public void setReadFeatureValuesRetry(Retry readFeatureValuesRetry) { + this.readFeatureValuesRetry = readFeatureValuesRetry; + } + + public Retry getWriteFeatureValuesRetry() { + return this.writeFeatureValuesRetry; + } + + public void setWriteFeatureValuesRetry(Retry writeFeatureValuesRetry) { + this.writeFeatureValuesRetry = writeFeatureValuesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4bad22fad9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringAutoConfiguration.java @@ -0,0 +1,417 @@ +/* + * Copyright 2022 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.FeaturestoreServiceClient; +import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings; +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 FeaturestoreServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in FeaturestoreServiceSpringProperties. 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 FeaturestoreServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public FeaturestoreServiceSettings featurestoreServiceSettings( + @Qualifier("defaultFeaturestoreServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + FeaturestoreServiceSettings.Builder clientSettingsBuilder = + FeaturestoreServiceSettings.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 = + FeaturestoreServiceSettings.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 getFeaturestoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFeaturestoreSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings(getFeaturestoreRetrySettings); + + RetrySettings listFeaturestoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFeaturestoresSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listFeaturestoresSettings() + .setRetrySettings(listFeaturestoresRetrySettings); + + RetrySettings getEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEntityTypeSettings().setRetrySettings(getEntityTypeRetrySettings); + + RetrySettings listEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntityTypesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEntityTypesSettings() + .setRetrySettings(listEntityTypesRetrySettings); + + RetrySettings updateEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateEntityTypeSettings() + .setRetrySettings(updateEntityTypeRetrySettings); + + RetrySettings getFeatureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFeatureSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getFeatureSettings().setRetrySettings(getFeatureRetrySettings); + + RetrySettings listFeaturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFeaturesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listFeaturesSettings().setRetrySettings(listFeaturesRetrySettings); + + RetrySettings updateFeatureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateFeatureSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateFeatureSettings().setRetrySettings(updateFeatureRetrySettings); + + RetrySettings searchFeaturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchFeaturesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchFeaturesSettings().setRetrySettings(searchFeaturesRetrySettings); + + 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 getFeaturestoreRetry = clientProperties.getGetFeaturestoreRetry(); + if (getFeaturestoreRetry != null) { + RetrySettings getFeaturestoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFeaturestoreSettings().getRetrySettings(), + getFeaturestoreRetry); + clientSettingsBuilder + .getFeaturestoreSettings() + .setRetrySettings(getFeaturestoreRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getFeaturestore from properties."); + } + } + Retry listFeaturestoresRetry = clientProperties.getListFeaturestoresRetry(); + if (listFeaturestoresRetry != null) { + RetrySettings listFeaturestoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFeaturestoresSettings().getRetrySettings(), + listFeaturestoresRetry); + clientSettingsBuilder + .listFeaturestoresSettings() + .setRetrySettings(listFeaturestoresRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listFeaturestores from properties."); + } + } + Retry getEntityTypeRetry = clientProperties.getGetEntityTypeRetry(); + if (getEntityTypeRetry != null) { + RetrySettings getEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntityTypeSettings().getRetrySettings(), getEntityTypeRetry); + clientSettingsBuilder.getEntityTypeSettings().setRetrySettings(getEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEntityType from properties."); + } + } + Retry listEntityTypesRetry = clientProperties.getListEntityTypesRetry(); + if (listEntityTypesRetry != null) { + RetrySettings listEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntityTypesSettings().getRetrySettings(), + listEntityTypesRetry); + clientSettingsBuilder + .listEntityTypesSettings() + .setRetrySettings(listEntityTypesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEntityTypes from properties."); + } + } + Retry updateEntityTypeRetry = clientProperties.getUpdateEntityTypeRetry(); + if (updateEntityTypeRetry != null) { + RetrySettings updateEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntityTypeSettings().getRetrySettings(), + updateEntityTypeRetry); + clientSettingsBuilder + .updateEntityTypeSettings() + .setRetrySettings(updateEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateEntityType from properties."); + } + } + Retry getFeatureRetry = clientProperties.getGetFeatureRetry(); + if (getFeatureRetry != null) { + RetrySettings getFeatureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFeatureSettings().getRetrySettings(), getFeatureRetry); + clientSettingsBuilder.getFeatureSettings().setRetrySettings(getFeatureRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getFeature from properties."); + } + } + Retry listFeaturesRetry = clientProperties.getListFeaturesRetry(); + if (listFeaturesRetry != null) { + RetrySettings listFeaturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFeaturesSettings().getRetrySettings(), listFeaturesRetry); + clientSettingsBuilder.listFeaturesSettings().setRetrySettings(listFeaturesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listFeatures from properties."); + } + } + Retry updateFeatureRetry = clientProperties.getUpdateFeatureRetry(); + if (updateFeatureRetry != null) { + RetrySettings updateFeatureRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateFeatureSettings().getRetrySettings(), updateFeatureRetry); + clientSettingsBuilder.updateFeatureSettings().setRetrySettings(updateFeatureRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateFeature from properties."); + } + } + Retry searchFeaturesRetry = clientProperties.getSearchFeaturesRetry(); + if (searchFeaturesRetry != null) { + RetrySettings searchFeaturesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchFeaturesSettings().getRetrySettings(), + searchFeaturesRetry); + clientSettingsBuilder.searchFeaturesSettings().setRetrySettings(searchFeaturesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchFeatures 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 FeaturestoreServiceClient bean configured with FeaturestoreServiceSettings. + * + * @param featurestoreServiceSettings settings to configure an instance of client bean. + * @return a {@link FeaturestoreServiceClient} bean configured with {@link + * FeaturestoreServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public FeaturestoreServiceClient featurestoreServiceClient( + FeaturestoreServiceSettings featurestoreServiceSettings) throws IOException { + return FeaturestoreServiceClient.create(featurestoreServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-featurestore-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/FeaturestoreServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringProperties.java new file mode 100644 index 0000000000..4dbc497121 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/FeaturestoreServiceSpringProperties.java @@ -0,0 +1,254 @@ +/* + * Copyright 2022 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 FeaturestoreService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.featurestore-service") +public class FeaturestoreServiceSpringProperties 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 getFeaturestore. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getFeaturestoreRetry; + /** + * Allow override of retry settings at method-level for listFeaturestores. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listFeaturestoresRetry; + /** + * Allow override of retry settings at method-level for getEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEntityTypeRetry; + /** + * Allow override of retry settings at method-level for listEntityTypes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEntityTypesRetry; + /** + * Allow override of retry settings at method-level for updateEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEntityTypeRetry; + /** + * Allow override of retry settings at method-level for getFeature. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getFeatureRetry; + /** + * Allow override of retry settings at method-level for listFeatures. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listFeaturesRetry; + /** + * Allow override of retry settings at method-level for updateFeature. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateFeatureRetry; + /** + * Allow override of retry settings at method-level for searchFeatures. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchFeaturesRetry; + /** + * 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 getGetFeaturestoreRetry() { + return this.getFeaturestoreRetry; + } + + public void setGetFeaturestoreRetry(Retry getFeaturestoreRetry) { + this.getFeaturestoreRetry = getFeaturestoreRetry; + } + + public Retry getListFeaturestoresRetry() { + return this.listFeaturestoresRetry; + } + + public void setListFeaturestoresRetry(Retry listFeaturestoresRetry) { + this.listFeaturestoresRetry = listFeaturestoresRetry; + } + + public Retry getGetEntityTypeRetry() { + return this.getEntityTypeRetry; + } + + public void setGetEntityTypeRetry(Retry getEntityTypeRetry) { + this.getEntityTypeRetry = getEntityTypeRetry; + } + + public Retry getListEntityTypesRetry() { + return this.listEntityTypesRetry; + } + + public void setListEntityTypesRetry(Retry listEntityTypesRetry) { + this.listEntityTypesRetry = listEntityTypesRetry; + } + + public Retry getUpdateEntityTypeRetry() { + return this.updateEntityTypeRetry; + } + + public void setUpdateEntityTypeRetry(Retry updateEntityTypeRetry) { + this.updateEntityTypeRetry = updateEntityTypeRetry; + } + + public Retry getGetFeatureRetry() { + return this.getFeatureRetry; + } + + public void setGetFeatureRetry(Retry getFeatureRetry) { + this.getFeatureRetry = getFeatureRetry; + } + + public Retry getListFeaturesRetry() { + return this.listFeaturesRetry; + } + + public void setListFeaturesRetry(Retry listFeaturesRetry) { + this.listFeaturesRetry = listFeaturesRetry; + } + + public Retry getUpdateFeatureRetry() { + return this.updateFeatureRetry; + } + + public void setUpdateFeatureRetry(Retry updateFeatureRetry) { + this.updateFeatureRetry = updateFeatureRetry; + } + + public Retry getSearchFeaturesRetry() { + return this.searchFeaturesRetry; + } + + public void setSearchFeaturesRetry(Retry searchFeaturesRetry) { + this.searchFeaturesRetry = searchFeaturesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..9c67264aa5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringAutoConfiguration.java @@ -0,0 +1,323 @@ +/* + * Copyright 2022 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.IndexEndpointServiceClient; +import com.google.cloud.aiplatform.v1.IndexEndpointServiceSettings; +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 IndexEndpointServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in IndexEndpointServiceSpringProperties. 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 IndexEndpointServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public IndexEndpointServiceSettings indexEndpointServiceSettings( + @Qualifier("defaultIndexEndpointServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + IndexEndpointServiceSettings.Builder clientSettingsBuilder = + IndexEndpointServiceSettings.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 = + IndexEndpointServiceSettings.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 getIndexEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIndexEndpointSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings(getIndexEndpointRetrySettings); + + RetrySettings listIndexEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIndexEndpointsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listIndexEndpointsSettings() + .setRetrySettings(listIndexEndpointsRetrySettings); + + RetrySettings updateIndexEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIndexEndpointSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateIndexEndpointSettings() + .setRetrySettings(updateIndexEndpointRetrySettings); + + 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 getIndexEndpointRetry = clientProperties.getGetIndexEndpointRetry(); + if (getIndexEndpointRetry != null) { + RetrySettings getIndexEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIndexEndpointSettings().getRetrySettings(), + getIndexEndpointRetry); + clientSettingsBuilder + .getIndexEndpointSettings() + .setRetrySettings(getIndexEndpointRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getIndexEndpoint from properties."); + } + } + Retry listIndexEndpointsRetry = clientProperties.getListIndexEndpointsRetry(); + if (listIndexEndpointsRetry != null) { + RetrySettings listIndexEndpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIndexEndpointsSettings().getRetrySettings(), + listIndexEndpointsRetry); + clientSettingsBuilder + .listIndexEndpointsSettings() + .setRetrySettings(listIndexEndpointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listIndexEndpoints from properties."); + } + } + Retry updateIndexEndpointRetry = clientProperties.getUpdateIndexEndpointRetry(); + if (updateIndexEndpointRetry != null) { + RetrySettings updateIndexEndpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIndexEndpointSettings().getRetrySettings(), + updateIndexEndpointRetry); + clientSettingsBuilder + .updateIndexEndpointSettings() + .setRetrySettings(updateIndexEndpointRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateIndexEndpoint 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 IndexEndpointServiceClient bean configured with IndexEndpointServiceSettings. + * + * @param indexEndpointServiceSettings settings to configure an instance of client bean. + * @return a {@link IndexEndpointServiceClient} bean configured with {@link + * IndexEndpointServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public IndexEndpointServiceClient indexEndpointServiceClient( + IndexEndpointServiceSettings indexEndpointServiceSettings) throws IOException { + return IndexEndpointServiceClient.create(indexEndpointServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-index-endpoint-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/IndexEndpointServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringProperties.java new file mode 100644 index 0000000000..be15a7850a --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexEndpointServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * Copyright 2022 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 IndexEndpointService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.index-endpoint-service") +public class IndexEndpointServiceSpringProperties 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 getIndexEndpoint. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIndexEndpointRetry; + /** + * Allow override of retry settings at method-level for listIndexEndpoints. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listIndexEndpointsRetry; + /** + * Allow override of retry settings at method-level for updateIndexEndpoint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateIndexEndpointRetry; + /** + * 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 getGetIndexEndpointRetry() { + return this.getIndexEndpointRetry; + } + + public void setGetIndexEndpointRetry(Retry getIndexEndpointRetry) { + this.getIndexEndpointRetry = getIndexEndpointRetry; + } + + public Retry getListIndexEndpointsRetry() { + return this.listIndexEndpointsRetry; + } + + public void setListIndexEndpointsRetry(Retry listIndexEndpointsRetry) { + this.listIndexEndpointsRetry = listIndexEndpointsRetry; + } + + public Retry getUpdateIndexEndpointRetry() { + return this.updateIndexEndpointRetry; + } + + public void setUpdateIndexEndpointRetry(Retry updateIndexEndpointRetry) { + this.updateIndexEndpointRetry = updateIndexEndpointRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..f8e5e33c81 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringAutoConfiguration.java @@ -0,0 +1,328 @@ +/* + * Copyright 2022 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.IndexServiceClient; +import com.google.cloud.aiplatform.v1.IndexServiceSettings; +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 IndexServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in IndexServiceSpringProperties. 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 IndexServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public IndexServiceSettings indexServiceSettings( + @Qualifier("defaultIndexServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + IndexServiceSettings.Builder clientSettingsBuilder = IndexServiceSettings.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 = + IndexServiceSettings.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 getIndexRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIndexSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIndexSettings().setRetrySettings(getIndexRetrySettings); + + RetrySettings listIndexesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIndexesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listIndexesSettings().setRetrySettings(listIndexesRetrySettings); + + RetrySettings upsertDatapointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.upsertDatapointsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .upsertDatapointsSettings() + .setRetrySettings(upsertDatapointsRetrySettings); + + RetrySettings removeDatapointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeDatapointsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .removeDatapointsSettings() + .setRetrySettings(removeDatapointsRetrySettings); + + 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 getIndexRetry = clientProperties.getGetIndexRetry(); + if (getIndexRetry != null) { + RetrySettings getIndexRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIndexSettings().getRetrySettings(), getIndexRetry); + clientSettingsBuilder.getIndexSettings().setRetrySettings(getIndexRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIndex from properties."); + } + } + Retry listIndexesRetry = clientProperties.getListIndexesRetry(); + if (listIndexesRetry != null) { + RetrySettings listIndexesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIndexesSettings().getRetrySettings(), listIndexesRetry); + clientSettingsBuilder.listIndexesSettings().setRetrySettings(listIndexesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listIndexes from properties."); + } + } + Retry upsertDatapointsRetry = clientProperties.getUpsertDatapointsRetry(); + if (upsertDatapointsRetry != null) { + RetrySettings upsertDatapointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.upsertDatapointsSettings().getRetrySettings(), + upsertDatapointsRetry); + clientSettingsBuilder + .upsertDatapointsSettings() + .setRetrySettings(upsertDatapointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for upsertDatapoints from properties."); + } + } + Retry removeDatapointsRetry = clientProperties.getRemoveDatapointsRetry(); + if (removeDatapointsRetry != null) { + RetrySettings removeDatapointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeDatapointsSettings().getRetrySettings(), + removeDatapointsRetry); + clientSettingsBuilder + .removeDatapointsSettings() + .setRetrySettings(removeDatapointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for removeDatapoints 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 IndexServiceClient bean configured with IndexServiceSettings. + * + * @param indexServiceSettings settings to configure an instance of client bean. + * @return a {@link IndexServiceClient} bean configured with {@link IndexServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public IndexServiceClient indexServiceClient(IndexServiceSettings indexServiceSettings) + throws IOException { + return IndexServiceClient.create(indexServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-index-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/IndexServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringProperties.java new file mode 100644 index 0000000000..b2c8cc11a7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/IndexServiceSpringProperties.java @@ -0,0 +1,189 @@ +/* + * Copyright 2022 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 IndexService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.index-service") +public class IndexServiceSpringProperties 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 getIndex. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIndexRetry; + /** + * Allow override of retry settings at method-level for listIndexes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listIndexesRetry; + /** + * Allow override of retry settings at method-level for upsertDatapoints. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry upsertDatapointsRetry; + /** + * Allow override of retry settings at method-level for removeDatapoints. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry removeDatapointsRetry; + /** + * 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 getGetIndexRetry() { + return this.getIndexRetry; + } + + public void setGetIndexRetry(Retry getIndexRetry) { + this.getIndexRetry = getIndexRetry; + } + + public Retry getListIndexesRetry() { + return this.listIndexesRetry; + } + + public void setListIndexesRetry(Retry listIndexesRetry) { + this.listIndexesRetry = listIndexesRetry; + } + + public Retry getUpsertDatapointsRetry() { + return this.upsertDatapointsRetry; + } + + public void setUpsertDatapointsRetry(Retry upsertDatapointsRetry) { + this.upsertDatapointsRetry = upsertDatapointsRetry; + } + + public Retry getRemoveDatapointsRetry() { + return this.removeDatapointsRetry; + } + + public void setRemoveDatapointsRetry(Retry removeDatapointsRetry) { + this.removeDatapointsRetry = removeDatapointsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..cefa8747d4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringAutoConfiguration.java @@ -0,0 +1,734 @@ +/* + * Copyright 2022 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.JobServiceClient; +import com.google.cloud.aiplatform.v1.JobServiceSettings; +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 JobServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in JobServiceSpringProperties. 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 JobServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public JobServiceSettings jobServiceSettings( + @Qualifier("defaultJobServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + JobServiceSettings.Builder clientSettingsBuilder = JobServiceSettings.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 = + JobServiceSettings.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 createCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCustomJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createCustomJobSettings() + .setRetrySettings(createCustomJobRetrySettings); + + RetrySettings getCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getCustomJobSettings().setRetrySettings(getCustomJobRetrySettings); + + RetrySettings listCustomJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listCustomJobsSettings().setRetrySettings(listCustomJobsRetrySettings); + + RetrySettings cancelCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelCustomJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .cancelCustomJobSettings() + .setRetrySettings(cancelCustomJobRetrySettings); + + RetrySettings createDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDataLabelingJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createDataLabelingJobSettings() + .setRetrySettings(createDataLabelingJobRetrySettings); + + RetrySettings getDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataLabelingJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getDataLabelingJobSettings() + .setRetrySettings(getDataLabelingJobRetrySettings); + + RetrySettings listDataLabelingJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataLabelingJobsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listDataLabelingJobsSettings() + .setRetrySettings(listDataLabelingJobsRetrySettings); + + RetrySettings cancelDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelDataLabelingJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .cancelDataLabelingJobSettings() + .setRetrySettings(cancelDataLabelingJobRetrySettings); + + RetrySettings createHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createHyperparameterTuningJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createHyperparameterTuningJobSettings() + .setRetrySettings(createHyperparameterTuningJobRetrySettings); + + RetrySettings getHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHyperparameterTuningJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getHyperparameterTuningJobSettings() + .setRetrySettings(getHyperparameterTuningJobRetrySettings); + + RetrySettings listHyperparameterTuningJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHyperparameterTuningJobsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listHyperparameterTuningJobsSettings() + .setRetrySettings(listHyperparameterTuningJobsRetrySettings); + + RetrySettings cancelHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelHyperparameterTuningJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .cancelHyperparameterTuningJobSettings() + .setRetrySettings(cancelHyperparameterTuningJobRetrySettings); + + RetrySettings createBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBatchPredictionJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createBatchPredictionJobSettings() + .setRetrySettings(createBatchPredictionJobRetrySettings); + + RetrySettings getBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBatchPredictionJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getBatchPredictionJobSettings() + .setRetrySettings(getBatchPredictionJobRetrySettings); + + RetrySettings listBatchPredictionJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBatchPredictionJobsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listBatchPredictionJobsSettings() + .setRetrySettings(listBatchPredictionJobsRetrySettings); + + RetrySettings cancelBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelBatchPredictionJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .cancelBatchPredictionJobSettings() + .setRetrySettings(cancelBatchPredictionJobRetrySettings); + + RetrySettings createModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createModelDeploymentMonitoringJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createModelDeploymentMonitoringJobSettings() + .setRetrySettings(createModelDeploymentMonitoringJobRetrySettings); + + RetrySettings searchModelDeploymentMonitoringStatsAnomaliesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .searchModelDeploymentMonitoringStatsAnomaliesSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .searchModelDeploymentMonitoringStatsAnomaliesSettings() + .setRetrySettings(searchModelDeploymentMonitoringStatsAnomaliesRetrySettings); + + RetrySettings getModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelDeploymentMonitoringJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getModelDeploymentMonitoringJobSettings() + .setRetrySettings(getModelDeploymentMonitoringJobRetrySettings); + + RetrySettings listModelDeploymentMonitoringJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelDeploymentMonitoringJobsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listModelDeploymentMonitoringJobsSettings() + .setRetrySettings(listModelDeploymentMonitoringJobsRetrySettings); + + RetrySettings pauseModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.pauseModelDeploymentMonitoringJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .pauseModelDeploymentMonitoringJobSettings() + .setRetrySettings(pauseModelDeploymentMonitoringJobRetrySettings); + + RetrySettings resumeModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resumeModelDeploymentMonitoringJobSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .resumeModelDeploymentMonitoringJobSettings() + .setRetrySettings(resumeModelDeploymentMonitoringJobRetrySettings); + + 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 createCustomJobRetry = clientProperties.getCreateCustomJobRetry(); + if (createCustomJobRetry != null) { + RetrySettings createCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCustomJobSettings().getRetrySettings(), + createCustomJobRetry); + clientSettingsBuilder + .createCustomJobSettings() + .setRetrySettings(createCustomJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createCustomJob from properties."); + } + } + Retry getCustomJobRetry = clientProperties.getGetCustomJobRetry(); + if (getCustomJobRetry != null) { + RetrySettings getCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCustomJobSettings().getRetrySettings(), getCustomJobRetry); + clientSettingsBuilder.getCustomJobSettings().setRetrySettings(getCustomJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCustomJob from properties."); + } + } + Retry listCustomJobsRetry = clientProperties.getListCustomJobsRetry(); + if (listCustomJobsRetry != null) { + RetrySettings listCustomJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCustomJobsSettings().getRetrySettings(), + listCustomJobsRetry); + clientSettingsBuilder.listCustomJobsSettings().setRetrySettings(listCustomJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listCustomJobs from properties."); + } + } + Retry cancelCustomJobRetry = clientProperties.getCancelCustomJobRetry(); + if (cancelCustomJobRetry != null) { + RetrySettings cancelCustomJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelCustomJobSettings().getRetrySettings(), + cancelCustomJobRetry); + clientSettingsBuilder + .cancelCustomJobSettings() + .setRetrySettings(cancelCustomJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for cancelCustomJob from properties."); + } + } + Retry createDataLabelingJobRetry = clientProperties.getCreateDataLabelingJobRetry(); + if (createDataLabelingJobRetry != null) { + RetrySettings createDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createDataLabelingJobSettings().getRetrySettings(), + createDataLabelingJobRetry); + clientSettingsBuilder + .createDataLabelingJobSettings() + .setRetrySettings(createDataLabelingJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createDataLabelingJob from properties."); + } + } + Retry getDataLabelingJobRetry = clientProperties.getGetDataLabelingJobRetry(); + if (getDataLabelingJobRetry != null) { + RetrySettings getDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataLabelingJobSettings().getRetrySettings(), + getDataLabelingJobRetry); + clientSettingsBuilder + .getDataLabelingJobSettings() + .setRetrySettings(getDataLabelingJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getDataLabelingJob from properties."); + } + } + Retry listDataLabelingJobsRetry = clientProperties.getListDataLabelingJobsRetry(); + if (listDataLabelingJobsRetry != null) { + RetrySettings listDataLabelingJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataLabelingJobsSettings().getRetrySettings(), + listDataLabelingJobsRetry); + clientSettingsBuilder + .listDataLabelingJobsSettings() + .setRetrySettings(listDataLabelingJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDataLabelingJobs from properties."); + } + } + Retry cancelDataLabelingJobRetry = clientProperties.getCancelDataLabelingJobRetry(); + if (cancelDataLabelingJobRetry != null) { + RetrySettings cancelDataLabelingJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelDataLabelingJobSettings().getRetrySettings(), + cancelDataLabelingJobRetry); + clientSettingsBuilder + .cancelDataLabelingJobSettings() + .setRetrySettings(cancelDataLabelingJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for cancelDataLabelingJob from properties."); + } + } + Retry createHyperparameterTuningJobRetry = + clientProperties.getCreateHyperparameterTuningJobRetry(); + if (createHyperparameterTuningJobRetry != null) { + RetrySettings createHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createHyperparameterTuningJobSettings().getRetrySettings(), + createHyperparameterTuningJobRetry); + clientSettingsBuilder + .createHyperparameterTuningJobSettings() + .setRetrySettings(createHyperparameterTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createHyperparameterTuningJob from properties."); + } + } + Retry getHyperparameterTuningJobRetry = clientProperties.getGetHyperparameterTuningJobRetry(); + if (getHyperparameterTuningJobRetry != null) { + RetrySettings getHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHyperparameterTuningJobSettings().getRetrySettings(), + getHyperparameterTuningJobRetry); + clientSettingsBuilder + .getHyperparameterTuningJobSettings() + .setRetrySettings(getHyperparameterTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getHyperparameterTuningJob from properties."); + } + } + Retry listHyperparameterTuningJobsRetry = + clientProperties.getListHyperparameterTuningJobsRetry(); + if (listHyperparameterTuningJobsRetry != null) { + RetrySettings listHyperparameterTuningJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHyperparameterTuningJobsSettings().getRetrySettings(), + listHyperparameterTuningJobsRetry); + clientSettingsBuilder + .listHyperparameterTuningJobsSettings() + .setRetrySettings(listHyperparameterTuningJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listHyperparameterTuningJobs from properties."); + } + } + Retry cancelHyperparameterTuningJobRetry = + clientProperties.getCancelHyperparameterTuningJobRetry(); + if (cancelHyperparameterTuningJobRetry != null) { + RetrySettings cancelHyperparameterTuningJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelHyperparameterTuningJobSettings().getRetrySettings(), + cancelHyperparameterTuningJobRetry); + clientSettingsBuilder + .cancelHyperparameterTuningJobSettings() + .setRetrySettings(cancelHyperparameterTuningJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for cancelHyperparameterTuningJob from properties."); + } + } + Retry createBatchPredictionJobRetry = clientProperties.getCreateBatchPredictionJobRetry(); + if (createBatchPredictionJobRetry != null) { + RetrySettings createBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBatchPredictionJobSettings().getRetrySettings(), + createBatchPredictionJobRetry); + clientSettingsBuilder + .createBatchPredictionJobSettings() + .setRetrySettings(createBatchPredictionJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createBatchPredictionJob from properties."); + } + } + Retry getBatchPredictionJobRetry = clientProperties.getGetBatchPredictionJobRetry(); + if (getBatchPredictionJobRetry != null) { + RetrySettings getBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBatchPredictionJobSettings().getRetrySettings(), + getBatchPredictionJobRetry); + clientSettingsBuilder + .getBatchPredictionJobSettings() + .setRetrySettings(getBatchPredictionJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getBatchPredictionJob from properties."); + } + } + Retry listBatchPredictionJobsRetry = clientProperties.getListBatchPredictionJobsRetry(); + if (listBatchPredictionJobsRetry != null) { + RetrySettings listBatchPredictionJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBatchPredictionJobsSettings().getRetrySettings(), + listBatchPredictionJobsRetry); + clientSettingsBuilder + .listBatchPredictionJobsSettings() + .setRetrySettings(listBatchPredictionJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listBatchPredictionJobs from properties."); + } + } + Retry cancelBatchPredictionJobRetry = clientProperties.getCancelBatchPredictionJobRetry(); + if (cancelBatchPredictionJobRetry != null) { + RetrySettings cancelBatchPredictionJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelBatchPredictionJobSettings().getRetrySettings(), + cancelBatchPredictionJobRetry); + clientSettingsBuilder + .cancelBatchPredictionJobSettings() + .setRetrySettings(cancelBatchPredictionJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for cancelBatchPredictionJob from properties."); + } + } + Retry createModelDeploymentMonitoringJobRetry = + clientProperties.getCreateModelDeploymentMonitoringJobRetry(); + if (createModelDeploymentMonitoringJobRetry != null) { + RetrySettings createModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createModelDeploymentMonitoringJobSettings().getRetrySettings(), + createModelDeploymentMonitoringJobRetry); + clientSettingsBuilder + .createModelDeploymentMonitoringJobSettings() + .setRetrySettings(createModelDeploymentMonitoringJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createModelDeploymentMonitoringJob from properties."); + } + } + Retry searchModelDeploymentMonitoringStatsAnomaliesRetry = + clientProperties.getSearchModelDeploymentMonitoringStatsAnomaliesRetry(); + if (searchModelDeploymentMonitoringStatsAnomaliesRetry != null) { + RetrySettings searchModelDeploymentMonitoringStatsAnomaliesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .searchModelDeploymentMonitoringStatsAnomaliesSettings() + .getRetrySettings(), + searchModelDeploymentMonitoringStatsAnomaliesRetry); + clientSettingsBuilder + .searchModelDeploymentMonitoringStatsAnomaliesSettings() + .setRetrySettings(searchModelDeploymentMonitoringStatsAnomaliesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for searchModelDeploymentMonitoringStatsAnomalies from properties."); + } + } + Retry getModelDeploymentMonitoringJobRetry = + clientProperties.getGetModelDeploymentMonitoringJobRetry(); + if (getModelDeploymentMonitoringJobRetry != null) { + RetrySettings getModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelDeploymentMonitoringJobSettings().getRetrySettings(), + getModelDeploymentMonitoringJobRetry); + clientSettingsBuilder + .getModelDeploymentMonitoringJobSettings() + .setRetrySettings(getModelDeploymentMonitoringJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getModelDeploymentMonitoringJob from properties."); + } + } + Retry listModelDeploymentMonitoringJobsRetry = + clientProperties.getListModelDeploymentMonitoringJobsRetry(); + if (listModelDeploymentMonitoringJobsRetry != null) { + RetrySettings listModelDeploymentMonitoringJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelDeploymentMonitoringJobsSettings().getRetrySettings(), + listModelDeploymentMonitoringJobsRetry); + clientSettingsBuilder + .listModelDeploymentMonitoringJobsSettings() + .setRetrySettings(listModelDeploymentMonitoringJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listModelDeploymentMonitoringJobs from properties."); + } + } + Retry pauseModelDeploymentMonitoringJobRetry = + clientProperties.getPauseModelDeploymentMonitoringJobRetry(); + if (pauseModelDeploymentMonitoringJobRetry != null) { + RetrySettings pauseModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.pauseModelDeploymentMonitoringJobSettings().getRetrySettings(), + pauseModelDeploymentMonitoringJobRetry); + clientSettingsBuilder + .pauseModelDeploymentMonitoringJobSettings() + .setRetrySettings(pauseModelDeploymentMonitoringJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for pauseModelDeploymentMonitoringJob from properties."); + } + } + Retry resumeModelDeploymentMonitoringJobRetry = + clientProperties.getResumeModelDeploymentMonitoringJobRetry(); + if (resumeModelDeploymentMonitoringJobRetry != null) { + RetrySettings resumeModelDeploymentMonitoringJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resumeModelDeploymentMonitoringJobSettings().getRetrySettings(), + resumeModelDeploymentMonitoringJobRetry); + clientSettingsBuilder + .resumeModelDeploymentMonitoringJobSettings() + .setRetrySettings(resumeModelDeploymentMonitoringJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for resumeModelDeploymentMonitoringJob 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 JobServiceClient bean configured with JobServiceSettings. + * + * @param jobServiceSettings settings to configure an instance of client bean. + * @return a {@link JobServiceClient} bean configured with {@link JobServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public JobServiceClient jobServiceClient(JobServiceSettings jobServiceSettings) + throws IOException { + return JobServiceClient.create(jobServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-job-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/JobServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringProperties.java new file mode 100644 index 0000000000..0788e084c6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/JobServiceSpringProperties.java @@ -0,0 +1,430 @@ +/* + * Copyright 2022 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 JobService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.job-service") +public class JobServiceSpringProperties 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 createCustomJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createCustomJobRetry; + /** + * Allow override of retry settings at method-level for getCustomJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCustomJobRetry; + /** + * Allow override of retry settings at method-level for listCustomJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCustomJobsRetry; + /** + * Allow override of retry settings at method-level for cancelCustomJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelCustomJobRetry; + /** + * Allow override of retry settings at method-level for createDataLabelingJob. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createDataLabelingJobRetry; + /** + * Allow override of retry settings at method-level for getDataLabelingJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDataLabelingJobRetry; + /** + * Allow override of retry settings at method-level for listDataLabelingJobs. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataLabelingJobsRetry; + /** + * Allow override of retry settings at method-level for cancelDataLabelingJob. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelDataLabelingJobRetry; + /** + * Allow override of retry settings at method-level for createHyperparameterTuningJob. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createHyperparameterTuningJobRetry; + /** + * Allow override of retry settings at method-level for getHyperparameterTuningJob. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getHyperparameterTuningJobRetry; + /** + * Allow override of retry settings at method-level for listHyperparameterTuningJobs. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listHyperparameterTuningJobsRetry; + /** + * Allow override of retry settings at method-level for cancelHyperparameterTuningJob. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelHyperparameterTuningJobRetry; + /** + * Allow override of retry settings at method-level for createBatchPredictionJob. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createBatchPredictionJobRetry; + /** + * Allow override of retry settings at method-level for getBatchPredictionJob. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getBatchPredictionJobRetry; + /** + * Allow override of retry settings at method-level for listBatchPredictionJobs. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBatchPredictionJobsRetry; + /** + * Allow override of retry settings at method-level for cancelBatchPredictionJob. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelBatchPredictionJobRetry; + /** + * Allow override of retry settings at method-level for createModelDeploymentMonitoringJob. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createModelDeploymentMonitoringJobRetry; + /** + * Allow override of retry settings at method-level for + * searchModelDeploymentMonitoringStatsAnomalies. If defined, this takes precedence over + * service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchModelDeploymentMonitoringStatsAnomaliesRetry; + /** + * Allow override of retry settings at method-level for getModelDeploymentMonitoringJob. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelDeploymentMonitoringJobRetry; + /** + * Allow override of retry settings at method-level for listModelDeploymentMonitoringJobs. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelDeploymentMonitoringJobsRetry; + /** + * Allow override of retry settings at method-level for pauseModelDeploymentMonitoringJob. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry pauseModelDeploymentMonitoringJobRetry; + /** + * Allow override of retry settings at method-level for resumeModelDeploymentMonitoringJob. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry resumeModelDeploymentMonitoringJobRetry; + /** + * 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 getCreateCustomJobRetry() { + return this.createCustomJobRetry; + } + + public void setCreateCustomJobRetry(Retry createCustomJobRetry) { + this.createCustomJobRetry = createCustomJobRetry; + } + + public Retry getGetCustomJobRetry() { + return this.getCustomJobRetry; + } + + public void setGetCustomJobRetry(Retry getCustomJobRetry) { + this.getCustomJobRetry = getCustomJobRetry; + } + + public Retry getListCustomJobsRetry() { + return this.listCustomJobsRetry; + } + + public void setListCustomJobsRetry(Retry listCustomJobsRetry) { + this.listCustomJobsRetry = listCustomJobsRetry; + } + + public Retry getCancelCustomJobRetry() { + return this.cancelCustomJobRetry; + } + + public void setCancelCustomJobRetry(Retry cancelCustomJobRetry) { + this.cancelCustomJobRetry = cancelCustomJobRetry; + } + + public Retry getCreateDataLabelingJobRetry() { + return this.createDataLabelingJobRetry; + } + + public void setCreateDataLabelingJobRetry(Retry createDataLabelingJobRetry) { + this.createDataLabelingJobRetry = createDataLabelingJobRetry; + } + + public Retry getGetDataLabelingJobRetry() { + return this.getDataLabelingJobRetry; + } + + public void setGetDataLabelingJobRetry(Retry getDataLabelingJobRetry) { + this.getDataLabelingJobRetry = getDataLabelingJobRetry; + } + + public Retry getListDataLabelingJobsRetry() { + return this.listDataLabelingJobsRetry; + } + + public void setListDataLabelingJobsRetry(Retry listDataLabelingJobsRetry) { + this.listDataLabelingJobsRetry = listDataLabelingJobsRetry; + } + + public Retry getCancelDataLabelingJobRetry() { + return this.cancelDataLabelingJobRetry; + } + + public void setCancelDataLabelingJobRetry(Retry cancelDataLabelingJobRetry) { + this.cancelDataLabelingJobRetry = cancelDataLabelingJobRetry; + } + + public Retry getCreateHyperparameterTuningJobRetry() { + return this.createHyperparameterTuningJobRetry; + } + + public void setCreateHyperparameterTuningJobRetry(Retry createHyperparameterTuningJobRetry) { + this.createHyperparameterTuningJobRetry = createHyperparameterTuningJobRetry; + } + + public Retry getGetHyperparameterTuningJobRetry() { + return this.getHyperparameterTuningJobRetry; + } + + public void setGetHyperparameterTuningJobRetry(Retry getHyperparameterTuningJobRetry) { + this.getHyperparameterTuningJobRetry = getHyperparameterTuningJobRetry; + } + + public Retry getListHyperparameterTuningJobsRetry() { + return this.listHyperparameterTuningJobsRetry; + } + + public void setListHyperparameterTuningJobsRetry(Retry listHyperparameterTuningJobsRetry) { + this.listHyperparameterTuningJobsRetry = listHyperparameterTuningJobsRetry; + } + + public Retry getCancelHyperparameterTuningJobRetry() { + return this.cancelHyperparameterTuningJobRetry; + } + + public void setCancelHyperparameterTuningJobRetry(Retry cancelHyperparameterTuningJobRetry) { + this.cancelHyperparameterTuningJobRetry = cancelHyperparameterTuningJobRetry; + } + + public Retry getCreateBatchPredictionJobRetry() { + return this.createBatchPredictionJobRetry; + } + + public void setCreateBatchPredictionJobRetry(Retry createBatchPredictionJobRetry) { + this.createBatchPredictionJobRetry = createBatchPredictionJobRetry; + } + + public Retry getGetBatchPredictionJobRetry() { + return this.getBatchPredictionJobRetry; + } + + public void setGetBatchPredictionJobRetry(Retry getBatchPredictionJobRetry) { + this.getBatchPredictionJobRetry = getBatchPredictionJobRetry; + } + + public Retry getListBatchPredictionJobsRetry() { + return this.listBatchPredictionJobsRetry; + } + + public void setListBatchPredictionJobsRetry(Retry listBatchPredictionJobsRetry) { + this.listBatchPredictionJobsRetry = listBatchPredictionJobsRetry; + } + + public Retry getCancelBatchPredictionJobRetry() { + return this.cancelBatchPredictionJobRetry; + } + + public void setCancelBatchPredictionJobRetry(Retry cancelBatchPredictionJobRetry) { + this.cancelBatchPredictionJobRetry = cancelBatchPredictionJobRetry; + } + + public Retry getCreateModelDeploymentMonitoringJobRetry() { + return this.createModelDeploymentMonitoringJobRetry; + } + + public void setCreateModelDeploymentMonitoringJobRetry( + Retry createModelDeploymentMonitoringJobRetry) { + this.createModelDeploymentMonitoringJobRetry = createModelDeploymentMonitoringJobRetry; + } + + public Retry getSearchModelDeploymentMonitoringStatsAnomaliesRetry() { + return this.searchModelDeploymentMonitoringStatsAnomaliesRetry; + } + + public void setSearchModelDeploymentMonitoringStatsAnomaliesRetry( + Retry searchModelDeploymentMonitoringStatsAnomaliesRetry) { + this.searchModelDeploymentMonitoringStatsAnomaliesRetry = + searchModelDeploymentMonitoringStatsAnomaliesRetry; + } + + public Retry getGetModelDeploymentMonitoringJobRetry() { + return this.getModelDeploymentMonitoringJobRetry; + } + + public void setGetModelDeploymentMonitoringJobRetry(Retry getModelDeploymentMonitoringJobRetry) { + this.getModelDeploymentMonitoringJobRetry = getModelDeploymentMonitoringJobRetry; + } + + public Retry getListModelDeploymentMonitoringJobsRetry() { + return this.listModelDeploymentMonitoringJobsRetry; + } + + public void setListModelDeploymentMonitoringJobsRetry( + Retry listModelDeploymentMonitoringJobsRetry) { + this.listModelDeploymentMonitoringJobsRetry = listModelDeploymentMonitoringJobsRetry; + } + + public Retry getPauseModelDeploymentMonitoringJobRetry() { + return this.pauseModelDeploymentMonitoringJobRetry; + } + + public void setPauseModelDeploymentMonitoringJobRetry( + Retry pauseModelDeploymentMonitoringJobRetry) { + this.pauseModelDeploymentMonitoringJobRetry = pauseModelDeploymentMonitoringJobRetry; + } + + public Retry getResumeModelDeploymentMonitoringJobRetry() { + return this.resumeModelDeploymentMonitoringJobRetry; + } + + public void setResumeModelDeploymentMonitoringJobRetry( + Retry resumeModelDeploymentMonitoringJobRetry) { + this.resumeModelDeploymentMonitoringJobRetry = resumeModelDeploymentMonitoringJobRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4c65422fc4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringAutoConfiguration.java @@ -0,0 +1,710 @@ +/* + * Copyright 2022 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.MetadataServiceClient; +import com.google.cloud.aiplatform.v1.MetadataServiceSettings; +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 MetadataServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in MetadataServiceSpringProperties. 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 MetadataServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public MetadataServiceSettings metadataServiceSettings( + @Qualifier("defaultMetadataServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + MetadataServiceSettings.Builder clientSettingsBuilder = MetadataServiceSettings.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 = + MetadataServiceSettings.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 getMetadataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMetadataStoreSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings(getMetadataStoreRetrySettings); + + RetrySettings listMetadataStoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMetadataStoresSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listMetadataStoresSettings() + .setRetrySettings(listMetadataStoresRetrySettings); + + RetrySettings createArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createArtifactSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createArtifactSettings().setRetrySettings(createArtifactRetrySettings); + + RetrySettings getArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getArtifactSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getArtifactSettings().setRetrySettings(getArtifactRetrySettings); + + RetrySettings listArtifactsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listArtifactsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listArtifactsSettings().setRetrySettings(listArtifactsRetrySettings); + + RetrySettings updateArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateArtifactSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateArtifactSettings().setRetrySettings(updateArtifactRetrySettings); + + RetrySettings createContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createContextSettings().setRetrySettings(createContextRetrySettings); + + RetrySettings getContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getContextSettings().setRetrySettings(getContextRetrySettings); + + RetrySettings listContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContextsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listContextsSettings().setRetrySettings(listContextsRetrySettings); + + RetrySettings updateContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateContextSettings().setRetrySettings(updateContextRetrySettings); + + RetrySettings addContextArtifactsAndExecutionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addContextArtifactsAndExecutionsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .addContextArtifactsAndExecutionsSettings() + .setRetrySettings(addContextArtifactsAndExecutionsRetrySettings); + + RetrySettings addContextChildrenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addContextChildrenSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .addContextChildrenSettings() + .setRetrySettings(addContextChildrenRetrySettings); + + RetrySettings removeContextChildrenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeContextChildrenSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .removeContextChildrenSettings() + .setRetrySettings(removeContextChildrenRetrySettings); + + RetrySettings queryContextLineageSubgraphRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryContextLineageSubgraphSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .queryContextLineageSubgraphSettings() + .setRetrySettings(queryContextLineageSubgraphRetrySettings); + + RetrySettings createExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createExecutionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createExecutionSettings() + .setRetrySettings(createExecutionRetrySettings); + + RetrySettings getExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getExecutionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings); + + RetrySettings listExecutionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listExecutionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings); + + RetrySettings updateExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateExecutionSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateExecutionSettings() + .setRetrySettings(updateExecutionRetrySettings); + + RetrySettings addExecutionEventsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addExecutionEventsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .addExecutionEventsSettings() + .setRetrySettings(addExecutionEventsRetrySettings); + + RetrySettings queryExecutionInputsAndOutputsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryExecutionInputsAndOutputsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .queryExecutionInputsAndOutputsSettings() + .setRetrySettings(queryExecutionInputsAndOutputsRetrySettings); + + RetrySettings createMetadataSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createMetadataSchemaSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createMetadataSchemaSettings() + .setRetrySettings(createMetadataSchemaRetrySettings); + + RetrySettings getMetadataSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMetadataSchemaSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getMetadataSchemaSettings() + .setRetrySettings(getMetadataSchemaRetrySettings); + + RetrySettings listMetadataSchemasRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMetadataSchemasSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listMetadataSchemasSettings() + .setRetrySettings(listMetadataSchemasRetrySettings); + + RetrySettings queryArtifactLineageSubgraphRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryArtifactLineageSubgraphSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .queryArtifactLineageSubgraphSettings() + .setRetrySettings(queryArtifactLineageSubgraphRetrySettings); + + 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 getMetadataStoreRetry = clientProperties.getGetMetadataStoreRetry(); + if (getMetadataStoreRetry != null) { + RetrySettings getMetadataStoreRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMetadataStoreSettings().getRetrySettings(), + getMetadataStoreRetry); + clientSettingsBuilder + .getMetadataStoreSettings() + .setRetrySettings(getMetadataStoreRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getMetadataStore from properties."); + } + } + Retry listMetadataStoresRetry = clientProperties.getListMetadataStoresRetry(); + if (listMetadataStoresRetry != null) { + RetrySettings listMetadataStoresRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMetadataStoresSettings().getRetrySettings(), + listMetadataStoresRetry); + clientSettingsBuilder + .listMetadataStoresSettings() + .setRetrySettings(listMetadataStoresRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listMetadataStores from properties."); + } + } + Retry createArtifactRetry = clientProperties.getCreateArtifactRetry(); + if (createArtifactRetry != null) { + RetrySettings createArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createArtifactSettings().getRetrySettings(), + createArtifactRetry); + clientSettingsBuilder.createArtifactSettings().setRetrySettings(createArtifactRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createArtifact from properties."); + } + } + Retry getArtifactRetry = clientProperties.getGetArtifactRetry(); + if (getArtifactRetry != null) { + RetrySettings getArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getArtifactSettings().getRetrySettings(), getArtifactRetry); + clientSettingsBuilder.getArtifactSettings().setRetrySettings(getArtifactRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getArtifact from properties."); + } + } + Retry listArtifactsRetry = clientProperties.getListArtifactsRetry(); + if (listArtifactsRetry != null) { + RetrySettings listArtifactsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listArtifactsSettings().getRetrySettings(), listArtifactsRetry); + clientSettingsBuilder.listArtifactsSettings().setRetrySettings(listArtifactsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listArtifacts from properties."); + } + } + Retry updateArtifactRetry = clientProperties.getUpdateArtifactRetry(); + if (updateArtifactRetry != null) { + RetrySettings updateArtifactRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateArtifactSettings().getRetrySettings(), + updateArtifactRetry); + clientSettingsBuilder.updateArtifactSettings().setRetrySettings(updateArtifactRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateArtifact from properties."); + } + } + Retry createContextRetry = clientProperties.getCreateContextRetry(); + if (createContextRetry != null) { + RetrySettings createContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContextSettings().getRetrySettings(), createContextRetry); + clientSettingsBuilder.createContextSettings().setRetrySettings(createContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createContext from properties."); + } + } + Retry getContextRetry = clientProperties.getGetContextRetry(); + if (getContextRetry != null) { + RetrySettings getContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContextSettings().getRetrySettings(), getContextRetry); + clientSettingsBuilder.getContextSettings().setRetrySettings(getContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getContext from properties."); + } + } + Retry listContextsRetry = clientProperties.getListContextsRetry(); + if (listContextsRetry != null) { + RetrySettings listContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContextsSettings().getRetrySettings(), listContextsRetry); + clientSettingsBuilder.listContextsSettings().setRetrySettings(listContextsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listContexts from properties."); + } + } + Retry updateContextRetry = clientProperties.getUpdateContextRetry(); + if (updateContextRetry != null) { + RetrySettings updateContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContextSettings().getRetrySettings(), updateContextRetry); + clientSettingsBuilder.updateContextSettings().setRetrySettings(updateContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateContext from properties."); + } + } + Retry addContextArtifactsAndExecutionsRetry = + clientProperties.getAddContextArtifactsAndExecutionsRetry(); + if (addContextArtifactsAndExecutionsRetry != null) { + RetrySettings addContextArtifactsAndExecutionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addContextArtifactsAndExecutionsSettings().getRetrySettings(), + addContextArtifactsAndExecutionsRetry); + clientSettingsBuilder + .addContextArtifactsAndExecutionsSettings() + .setRetrySettings(addContextArtifactsAndExecutionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for addContextArtifactsAndExecutions from properties."); + } + } + Retry addContextChildrenRetry = clientProperties.getAddContextChildrenRetry(); + if (addContextChildrenRetry != null) { + RetrySettings addContextChildrenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addContextChildrenSettings().getRetrySettings(), + addContextChildrenRetry); + clientSettingsBuilder + .addContextChildrenSettings() + .setRetrySettings(addContextChildrenRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for addContextChildren from properties."); + } + } + Retry removeContextChildrenRetry = clientProperties.getRemoveContextChildrenRetry(); + if (removeContextChildrenRetry != null) { + RetrySettings removeContextChildrenRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeContextChildrenSettings().getRetrySettings(), + removeContextChildrenRetry); + clientSettingsBuilder + .removeContextChildrenSettings() + .setRetrySettings(removeContextChildrenRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for removeContextChildren from properties."); + } + } + Retry queryContextLineageSubgraphRetry = clientProperties.getQueryContextLineageSubgraphRetry(); + if (queryContextLineageSubgraphRetry != null) { + RetrySettings queryContextLineageSubgraphRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryContextLineageSubgraphSettings().getRetrySettings(), + queryContextLineageSubgraphRetry); + clientSettingsBuilder + .queryContextLineageSubgraphSettings() + .setRetrySettings(queryContextLineageSubgraphRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for queryContextLineageSubgraph from properties."); + } + } + Retry createExecutionRetry = clientProperties.getCreateExecutionRetry(); + if (createExecutionRetry != null) { + RetrySettings createExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createExecutionSettings().getRetrySettings(), + createExecutionRetry); + clientSettingsBuilder + .createExecutionSettings() + .setRetrySettings(createExecutionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createExecution from properties."); + } + } + Retry getExecutionRetry = clientProperties.getGetExecutionRetry(); + if (getExecutionRetry != null) { + RetrySettings getExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getExecutionSettings().getRetrySettings(), getExecutionRetry); + clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getExecution from properties."); + } + } + Retry listExecutionsRetry = clientProperties.getListExecutionsRetry(); + if (listExecutionsRetry != null) { + RetrySettings listExecutionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listExecutionsSettings().getRetrySettings(), + listExecutionsRetry); + clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listExecutions from properties."); + } + } + Retry updateExecutionRetry = clientProperties.getUpdateExecutionRetry(); + if (updateExecutionRetry != null) { + RetrySettings updateExecutionRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateExecutionSettings().getRetrySettings(), + updateExecutionRetry); + clientSettingsBuilder + .updateExecutionSettings() + .setRetrySettings(updateExecutionRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateExecution from properties."); + } + } + Retry addExecutionEventsRetry = clientProperties.getAddExecutionEventsRetry(); + if (addExecutionEventsRetry != null) { + RetrySettings addExecutionEventsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addExecutionEventsSettings().getRetrySettings(), + addExecutionEventsRetry); + clientSettingsBuilder + .addExecutionEventsSettings() + .setRetrySettings(addExecutionEventsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for addExecutionEvents from properties."); + } + } + Retry queryExecutionInputsAndOutputsRetry = + clientProperties.getQueryExecutionInputsAndOutputsRetry(); + if (queryExecutionInputsAndOutputsRetry != null) { + RetrySettings queryExecutionInputsAndOutputsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryExecutionInputsAndOutputsSettings().getRetrySettings(), + queryExecutionInputsAndOutputsRetry); + clientSettingsBuilder + .queryExecutionInputsAndOutputsSettings() + .setRetrySettings(queryExecutionInputsAndOutputsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for queryExecutionInputsAndOutputs from properties."); + } + } + Retry createMetadataSchemaRetry = clientProperties.getCreateMetadataSchemaRetry(); + if (createMetadataSchemaRetry != null) { + RetrySettings createMetadataSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createMetadataSchemaSettings().getRetrySettings(), + createMetadataSchemaRetry); + clientSettingsBuilder + .createMetadataSchemaSettings() + .setRetrySettings(createMetadataSchemaRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createMetadataSchema from properties."); + } + } + Retry getMetadataSchemaRetry = clientProperties.getGetMetadataSchemaRetry(); + if (getMetadataSchemaRetry != null) { + RetrySettings getMetadataSchemaRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getMetadataSchemaSettings().getRetrySettings(), + getMetadataSchemaRetry); + clientSettingsBuilder + .getMetadataSchemaSettings() + .setRetrySettings(getMetadataSchemaRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getMetadataSchema from properties."); + } + } + Retry listMetadataSchemasRetry = clientProperties.getListMetadataSchemasRetry(); + if (listMetadataSchemasRetry != null) { + RetrySettings listMetadataSchemasRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMetadataSchemasSettings().getRetrySettings(), + listMetadataSchemasRetry); + clientSettingsBuilder + .listMetadataSchemasSettings() + .setRetrySettings(listMetadataSchemasRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listMetadataSchemas from properties."); + } + } + Retry queryArtifactLineageSubgraphRetry = + clientProperties.getQueryArtifactLineageSubgraphRetry(); + if (queryArtifactLineageSubgraphRetry != null) { + RetrySettings queryArtifactLineageSubgraphRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.queryArtifactLineageSubgraphSettings().getRetrySettings(), + queryArtifactLineageSubgraphRetry); + clientSettingsBuilder + .queryArtifactLineageSubgraphSettings() + .setRetrySettings(queryArtifactLineageSubgraphRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for queryArtifactLineageSubgraph 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 MetadataServiceClient bean configured with MetadataServiceSettings. + * + * @param metadataServiceSettings settings to configure an instance of client bean. + * @return a {@link MetadataServiceClient} bean configured with {@link MetadataServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public MetadataServiceClient metadataServiceClient( + MetadataServiceSettings metadataServiceSettings) throws IOException { + return MetadataServiceClient.create(metadataServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-metadata-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/MetadataServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringProperties.java new file mode 100644 index 0000000000..2ecbc76d04 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MetadataServiceSpringProperties.java @@ -0,0 +1,450 @@ +/* + * Copyright 2022 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 MetadataService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.metadata-service") +public class MetadataServiceSpringProperties 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 getMetadataStore. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getMetadataStoreRetry; + /** + * Allow override of retry settings at method-level for listMetadataStores. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listMetadataStoresRetry; + /** + * Allow override of retry settings at method-level for createArtifact. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createArtifactRetry; + /** + * Allow override of retry settings at method-level for getArtifact. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getArtifactRetry; + /** + * Allow override of retry settings at method-level for listArtifacts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listArtifactsRetry; + /** + * Allow override of retry settings at method-level for updateArtifact. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateArtifactRetry; + /** + * Allow override of retry settings at method-level for createContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createContextRetry; + /** + * Allow override of retry settings at method-level for getContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getContextRetry; + /** + * Allow override of retry settings at method-level for listContexts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listContextsRetry; + /** + * Allow override of retry settings at method-level for updateContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateContextRetry; + /** + * Allow override of retry settings at method-level for addContextArtifactsAndExecutions. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry addContextArtifactsAndExecutionsRetry; + /** + * Allow override of retry settings at method-level for addContextChildren. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry addContextChildrenRetry; + /** + * Allow override of retry settings at method-level for removeContextChildren. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry removeContextChildrenRetry; + /** + * Allow override of retry settings at method-level for queryContextLineageSubgraph. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry queryContextLineageSubgraphRetry; + /** + * Allow override of retry settings at method-level for createExecution. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createExecutionRetry; + /** + * Allow override of retry settings at method-level for getExecution. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getExecutionRetry; + /** + * Allow override of retry settings at method-level for listExecutions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listExecutionsRetry; + /** + * Allow override of retry settings at method-level for updateExecution. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateExecutionRetry; + /** + * Allow override of retry settings at method-level for addExecutionEvents. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry addExecutionEventsRetry; + /** + * Allow override of retry settings at method-level for queryExecutionInputsAndOutputs. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry queryExecutionInputsAndOutputsRetry; + /** + * Allow override of retry settings at method-level for createMetadataSchema. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createMetadataSchemaRetry; + /** + * Allow override of retry settings at method-level for getMetadataSchema. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getMetadataSchemaRetry; + /** + * Allow override of retry settings at method-level for listMetadataSchemas. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listMetadataSchemasRetry; + /** + * Allow override of retry settings at method-level for queryArtifactLineageSubgraph. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry queryArtifactLineageSubgraphRetry; + /** + * 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 getGetMetadataStoreRetry() { + return this.getMetadataStoreRetry; + } + + public void setGetMetadataStoreRetry(Retry getMetadataStoreRetry) { + this.getMetadataStoreRetry = getMetadataStoreRetry; + } + + public Retry getListMetadataStoresRetry() { + return this.listMetadataStoresRetry; + } + + public void setListMetadataStoresRetry(Retry listMetadataStoresRetry) { + this.listMetadataStoresRetry = listMetadataStoresRetry; + } + + public Retry getCreateArtifactRetry() { + return this.createArtifactRetry; + } + + public void setCreateArtifactRetry(Retry createArtifactRetry) { + this.createArtifactRetry = createArtifactRetry; + } + + public Retry getGetArtifactRetry() { + return this.getArtifactRetry; + } + + public void setGetArtifactRetry(Retry getArtifactRetry) { + this.getArtifactRetry = getArtifactRetry; + } + + public Retry getListArtifactsRetry() { + return this.listArtifactsRetry; + } + + public void setListArtifactsRetry(Retry listArtifactsRetry) { + this.listArtifactsRetry = listArtifactsRetry; + } + + public Retry getUpdateArtifactRetry() { + return this.updateArtifactRetry; + } + + public void setUpdateArtifactRetry(Retry updateArtifactRetry) { + this.updateArtifactRetry = updateArtifactRetry; + } + + public Retry getCreateContextRetry() { + return this.createContextRetry; + } + + public void setCreateContextRetry(Retry createContextRetry) { + this.createContextRetry = createContextRetry; + } + + public Retry getGetContextRetry() { + return this.getContextRetry; + } + + public void setGetContextRetry(Retry getContextRetry) { + this.getContextRetry = getContextRetry; + } + + public Retry getListContextsRetry() { + return this.listContextsRetry; + } + + public void setListContextsRetry(Retry listContextsRetry) { + this.listContextsRetry = listContextsRetry; + } + + public Retry getUpdateContextRetry() { + return this.updateContextRetry; + } + + public void setUpdateContextRetry(Retry updateContextRetry) { + this.updateContextRetry = updateContextRetry; + } + + public Retry getAddContextArtifactsAndExecutionsRetry() { + return this.addContextArtifactsAndExecutionsRetry; + } + + public void setAddContextArtifactsAndExecutionsRetry( + Retry addContextArtifactsAndExecutionsRetry) { + this.addContextArtifactsAndExecutionsRetry = addContextArtifactsAndExecutionsRetry; + } + + public Retry getAddContextChildrenRetry() { + return this.addContextChildrenRetry; + } + + public void setAddContextChildrenRetry(Retry addContextChildrenRetry) { + this.addContextChildrenRetry = addContextChildrenRetry; + } + + public Retry getRemoveContextChildrenRetry() { + return this.removeContextChildrenRetry; + } + + public void setRemoveContextChildrenRetry(Retry removeContextChildrenRetry) { + this.removeContextChildrenRetry = removeContextChildrenRetry; + } + + public Retry getQueryContextLineageSubgraphRetry() { + return this.queryContextLineageSubgraphRetry; + } + + public void setQueryContextLineageSubgraphRetry(Retry queryContextLineageSubgraphRetry) { + this.queryContextLineageSubgraphRetry = queryContextLineageSubgraphRetry; + } + + public Retry getCreateExecutionRetry() { + return this.createExecutionRetry; + } + + public void setCreateExecutionRetry(Retry createExecutionRetry) { + this.createExecutionRetry = createExecutionRetry; + } + + public Retry getGetExecutionRetry() { + return this.getExecutionRetry; + } + + public void setGetExecutionRetry(Retry getExecutionRetry) { + this.getExecutionRetry = getExecutionRetry; + } + + public Retry getListExecutionsRetry() { + return this.listExecutionsRetry; + } + + public void setListExecutionsRetry(Retry listExecutionsRetry) { + this.listExecutionsRetry = listExecutionsRetry; + } + + public Retry getUpdateExecutionRetry() { + return this.updateExecutionRetry; + } + + public void setUpdateExecutionRetry(Retry updateExecutionRetry) { + this.updateExecutionRetry = updateExecutionRetry; + } + + public Retry getAddExecutionEventsRetry() { + return this.addExecutionEventsRetry; + } + + public void setAddExecutionEventsRetry(Retry addExecutionEventsRetry) { + this.addExecutionEventsRetry = addExecutionEventsRetry; + } + + public Retry getQueryExecutionInputsAndOutputsRetry() { + return this.queryExecutionInputsAndOutputsRetry; + } + + public void setQueryExecutionInputsAndOutputsRetry(Retry queryExecutionInputsAndOutputsRetry) { + this.queryExecutionInputsAndOutputsRetry = queryExecutionInputsAndOutputsRetry; + } + + public Retry getCreateMetadataSchemaRetry() { + return this.createMetadataSchemaRetry; + } + + public void setCreateMetadataSchemaRetry(Retry createMetadataSchemaRetry) { + this.createMetadataSchemaRetry = createMetadataSchemaRetry; + } + + public Retry getGetMetadataSchemaRetry() { + return this.getMetadataSchemaRetry; + } + + public void setGetMetadataSchemaRetry(Retry getMetadataSchemaRetry) { + this.getMetadataSchemaRetry = getMetadataSchemaRetry; + } + + public Retry getListMetadataSchemasRetry() { + return this.listMetadataSchemasRetry; + } + + public void setListMetadataSchemasRetry(Retry listMetadataSchemasRetry) { + this.listMetadataSchemasRetry = listMetadataSchemasRetry; + } + + public Retry getQueryArtifactLineageSubgraphRetry() { + return this.queryArtifactLineageSubgraphRetry; + } + + public void setQueryArtifactLineageSubgraphRetry(Retry queryArtifactLineageSubgraphRetry) { + this.queryArtifactLineageSubgraphRetry = queryArtifactLineageSubgraphRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..7f2a83d0da --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringAutoConfiguration.java @@ -0,0 +1,279 @@ +/* + * Copyright 2022 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.MigrationServiceClient; +import com.google.cloud.aiplatform.v1.MigrationServiceSettings; +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 MigrationServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in MigrationServiceSpringProperties. 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 MigrationServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public MigrationServiceSettings migrationServiceSettings( + @Qualifier("defaultMigrationServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + MigrationServiceSettings.Builder clientSettingsBuilder = MigrationServiceSettings.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 = + MigrationServiceSettings.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 searchMigratableResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchMigratableResourcesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .searchMigratableResourcesSettings() + .setRetrySettings(searchMigratableResourcesRetrySettings); + + 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 searchMigratableResourcesRetry = clientProperties.getSearchMigratableResourcesRetry(); + if (searchMigratableResourcesRetry != null) { + RetrySettings searchMigratableResourcesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchMigratableResourcesSettings().getRetrySettings(), + searchMigratableResourcesRetry); + clientSettingsBuilder + .searchMigratableResourcesSettings() + .setRetrySettings(searchMigratableResourcesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for searchMigratableResources 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 MigrationServiceClient bean configured with MigrationServiceSettings. + * + * @param migrationServiceSettings settings to configure an instance of client bean. + * @return a {@link MigrationServiceClient} bean configured with {@link MigrationServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public MigrationServiceClient migrationServiceClient( + MigrationServiceSettings migrationServiceSettings) throws IOException { + return MigrationServiceClient.create(migrationServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-migration-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/MigrationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringProperties.java new file mode 100644 index 0000000000..3fd5eebd8f --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/MigrationServiceSpringProperties.java @@ -0,0 +1,150 @@ +/* + * Copyright 2022 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 MigrationService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.migration-service") +public class MigrationServiceSpringProperties 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 searchMigratableResources. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchMigratableResourcesRetry; + /** + * 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 getSearchMigratableResourcesRetry() { + return this.searchMigratableResourcesRetry; + } + + public void setSearchMigratableResourcesRetry(Retry searchMigratableResourcesRetry) { + this.searchMigratableResourcesRetry = searchMigratableResourcesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..6be77e0296 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringAutoConfiguration.java @@ -0,0 +1,475 @@ +/* + * Copyright 2022 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.ModelServiceClient; +import com.google.cloud.aiplatform.v1.ModelServiceSettings; +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 ModelServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ModelServiceSpringProperties. 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 ModelServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ModelServiceSettings modelServiceSettings( + @Qualifier("defaultModelServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ModelServiceSettings.Builder clientSettingsBuilder = ModelServiceSettings.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 = + ModelServiceSettings.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 getModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getModelSettings().setRetrySettings(getModelRetrySettings); + + RetrySettings listModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listModelsSettings().setRetrySettings(listModelsRetrySettings); + + RetrySettings listModelVersionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelVersionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listModelVersionsSettings() + .setRetrySettings(listModelVersionsRetrySettings); + + RetrySettings updateModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateModelSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateModelSettings().setRetrySettings(updateModelRetrySettings); + + RetrySettings mergeVersionAliasesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.mergeVersionAliasesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .mergeVersionAliasesSettings() + .setRetrySettings(mergeVersionAliasesRetrySettings); + + RetrySettings importModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importModelEvaluationSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .importModelEvaluationSettings() + .setRetrySettings(importModelEvaluationRetrySettings); + + RetrySettings batchImportModelEvaluationSlicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchImportModelEvaluationSlicesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchImportModelEvaluationSlicesSettings() + .setRetrySettings(batchImportModelEvaluationSlicesRetrySettings); + + RetrySettings getModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getModelEvaluationSettings() + .setRetrySettings(getModelEvaluationRetrySettings); + + RetrySettings listModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listModelEvaluationsSettings() + .setRetrySettings(listModelEvaluationsRetrySettings); + + RetrySettings getModelEvaluationSliceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSliceSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getModelEvaluationSliceSettings() + .setRetrySettings(getModelEvaluationSliceRetrySettings); + + RetrySettings listModelEvaluationSlicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationSlicesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listModelEvaluationSlicesSettings() + .setRetrySettings(listModelEvaluationSlicesRetrySettings); + + 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 getModelRetry = clientProperties.getGetModelRetry(); + if (getModelRetry != null) { + RetrySettings getModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelSettings().getRetrySettings(), getModelRetry); + clientSettingsBuilder.getModelSettings().setRetrySettings(getModelRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getModel from properties."); + } + } + Retry listModelsRetry = clientProperties.getListModelsRetry(); + if (listModelsRetry != null) { + RetrySettings listModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelsSettings().getRetrySettings(), listModelsRetry); + clientSettingsBuilder.listModelsSettings().setRetrySettings(listModelsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listModels from properties."); + } + } + Retry listModelVersionsRetry = clientProperties.getListModelVersionsRetry(); + if (listModelVersionsRetry != null) { + RetrySettings listModelVersionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelVersionsSettings().getRetrySettings(), + listModelVersionsRetry); + clientSettingsBuilder + .listModelVersionsSettings() + .setRetrySettings(listModelVersionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listModelVersions from properties."); + } + } + Retry updateModelRetry = clientProperties.getUpdateModelRetry(); + if (updateModelRetry != null) { + RetrySettings updateModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateModelSettings().getRetrySettings(), updateModelRetry); + clientSettingsBuilder.updateModelSettings().setRetrySettings(updateModelRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateModel from properties."); + } + } + Retry mergeVersionAliasesRetry = clientProperties.getMergeVersionAliasesRetry(); + if (mergeVersionAliasesRetry != null) { + RetrySettings mergeVersionAliasesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.mergeVersionAliasesSettings().getRetrySettings(), + mergeVersionAliasesRetry); + clientSettingsBuilder + .mergeVersionAliasesSettings() + .setRetrySettings(mergeVersionAliasesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for mergeVersionAliases from properties."); + } + } + Retry importModelEvaluationRetry = clientProperties.getImportModelEvaluationRetry(); + if (importModelEvaluationRetry != null) { + RetrySettings importModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importModelEvaluationSettings().getRetrySettings(), + importModelEvaluationRetry); + clientSettingsBuilder + .importModelEvaluationSettings() + .setRetrySettings(importModelEvaluationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for importModelEvaluation from properties."); + } + } + Retry batchImportModelEvaluationSlicesRetry = + clientProperties.getBatchImportModelEvaluationSlicesRetry(); + if (batchImportModelEvaluationSlicesRetry != null) { + RetrySettings batchImportModelEvaluationSlicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchImportModelEvaluationSlicesSettings().getRetrySettings(), + batchImportModelEvaluationSlicesRetry); + clientSettingsBuilder + .batchImportModelEvaluationSlicesSettings() + .setRetrySettings(batchImportModelEvaluationSlicesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchImportModelEvaluationSlices from properties."); + } + } + Retry getModelEvaluationRetry = clientProperties.getGetModelEvaluationRetry(); + if (getModelEvaluationRetry != null) { + RetrySettings getModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSettings().getRetrySettings(), + getModelEvaluationRetry); + clientSettingsBuilder + .getModelEvaluationSettings() + .setRetrySettings(getModelEvaluationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getModelEvaluation from properties."); + } + } + Retry listModelEvaluationsRetry = clientProperties.getListModelEvaluationsRetry(); + if (listModelEvaluationsRetry != null) { + RetrySettings listModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationsSettings().getRetrySettings(), + listModelEvaluationsRetry); + clientSettingsBuilder + .listModelEvaluationsSettings() + .setRetrySettings(listModelEvaluationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listModelEvaluations from properties."); + } + } + Retry getModelEvaluationSliceRetry = clientProperties.getGetModelEvaluationSliceRetry(); + if (getModelEvaluationSliceRetry != null) { + RetrySettings getModelEvaluationSliceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSliceSettings().getRetrySettings(), + getModelEvaluationSliceRetry); + clientSettingsBuilder + .getModelEvaluationSliceSettings() + .setRetrySettings(getModelEvaluationSliceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getModelEvaluationSlice from properties."); + } + } + Retry listModelEvaluationSlicesRetry = clientProperties.getListModelEvaluationSlicesRetry(); + if (listModelEvaluationSlicesRetry != null) { + RetrySettings listModelEvaluationSlicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationSlicesSettings().getRetrySettings(), + listModelEvaluationSlicesRetry); + clientSettingsBuilder + .listModelEvaluationSlicesSettings() + .setRetrySettings(listModelEvaluationSlicesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listModelEvaluationSlices 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 ModelServiceClient bean configured with ModelServiceSettings. + * + * @param modelServiceSettings settings to configure an instance of client bean. + * @return a {@link ModelServiceClient} bean configured with {@link ModelServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ModelServiceClient modelServiceClient(ModelServiceSettings modelServiceSettings) + throws IOException { + return ModelServiceClient.create(modelServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-model-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/ModelServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringProperties.java new file mode 100644 index 0000000000..a9bd301aaf --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/ModelServiceSpringProperties.java @@ -0,0 +1,281 @@ +/* + * Copyright 2022 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 ModelService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.model-service") +public class ModelServiceSpringProperties 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 getModel. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelRetry; + /** + * Allow override of retry settings at method-level for listModels. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelsRetry; + /** + * Allow override of retry settings at method-level for listModelVersions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelVersionsRetry; + /** + * Allow override of retry settings at method-level for updateModel. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateModelRetry; + /** + * Allow override of retry settings at method-level for mergeVersionAliases. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry mergeVersionAliasesRetry; + /** + * Allow override of retry settings at method-level for importModelEvaluation. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry importModelEvaluationRetry; + /** + * Allow override of retry settings at method-level for batchImportModelEvaluationSlices. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchImportModelEvaluationSlicesRetry; + /** + * Allow override of retry settings at method-level for getModelEvaluation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelEvaluationRetry; + /** + * Allow override of retry settings at method-level for listModelEvaluations. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelEvaluationsRetry; + /** + * Allow override of retry settings at method-level for getModelEvaluationSlice. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelEvaluationSliceRetry; + /** + * Allow override of retry settings at method-level for listModelEvaluationSlices. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelEvaluationSlicesRetry; + /** + * 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 getGetModelRetry() { + return this.getModelRetry; + } + + public void setGetModelRetry(Retry getModelRetry) { + this.getModelRetry = getModelRetry; + } + + public Retry getListModelsRetry() { + return this.listModelsRetry; + } + + public void setListModelsRetry(Retry listModelsRetry) { + this.listModelsRetry = listModelsRetry; + } + + public Retry getListModelVersionsRetry() { + return this.listModelVersionsRetry; + } + + public void setListModelVersionsRetry(Retry listModelVersionsRetry) { + this.listModelVersionsRetry = listModelVersionsRetry; + } + + public Retry getUpdateModelRetry() { + return this.updateModelRetry; + } + + public void setUpdateModelRetry(Retry updateModelRetry) { + this.updateModelRetry = updateModelRetry; + } + + public Retry getMergeVersionAliasesRetry() { + return this.mergeVersionAliasesRetry; + } + + public void setMergeVersionAliasesRetry(Retry mergeVersionAliasesRetry) { + this.mergeVersionAliasesRetry = mergeVersionAliasesRetry; + } + + public Retry getImportModelEvaluationRetry() { + return this.importModelEvaluationRetry; + } + + public void setImportModelEvaluationRetry(Retry importModelEvaluationRetry) { + this.importModelEvaluationRetry = importModelEvaluationRetry; + } + + public Retry getBatchImportModelEvaluationSlicesRetry() { + return this.batchImportModelEvaluationSlicesRetry; + } + + public void setBatchImportModelEvaluationSlicesRetry( + Retry batchImportModelEvaluationSlicesRetry) { + this.batchImportModelEvaluationSlicesRetry = batchImportModelEvaluationSlicesRetry; + } + + public Retry getGetModelEvaluationRetry() { + return this.getModelEvaluationRetry; + } + + public void setGetModelEvaluationRetry(Retry getModelEvaluationRetry) { + this.getModelEvaluationRetry = getModelEvaluationRetry; + } + + public Retry getListModelEvaluationsRetry() { + return this.listModelEvaluationsRetry; + } + + public void setListModelEvaluationsRetry(Retry listModelEvaluationsRetry) { + this.listModelEvaluationsRetry = listModelEvaluationsRetry; + } + + public Retry getGetModelEvaluationSliceRetry() { + return this.getModelEvaluationSliceRetry; + } + + public void setGetModelEvaluationSliceRetry(Retry getModelEvaluationSliceRetry) { + this.getModelEvaluationSliceRetry = getModelEvaluationSliceRetry; + } + + public Retry getListModelEvaluationSlicesRetry() { + return this.listModelEvaluationSlicesRetry; + } + + public void setListModelEvaluationSlicesRetry(Retry listModelEvaluationSlicesRetry) { + this.listModelEvaluationSlicesRetry = listModelEvaluationSlicesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..81aa12f462 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringAutoConfiguration.java @@ -0,0 +1,422 @@ +/* + * Copyright 2022 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.PipelineServiceClient; +import com.google.cloud.aiplatform.v1.PipelineServiceSettings; +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 PipelineServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in PipelineServiceSpringProperties. 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 PipelineServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public PipelineServiceSettings pipelineServiceSettings( + @Qualifier("defaultPipelineServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PipelineServiceSettings.Builder clientSettingsBuilder = PipelineServiceSettings.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 = + PipelineServiceSettings.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 createTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTrainingPipelineSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings(createTrainingPipelineRetrySettings); + + RetrySettings getTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTrainingPipelineSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getTrainingPipelineSettings() + .setRetrySettings(getTrainingPipelineRetrySettings); + + RetrySettings listTrainingPipelinesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTrainingPipelinesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listTrainingPipelinesSettings() + .setRetrySettings(listTrainingPipelinesRetrySettings); + + RetrySettings cancelTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelTrainingPipelineSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .cancelTrainingPipelineSettings() + .setRetrySettings(cancelTrainingPipelineRetrySettings); + + RetrySettings createPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createPipelineJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createPipelineJobSettings() + .setRetrySettings(createPipelineJobRetrySettings); + + RetrySettings getPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPipelineJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPipelineJobSettings().setRetrySettings(getPipelineJobRetrySettings); + + RetrySettings listPipelineJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPipelineJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listPipelineJobsSettings() + .setRetrySettings(listPipelineJobsRetrySettings); + + RetrySettings cancelPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelPipelineJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .cancelPipelineJobSettings() + .setRetrySettings(cancelPipelineJobRetrySettings); + + 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 createTrainingPipelineRetry = clientProperties.getCreateTrainingPipelineRetry(); + if (createTrainingPipelineRetry != null) { + RetrySettings createTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTrainingPipelineSettings().getRetrySettings(), + createTrainingPipelineRetry); + clientSettingsBuilder + .createTrainingPipelineSettings() + .setRetrySettings(createTrainingPipelineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTrainingPipeline from properties."); + } + } + Retry getTrainingPipelineRetry = clientProperties.getGetTrainingPipelineRetry(); + if (getTrainingPipelineRetry != null) { + RetrySettings getTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTrainingPipelineSettings().getRetrySettings(), + getTrainingPipelineRetry); + clientSettingsBuilder + .getTrainingPipelineSettings() + .setRetrySettings(getTrainingPipelineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTrainingPipeline from properties."); + } + } + Retry listTrainingPipelinesRetry = clientProperties.getListTrainingPipelinesRetry(); + if (listTrainingPipelinesRetry != null) { + RetrySettings listTrainingPipelinesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTrainingPipelinesSettings().getRetrySettings(), + listTrainingPipelinesRetry); + clientSettingsBuilder + .listTrainingPipelinesSettings() + .setRetrySettings(listTrainingPipelinesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTrainingPipelines from properties."); + } + } + Retry cancelTrainingPipelineRetry = clientProperties.getCancelTrainingPipelineRetry(); + if (cancelTrainingPipelineRetry != null) { + RetrySettings cancelTrainingPipelineRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelTrainingPipelineSettings().getRetrySettings(), + cancelTrainingPipelineRetry); + clientSettingsBuilder + .cancelTrainingPipelineSettings() + .setRetrySettings(cancelTrainingPipelineRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for cancelTrainingPipeline from properties."); + } + } + Retry createPipelineJobRetry = clientProperties.getCreatePipelineJobRetry(); + if (createPipelineJobRetry != null) { + RetrySettings createPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createPipelineJobSettings().getRetrySettings(), + createPipelineJobRetry); + clientSettingsBuilder + .createPipelineJobSettings() + .setRetrySettings(createPipelineJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createPipelineJob from properties."); + } + } + Retry getPipelineJobRetry = clientProperties.getGetPipelineJobRetry(); + if (getPipelineJobRetry != null) { + RetrySettings getPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPipelineJobSettings().getRetrySettings(), + getPipelineJobRetry); + clientSettingsBuilder.getPipelineJobSettings().setRetrySettings(getPipelineJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPipelineJob from properties."); + } + } + Retry listPipelineJobsRetry = clientProperties.getListPipelineJobsRetry(); + if (listPipelineJobsRetry != null) { + RetrySettings listPipelineJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPipelineJobsSettings().getRetrySettings(), + listPipelineJobsRetry); + clientSettingsBuilder + .listPipelineJobsSettings() + .setRetrySettings(listPipelineJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPipelineJobs from properties."); + } + } + Retry cancelPipelineJobRetry = clientProperties.getCancelPipelineJobRetry(); + if (cancelPipelineJobRetry != null) { + RetrySettings cancelPipelineJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelPipelineJobSettings().getRetrySettings(), + cancelPipelineJobRetry); + clientSettingsBuilder + .cancelPipelineJobSettings() + .setRetrySettings(cancelPipelineJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for cancelPipelineJob 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 PipelineServiceClient bean configured with PipelineServiceSettings. + * + * @param pipelineServiceSettings settings to configure an instance of client bean. + * @return a {@link PipelineServiceClient} bean configured with {@link PipelineServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public PipelineServiceClient pipelineServiceClient( + PipelineServiceSettings pipelineServiceSettings) throws IOException { + return PipelineServiceClient.create(pipelineServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-pipeline-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/PipelineServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringProperties.java new file mode 100644 index 0000000000..aeb513c29a --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PipelineServiceSpringProperties.java @@ -0,0 +1,241 @@ +/* + * Copyright 2022 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 PipelineService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.pipeline-service") +public class PipelineServiceSpringProperties 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 createTrainingPipeline. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTrainingPipelineRetry; + /** + * Allow override of retry settings at method-level for getTrainingPipeline. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTrainingPipelineRetry; + /** + * Allow override of retry settings at method-level for listTrainingPipelines. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTrainingPipelinesRetry; + /** + * Allow override of retry settings at method-level for cancelTrainingPipeline. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelTrainingPipelineRetry; + /** + * Allow override of retry settings at method-level for createPipelineJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createPipelineJobRetry; + /** + * Allow override of retry settings at method-level for getPipelineJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPipelineJobRetry; + /** + * Allow override of retry settings at method-level for listPipelineJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPipelineJobsRetry; + /** + * Allow override of retry settings at method-level for cancelPipelineJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelPipelineJobRetry; + /** + * 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 getCreateTrainingPipelineRetry() { + return this.createTrainingPipelineRetry; + } + + public void setCreateTrainingPipelineRetry(Retry createTrainingPipelineRetry) { + this.createTrainingPipelineRetry = createTrainingPipelineRetry; + } + + public Retry getGetTrainingPipelineRetry() { + return this.getTrainingPipelineRetry; + } + + public void setGetTrainingPipelineRetry(Retry getTrainingPipelineRetry) { + this.getTrainingPipelineRetry = getTrainingPipelineRetry; + } + + public Retry getListTrainingPipelinesRetry() { + return this.listTrainingPipelinesRetry; + } + + public void setListTrainingPipelinesRetry(Retry listTrainingPipelinesRetry) { + this.listTrainingPipelinesRetry = listTrainingPipelinesRetry; + } + + public Retry getCancelTrainingPipelineRetry() { + return this.cancelTrainingPipelineRetry; + } + + public void setCancelTrainingPipelineRetry(Retry cancelTrainingPipelineRetry) { + this.cancelTrainingPipelineRetry = cancelTrainingPipelineRetry; + } + + public Retry getCreatePipelineJobRetry() { + return this.createPipelineJobRetry; + } + + public void setCreatePipelineJobRetry(Retry createPipelineJobRetry) { + this.createPipelineJobRetry = createPipelineJobRetry; + } + + public Retry getGetPipelineJobRetry() { + return this.getPipelineJobRetry; + } + + public void setGetPipelineJobRetry(Retry getPipelineJobRetry) { + this.getPipelineJobRetry = getPipelineJobRetry; + } + + public Retry getListPipelineJobsRetry() { + return this.listPipelineJobsRetry; + } + + public void setListPipelineJobsRetry(Retry listPipelineJobsRetry) { + this.listPipelineJobsRetry = listPipelineJobsRetry; + } + + public Retry getCancelPipelineJobRetry() { + return this.cancelPipelineJobRetry; + } + + public void setCancelPipelineJobRetry(Retry cancelPipelineJobRetry) { + this.cancelPipelineJobRetry = cancelPipelineJobRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..3c7567edc2 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringAutoConfiguration.java @@ -0,0 +1,304 @@ +/* + * Copyright 2022 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.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.PredictionServiceSettings; +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 PredictionServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in PredictionServiceSpringProperties. 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 PredictionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public PredictionServiceSettings predictionServiceSettings( + @Qualifier("defaultPredictionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PredictionServiceSettings.Builder clientSettingsBuilder = + PredictionServiceSettings.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 = + PredictionServiceSettings.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 predictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.predictSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings); + + RetrySettings rawPredictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rawPredictSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.rawPredictSettings().setRetrySettings(rawPredictRetrySettings); + + RetrySettings explainRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.explainSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.explainSettings().setRetrySettings(explainRetrySettings); + + 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 predictRetry = clientProperties.getPredictRetry(); + if (predictRetry != null) { + RetrySettings predictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.predictSettings().getRetrySettings(), predictRetry); + clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for predict from properties."); + } + } + Retry rawPredictRetry = clientProperties.getRawPredictRetry(); + if (rawPredictRetry != null) { + RetrySettings rawPredictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.rawPredictSettings().getRetrySettings(), rawPredictRetry); + clientSettingsBuilder.rawPredictSettings().setRetrySettings(rawPredictRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for rawPredict from properties."); + } + } + Retry explainRetry = clientProperties.getExplainRetry(); + if (explainRetry != null) { + RetrySettings explainRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.explainSettings().getRetrySettings(), explainRetry); + clientSettingsBuilder.explainSettings().setRetrySettings(explainRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for explain 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 PredictionServiceClient bean configured with PredictionServiceSettings. + * + * @param predictionServiceSettings settings to configure an instance of client bean. + * @return a {@link PredictionServiceClient} bean configured with {@link + * PredictionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public PredictionServiceClient predictionServiceClient( + PredictionServiceSettings predictionServiceSettings) throws IOException { + return PredictionServiceClient.create(predictionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-prediction-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/PredictionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java new file mode 100644 index 0000000000..23c0914619 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/PredictionServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * Copyright 2022 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 PredictionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.prediction-service") +public class PredictionServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** 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 predict. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry predictRetry; + /** + * Allow override of retry settings at method-level for rawPredict. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry rawPredictRetry; + /** + * Allow override of retry settings at method-level for explain. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry explainRetry; + /** + * 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 getPredictRetry() { + return this.predictRetry; + } + + public void setPredictRetry(Retry predictRetry) { + this.predictRetry = predictRetry; + } + + public Retry getRawPredictRetry() { + return this.rawPredictRetry; + } + + public void setRawPredictRetry(Retry rawPredictRetry) { + this.rawPredictRetry = rawPredictRetry; + } + + public Retry getExplainRetry() { + return this.explainRetry; + } + + public void setExplainRetry(Retry explainRetry) { + this.explainRetry = explainRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..39d0dda0b6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringAutoConfiguration.java @@ -0,0 +1,302 @@ +/* + * Copyright 2022 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.SpecialistPoolServiceClient; +import com.google.cloud.aiplatform.v1.SpecialistPoolServiceSettings; +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 SpecialistPoolServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in SpecialistPoolServiceSpringProperties. 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 SpecialistPoolServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SpecialistPoolServiceSettings specialistPoolServiceSettings( + @Qualifier("defaultSpecialistPoolServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SpecialistPoolServiceSettings.Builder clientSettingsBuilder = + SpecialistPoolServiceSettings.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 = + SpecialistPoolServiceSettings.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 getSpecialistPoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSpecialistPoolSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings(getSpecialistPoolRetrySettings); + + RetrySettings listSpecialistPoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSpecialistPoolsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listSpecialistPoolsSettings() + .setRetrySettings(listSpecialistPoolsRetrySettings); + + 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 getSpecialistPoolRetry = clientProperties.getGetSpecialistPoolRetry(); + if (getSpecialistPoolRetry != null) { + RetrySettings getSpecialistPoolRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSpecialistPoolSettings().getRetrySettings(), + getSpecialistPoolRetry); + clientSettingsBuilder + .getSpecialistPoolSettings() + .setRetrySettings(getSpecialistPoolRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getSpecialistPool from properties."); + } + } + Retry listSpecialistPoolsRetry = clientProperties.getListSpecialistPoolsRetry(); + if (listSpecialistPoolsRetry != null) { + RetrySettings listSpecialistPoolsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSpecialistPoolsSettings().getRetrySettings(), + listSpecialistPoolsRetry); + clientSettingsBuilder + .listSpecialistPoolsSettings() + .setRetrySettings(listSpecialistPoolsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSpecialistPools 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 SpecialistPoolServiceClient bean configured with SpecialistPoolServiceSettings. + * + * @param specialistPoolServiceSettings settings to configure an instance of client bean. + * @return a {@link SpecialistPoolServiceClient} bean configured with {@link + * SpecialistPoolServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SpecialistPoolServiceClient specialistPoolServiceClient( + SpecialistPoolServiceSettings specialistPoolServiceSettings) throws IOException { + return SpecialistPoolServiceClient.create(specialistPoolServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-specialist-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/SpecialistPoolServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringProperties.java new file mode 100644 index 0000000000..8fccbb95ac --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/SpecialistPoolServiceSpringProperties.java @@ -0,0 +1,163 @@ +/* + * Copyright 2022 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 SpecialistPoolService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.specialist-pool-service") +public class SpecialistPoolServiceSpringProperties 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 getSpecialistPool. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSpecialistPoolRetry; + /** + * Allow override of retry settings at method-level for listSpecialistPools. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSpecialistPoolsRetry; + /** + * 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 getGetSpecialistPoolRetry() { + return this.getSpecialistPoolRetry; + } + + public void setGetSpecialistPoolRetry(Retry getSpecialistPoolRetry) { + this.getSpecialistPoolRetry = getSpecialistPoolRetry; + } + + public Retry getListSpecialistPoolsRetry() { + return this.listSpecialistPoolsRetry; + } + + public void setListSpecialistPoolsRetry(Retry listSpecialistPoolsRetry) { + this.listSpecialistPoolsRetry = listSpecialistPoolsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..84ee8e9192 --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringAutoConfiguration.java @@ -0,0 +1,717 @@ +/* + * Copyright 2022 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.TensorboardServiceClient; +import com.google.cloud.aiplatform.v1.TensorboardServiceSettings; +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 TensorboardServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in TensorboardServiceSpringProperties. 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 TensorboardServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public TensorboardServiceSettings tensorboardServiceSettings( + @Qualifier("defaultTensorboardServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + TensorboardServiceSettings.Builder clientSettingsBuilder = + TensorboardServiceSettings.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 = + TensorboardServiceSettings.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 getTensorboardRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getTensorboardSettings().setRetrySettings(getTensorboardRetrySettings); + + RetrySettings listTensorboardsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listTensorboardsSettings() + .setRetrySettings(listTensorboardsRetrySettings); + + RetrySettings createTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardExperimentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTensorboardExperimentSettings() + .setRetrySettings(createTensorboardExperimentRetrySettings); + + RetrySettings getTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardExperimentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getTensorboardExperimentSettings() + .setRetrySettings(getTensorboardExperimentRetrySettings); + + RetrySettings updateTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardExperimentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateTensorboardExperimentSettings() + .setRetrySettings(updateTensorboardExperimentRetrySettings); + + RetrySettings listTensorboardExperimentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardExperimentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listTensorboardExperimentsSettings() + .setRetrySettings(listTensorboardExperimentsRetrySettings); + + RetrySettings createTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardRunSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTensorboardRunSettings() + .setRetrySettings(createTensorboardRunRetrySettings); + + RetrySettings batchCreateTensorboardRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchCreateTensorboardRunsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchCreateTensorboardRunsSettings() + .setRetrySettings(batchCreateTensorboardRunsRetrySettings); + + RetrySettings getTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardRunSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getTensorboardRunSettings() + .setRetrySettings(getTensorboardRunRetrySettings); + + RetrySettings updateTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardRunSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateTensorboardRunSettings() + .setRetrySettings(updateTensorboardRunRetrySettings); + + RetrySettings listTensorboardRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardRunsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listTensorboardRunsSettings() + .setRetrySettings(listTensorboardRunsRetrySettings); + + RetrySettings batchCreateTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchCreateTensorboardTimeSeriesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchCreateTensorboardTimeSeriesSettings() + .setRetrySettings(batchCreateTensorboardTimeSeriesRetrySettings); + + RetrySettings createTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardTimeSeriesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTensorboardTimeSeriesSettings() + .setRetrySettings(createTensorboardTimeSeriesRetrySettings); + + RetrySettings getTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardTimeSeriesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getTensorboardTimeSeriesSettings() + .setRetrySettings(getTensorboardTimeSeriesRetrySettings); + + RetrySettings updateTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardTimeSeriesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateTensorboardTimeSeriesSettings() + .setRetrySettings(updateTensorboardTimeSeriesRetrySettings); + + RetrySettings listTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardTimeSeriesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listTensorboardTimeSeriesSettings() + .setRetrySettings(listTensorboardTimeSeriesRetrySettings); + + RetrySettings batchReadTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchReadTensorboardTimeSeriesDataSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchReadTensorboardTimeSeriesDataSettings() + .setRetrySettings(batchReadTensorboardTimeSeriesDataRetrySettings); + + RetrySettings readTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.readTensorboardTimeSeriesDataSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .readTensorboardTimeSeriesDataSettings() + .setRetrySettings(readTensorboardTimeSeriesDataRetrySettings); + + RetrySettings writeTensorboardExperimentDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeTensorboardExperimentDataSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .writeTensorboardExperimentDataSettings() + .setRetrySettings(writeTensorboardExperimentDataRetrySettings); + + RetrySettings writeTensorboardRunDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeTensorboardRunDataSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .writeTensorboardRunDataSettings() + .setRetrySettings(writeTensorboardRunDataRetrySettings); + + RetrySettings exportTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportTensorboardTimeSeriesDataSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .exportTensorboardTimeSeriesDataSettings() + .setRetrySettings(exportTensorboardTimeSeriesDataRetrySettings); + + 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 getTensorboardRetry = clientProperties.getGetTensorboardRetry(); + if (getTensorboardRetry != null) { + RetrySettings getTensorboardRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardSettings().getRetrySettings(), + getTensorboardRetry); + clientSettingsBuilder.getTensorboardSettings().setRetrySettings(getTensorboardRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getTensorboard from properties."); + } + } + Retry listTensorboardsRetry = clientProperties.getListTensorboardsRetry(); + if (listTensorboardsRetry != null) { + RetrySettings listTensorboardsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardsSettings().getRetrySettings(), + listTensorboardsRetry); + clientSettingsBuilder + .listTensorboardsSettings() + .setRetrySettings(listTensorboardsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTensorboards from properties."); + } + } + Retry createTensorboardExperimentRetry = clientProperties.getCreateTensorboardExperimentRetry(); + if (createTensorboardExperimentRetry != null) { + RetrySettings createTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardExperimentSettings().getRetrySettings(), + createTensorboardExperimentRetry); + clientSettingsBuilder + .createTensorboardExperimentSettings() + .setRetrySettings(createTensorboardExperimentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTensorboardExperiment from properties."); + } + } + Retry getTensorboardExperimentRetry = clientProperties.getGetTensorboardExperimentRetry(); + if (getTensorboardExperimentRetry != null) { + RetrySettings getTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardExperimentSettings().getRetrySettings(), + getTensorboardExperimentRetry); + clientSettingsBuilder + .getTensorboardExperimentSettings() + .setRetrySettings(getTensorboardExperimentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTensorboardExperiment from properties."); + } + } + Retry updateTensorboardExperimentRetry = clientProperties.getUpdateTensorboardExperimentRetry(); + if (updateTensorboardExperimentRetry != null) { + RetrySettings updateTensorboardExperimentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardExperimentSettings().getRetrySettings(), + updateTensorboardExperimentRetry); + clientSettingsBuilder + .updateTensorboardExperimentSettings() + .setRetrySettings(updateTensorboardExperimentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTensorboardExperiment from properties."); + } + } + Retry listTensorboardExperimentsRetry = clientProperties.getListTensorboardExperimentsRetry(); + if (listTensorboardExperimentsRetry != null) { + RetrySettings listTensorboardExperimentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardExperimentsSettings().getRetrySettings(), + listTensorboardExperimentsRetry); + clientSettingsBuilder + .listTensorboardExperimentsSettings() + .setRetrySettings(listTensorboardExperimentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTensorboardExperiments from properties."); + } + } + Retry createTensorboardRunRetry = clientProperties.getCreateTensorboardRunRetry(); + if (createTensorboardRunRetry != null) { + RetrySettings createTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardRunSettings().getRetrySettings(), + createTensorboardRunRetry); + clientSettingsBuilder + .createTensorboardRunSettings() + .setRetrySettings(createTensorboardRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTensorboardRun from properties."); + } + } + Retry batchCreateTensorboardRunsRetry = clientProperties.getBatchCreateTensorboardRunsRetry(); + if (batchCreateTensorboardRunsRetry != null) { + RetrySettings batchCreateTensorboardRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchCreateTensorboardRunsSettings().getRetrySettings(), + batchCreateTensorboardRunsRetry); + clientSettingsBuilder + .batchCreateTensorboardRunsSettings() + .setRetrySettings(batchCreateTensorboardRunsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchCreateTensorboardRuns from properties."); + } + } + Retry getTensorboardRunRetry = clientProperties.getGetTensorboardRunRetry(); + if (getTensorboardRunRetry != null) { + RetrySettings getTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardRunSettings().getRetrySettings(), + getTensorboardRunRetry); + clientSettingsBuilder + .getTensorboardRunSettings() + .setRetrySettings(getTensorboardRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTensorboardRun from properties."); + } + } + Retry updateTensorboardRunRetry = clientProperties.getUpdateTensorboardRunRetry(); + if (updateTensorboardRunRetry != null) { + RetrySettings updateTensorboardRunRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardRunSettings().getRetrySettings(), + updateTensorboardRunRetry); + clientSettingsBuilder + .updateTensorboardRunSettings() + .setRetrySettings(updateTensorboardRunRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTensorboardRun from properties."); + } + } + Retry listTensorboardRunsRetry = clientProperties.getListTensorboardRunsRetry(); + if (listTensorboardRunsRetry != null) { + RetrySettings listTensorboardRunsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardRunsSettings().getRetrySettings(), + listTensorboardRunsRetry); + clientSettingsBuilder + .listTensorboardRunsSettings() + .setRetrySettings(listTensorboardRunsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTensorboardRuns from properties."); + } + } + Retry batchCreateTensorboardTimeSeriesRetry = + clientProperties.getBatchCreateTensorboardTimeSeriesRetry(); + if (batchCreateTensorboardTimeSeriesRetry != null) { + RetrySettings batchCreateTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchCreateTensorboardTimeSeriesSettings().getRetrySettings(), + batchCreateTensorboardTimeSeriesRetry); + clientSettingsBuilder + .batchCreateTensorboardTimeSeriesSettings() + .setRetrySettings(batchCreateTensorboardTimeSeriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchCreateTensorboardTimeSeries from properties."); + } + } + Retry createTensorboardTimeSeriesRetry = clientProperties.getCreateTensorboardTimeSeriesRetry(); + if (createTensorboardTimeSeriesRetry != null) { + RetrySettings createTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTensorboardTimeSeriesSettings().getRetrySettings(), + createTensorboardTimeSeriesRetry); + clientSettingsBuilder + .createTensorboardTimeSeriesSettings() + .setRetrySettings(createTensorboardTimeSeriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTensorboardTimeSeries from properties."); + } + } + Retry getTensorboardTimeSeriesRetry = clientProperties.getGetTensorboardTimeSeriesRetry(); + if (getTensorboardTimeSeriesRetry != null) { + RetrySettings getTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTensorboardTimeSeriesSettings().getRetrySettings(), + getTensorboardTimeSeriesRetry); + clientSettingsBuilder + .getTensorboardTimeSeriesSettings() + .setRetrySettings(getTensorboardTimeSeriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getTensorboardTimeSeries from properties."); + } + } + Retry updateTensorboardTimeSeriesRetry = clientProperties.getUpdateTensorboardTimeSeriesRetry(); + if (updateTensorboardTimeSeriesRetry != null) { + RetrySettings updateTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTensorboardTimeSeriesSettings().getRetrySettings(), + updateTensorboardTimeSeriesRetry); + clientSettingsBuilder + .updateTensorboardTimeSeriesSettings() + .setRetrySettings(updateTensorboardTimeSeriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTensorboardTimeSeries from properties."); + } + } + Retry listTensorboardTimeSeriesRetry = clientProperties.getListTensorboardTimeSeriesRetry(); + if (listTensorboardTimeSeriesRetry != null) { + RetrySettings listTensorboardTimeSeriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTensorboardTimeSeriesSettings().getRetrySettings(), + listTensorboardTimeSeriesRetry); + clientSettingsBuilder + .listTensorboardTimeSeriesSettings() + .setRetrySettings(listTensorboardTimeSeriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listTensorboardTimeSeries from properties."); + } + } + Retry batchReadTensorboardTimeSeriesDataRetry = + clientProperties.getBatchReadTensorboardTimeSeriesDataRetry(); + if (batchReadTensorboardTimeSeriesDataRetry != null) { + RetrySettings batchReadTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchReadTensorboardTimeSeriesDataSettings().getRetrySettings(), + batchReadTensorboardTimeSeriesDataRetry); + clientSettingsBuilder + .batchReadTensorboardTimeSeriesDataSettings() + .setRetrySettings(batchReadTensorboardTimeSeriesDataRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchReadTensorboardTimeSeriesData from properties."); + } + } + Retry readTensorboardTimeSeriesDataRetry = + clientProperties.getReadTensorboardTimeSeriesDataRetry(); + if (readTensorboardTimeSeriesDataRetry != null) { + RetrySettings readTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.readTensorboardTimeSeriesDataSettings().getRetrySettings(), + readTensorboardTimeSeriesDataRetry); + clientSettingsBuilder + .readTensorboardTimeSeriesDataSettings() + .setRetrySettings(readTensorboardTimeSeriesDataRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for readTensorboardTimeSeriesData from properties."); + } + } + Retry writeTensorboardExperimentDataRetry = + clientProperties.getWriteTensorboardExperimentDataRetry(); + if (writeTensorboardExperimentDataRetry != null) { + RetrySettings writeTensorboardExperimentDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeTensorboardExperimentDataSettings().getRetrySettings(), + writeTensorboardExperimentDataRetry); + clientSettingsBuilder + .writeTensorboardExperimentDataSettings() + .setRetrySettings(writeTensorboardExperimentDataRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for writeTensorboardExperimentData from properties."); + } + } + Retry writeTensorboardRunDataRetry = clientProperties.getWriteTensorboardRunDataRetry(); + if (writeTensorboardRunDataRetry != null) { + RetrySettings writeTensorboardRunDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.writeTensorboardRunDataSettings().getRetrySettings(), + writeTensorboardRunDataRetry); + clientSettingsBuilder + .writeTensorboardRunDataSettings() + .setRetrySettings(writeTensorboardRunDataRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for writeTensorboardRunData from properties."); + } + } + Retry exportTensorboardTimeSeriesDataRetry = + clientProperties.getExportTensorboardTimeSeriesDataRetry(); + if (exportTensorboardTimeSeriesDataRetry != null) { + RetrySettings exportTensorboardTimeSeriesDataRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportTensorboardTimeSeriesDataSettings().getRetrySettings(), + exportTensorboardTimeSeriesDataRetry); + clientSettingsBuilder + .exportTensorboardTimeSeriesDataSettings() + .setRetrySettings(exportTensorboardTimeSeriesDataRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for exportTensorboardTimeSeriesData 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 TensorboardServiceClient bean configured with TensorboardServiceSettings. + * + * @param tensorboardServiceSettings settings to configure an instance of client bean. + * @return a {@link TensorboardServiceClient} bean configured with {@link + * TensorboardServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public TensorboardServiceClient tensorboardServiceClient( + TensorboardServiceSettings tensorboardServiceSettings) throws IOException { + return TensorboardServiceClient.create(tensorboardServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-tensorboard-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/TensorboardServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringProperties.java new file mode 100644 index 0000000000..6a0f55d30a --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/TensorboardServiceSpringProperties.java @@ -0,0 +1,414 @@ +/* + * Copyright 2022 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 TensorboardService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.aiplatform.v1.tensorboard-service") +public class TensorboardServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of 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 getTensorboard. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTensorboardRetry; + /** + * Allow override of retry settings at method-level for listTensorboards. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTensorboardsRetry; + /** + * Allow override of retry settings at method-level for createTensorboardExperiment. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTensorboardExperimentRetry; + /** + * Allow override of retry settings at method-level for getTensorboardExperiment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTensorboardExperimentRetry; + /** + * Allow override of retry settings at method-level for updateTensorboardExperiment. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTensorboardExperimentRetry; + /** + * Allow override of retry settings at method-level for listTensorboardExperiments. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTensorboardExperimentsRetry; + /** + * Allow override of retry settings at method-level for createTensorboardRun. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTensorboardRunRetry; + /** + * Allow override of retry settings at method-level for batchCreateTensorboardRuns. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchCreateTensorboardRunsRetry; + /** + * Allow override of retry settings at method-level for getTensorboardRun. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTensorboardRunRetry; + /** + * Allow override of retry settings at method-level for updateTensorboardRun. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTensorboardRunRetry; + /** + * Allow override of retry settings at method-level for listTensorboardRuns. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTensorboardRunsRetry; + /** + * Allow override of retry settings at method-level for batchCreateTensorboardTimeSeries. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchCreateTensorboardTimeSeriesRetry; + /** + * Allow override of retry settings at method-level for createTensorboardTimeSeries. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTensorboardTimeSeriesRetry; + /** + * Allow override of retry settings at method-level for getTensorboardTimeSeries. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTensorboardTimeSeriesRetry; + /** + * Allow override of retry settings at method-level for updateTensorboardTimeSeries. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTensorboardTimeSeriesRetry; + /** + * Allow override of retry settings at method-level for listTensorboardTimeSeries. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTensorboardTimeSeriesRetry; + /** + * Allow override of retry settings at method-level for batchReadTensorboardTimeSeriesData. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchReadTensorboardTimeSeriesDataRetry; + /** + * Allow override of retry settings at method-level for readTensorboardTimeSeriesData. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry readTensorboardTimeSeriesDataRetry; + /** + * Allow override of retry settings at method-level for writeTensorboardExperimentData. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry writeTensorboardExperimentDataRetry; + /** + * Allow override of retry settings at method-level for writeTensorboardRunData. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry writeTensorboardRunDataRetry; + /** + * Allow override of retry settings at method-level for exportTensorboardTimeSeriesData. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportTensorboardTimeSeriesDataRetry; + /** + * 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 getGetTensorboardRetry() { + return this.getTensorboardRetry; + } + + public void setGetTensorboardRetry(Retry getTensorboardRetry) { + this.getTensorboardRetry = getTensorboardRetry; + } + + public Retry getListTensorboardsRetry() { + return this.listTensorboardsRetry; + } + + public void setListTensorboardsRetry(Retry listTensorboardsRetry) { + this.listTensorboardsRetry = listTensorboardsRetry; + } + + public Retry getCreateTensorboardExperimentRetry() { + return this.createTensorboardExperimentRetry; + } + + public void setCreateTensorboardExperimentRetry(Retry createTensorboardExperimentRetry) { + this.createTensorboardExperimentRetry = createTensorboardExperimentRetry; + } + + public Retry getGetTensorboardExperimentRetry() { + return this.getTensorboardExperimentRetry; + } + + public void setGetTensorboardExperimentRetry(Retry getTensorboardExperimentRetry) { + this.getTensorboardExperimentRetry = getTensorboardExperimentRetry; + } + + public Retry getUpdateTensorboardExperimentRetry() { + return this.updateTensorboardExperimentRetry; + } + + public void setUpdateTensorboardExperimentRetry(Retry updateTensorboardExperimentRetry) { + this.updateTensorboardExperimentRetry = updateTensorboardExperimentRetry; + } + + public Retry getListTensorboardExperimentsRetry() { + return this.listTensorboardExperimentsRetry; + } + + public void setListTensorboardExperimentsRetry(Retry listTensorboardExperimentsRetry) { + this.listTensorboardExperimentsRetry = listTensorboardExperimentsRetry; + } + + public Retry getCreateTensorboardRunRetry() { + return this.createTensorboardRunRetry; + } + + public void setCreateTensorboardRunRetry(Retry createTensorboardRunRetry) { + this.createTensorboardRunRetry = createTensorboardRunRetry; + } + + public Retry getBatchCreateTensorboardRunsRetry() { + return this.batchCreateTensorboardRunsRetry; + } + + public void setBatchCreateTensorboardRunsRetry(Retry batchCreateTensorboardRunsRetry) { + this.batchCreateTensorboardRunsRetry = batchCreateTensorboardRunsRetry; + } + + public Retry getGetTensorboardRunRetry() { + return this.getTensorboardRunRetry; + } + + public void setGetTensorboardRunRetry(Retry getTensorboardRunRetry) { + this.getTensorboardRunRetry = getTensorboardRunRetry; + } + + public Retry getUpdateTensorboardRunRetry() { + return this.updateTensorboardRunRetry; + } + + public void setUpdateTensorboardRunRetry(Retry updateTensorboardRunRetry) { + this.updateTensorboardRunRetry = updateTensorboardRunRetry; + } + + public Retry getListTensorboardRunsRetry() { + return this.listTensorboardRunsRetry; + } + + public void setListTensorboardRunsRetry(Retry listTensorboardRunsRetry) { + this.listTensorboardRunsRetry = listTensorboardRunsRetry; + } + + public Retry getBatchCreateTensorboardTimeSeriesRetry() { + return this.batchCreateTensorboardTimeSeriesRetry; + } + + public void setBatchCreateTensorboardTimeSeriesRetry( + Retry batchCreateTensorboardTimeSeriesRetry) { + this.batchCreateTensorboardTimeSeriesRetry = batchCreateTensorboardTimeSeriesRetry; + } + + public Retry getCreateTensorboardTimeSeriesRetry() { + return this.createTensorboardTimeSeriesRetry; + } + + public void setCreateTensorboardTimeSeriesRetry(Retry createTensorboardTimeSeriesRetry) { + this.createTensorboardTimeSeriesRetry = createTensorboardTimeSeriesRetry; + } + + public Retry getGetTensorboardTimeSeriesRetry() { + return this.getTensorboardTimeSeriesRetry; + } + + public void setGetTensorboardTimeSeriesRetry(Retry getTensorboardTimeSeriesRetry) { + this.getTensorboardTimeSeriesRetry = getTensorboardTimeSeriesRetry; + } + + public Retry getUpdateTensorboardTimeSeriesRetry() { + return this.updateTensorboardTimeSeriesRetry; + } + + public void setUpdateTensorboardTimeSeriesRetry(Retry updateTensorboardTimeSeriesRetry) { + this.updateTensorboardTimeSeriesRetry = updateTensorboardTimeSeriesRetry; + } + + public Retry getListTensorboardTimeSeriesRetry() { + return this.listTensorboardTimeSeriesRetry; + } + + public void setListTensorboardTimeSeriesRetry(Retry listTensorboardTimeSeriesRetry) { + this.listTensorboardTimeSeriesRetry = listTensorboardTimeSeriesRetry; + } + + public Retry getBatchReadTensorboardTimeSeriesDataRetry() { + return this.batchReadTensorboardTimeSeriesDataRetry; + } + + public void setBatchReadTensorboardTimeSeriesDataRetry( + Retry batchReadTensorboardTimeSeriesDataRetry) { + this.batchReadTensorboardTimeSeriesDataRetry = batchReadTensorboardTimeSeriesDataRetry; + } + + public Retry getReadTensorboardTimeSeriesDataRetry() { + return this.readTensorboardTimeSeriesDataRetry; + } + + public void setReadTensorboardTimeSeriesDataRetry(Retry readTensorboardTimeSeriesDataRetry) { + this.readTensorboardTimeSeriesDataRetry = readTensorboardTimeSeriesDataRetry; + } + + public Retry getWriteTensorboardExperimentDataRetry() { + return this.writeTensorboardExperimentDataRetry; + } + + public void setWriteTensorboardExperimentDataRetry(Retry writeTensorboardExperimentDataRetry) { + this.writeTensorboardExperimentDataRetry = writeTensorboardExperimentDataRetry; + } + + public Retry getWriteTensorboardRunDataRetry() { + return this.writeTensorboardRunDataRetry; + } + + public void setWriteTensorboardRunDataRetry(Retry writeTensorboardRunDataRetry) { + this.writeTensorboardRunDataRetry = writeTensorboardRunDataRetry; + } + + public Retry getExportTensorboardTimeSeriesDataRetry() { + return this.exportTensorboardTimeSeriesDataRetry; + } + + public void setExportTensorboardTimeSeriesDataRetry(Retry exportTensorboardTimeSeriesDataRetry) { + this.exportTensorboardTimeSeriesDataRetry = exportTensorboardTimeSeriesDataRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..31712a7fcc --- /dev/null +++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringAutoConfiguration.java @@ -0,0 +1,463 @@ +/* + * Copyright 2022 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.VizierServiceClient; +import com.google.cloud.aiplatform.v1.VizierServiceSettings; +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 VizierServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VizierServiceSpringProperties. 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 VizierServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VizierServiceSettings vizierServiceSettings(
+ @Qualifier("defaultVizierServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VizierServiceSettings.Builder clientSettingsBuilder = VizierServiceSettings.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 =
+ VizierServiceSettings.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 createStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createStudySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createStudySettings().setRetrySettings(createStudyRetrySettings);
+
+ RetrySettings getStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStudySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getStudySettings().setRetrySettings(getStudyRetrySettings);
+
+ RetrySettings listStudiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStudiesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listStudiesSettings().setRetrySettings(listStudiesRetrySettings);
+
+ RetrySettings deleteStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteStudySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteStudySettings().setRetrySettings(deleteStudyRetrySettings);
+
+ RetrySettings lookupStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupStudySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.lookupStudySettings().setRetrySettings(lookupStudyRetrySettings);
+
+ RetrySettings createTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTrialSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createTrialSettings().setRetrySettings(createTrialRetrySettings);
+
+ RetrySettings getTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTrialSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTrialSettings().setRetrySettings(getTrialRetrySettings);
+
+ RetrySettings listTrialsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTrialsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTrialsSettings().setRetrySettings(listTrialsRetrySettings);
+
+ RetrySettings addTrialMeasurementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.addTrialMeasurementSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .addTrialMeasurementSettings()
+ .setRetrySettings(addTrialMeasurementRetrySettings);
+
+ RetrySettings completeTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeTrialSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.completeTrialSettings().setRetrySettings(completeTrialRetrySettings);
+
+ RetrySettings deleteTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTrialSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteTrialSettings().setRetrySettings(deleteTrialRetrySettings);
+
+ RetrySettings stopTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopTrialSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.stopTrialSettings().setRetrySettings(stopTrialRetrySettings);
+
+ RetrySettings listOptimalTrialsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOptimalTrialsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listOptimalTrialsSettings()
+ .setRetrySettings(listOptimalTrialsRetrySettings);
+
+ 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 createStudyRetry = clientProperties.getCreateStudyRetry();
+ if (createStudyRetry != null) {
+ RetrySettings createStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createStudySettings().getRetrySettings(), createStudyRetry);
+ clientSettingsBuilder.createStudySettings().setRetrySettings(createStudyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createStudy from properties.");
+ }
+ }
+ Retry getStudyRetry = clientProperties.getGetStudyRetry();
+ if (getStudyRetry != null) {
+ RetrySettings getStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStudySettings().getRetrySettings(), getStudyRetry);
+ clientSettingsBuilder.getStudySettings().setRetrySettings(getStudyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getStudy from properties.");
+ }
+ }
+ Retry listStudiesRetry = clientProperties.getListStudiesRetry();
+ if (listStudiesRetry != null) {
+ RetrySettings listStudiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStudiesSettings().getRetrySettings(), listStudiesRetry);
+ clientSettingsBuilder.listStudiesSettings().setRetrySettings(listStudiesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listStudies from properties.");
+ }
+ }
+ Retry deleteStudyRetry = clientProperties.getDeleteStudyRetry();
+ if (deleteStudyRetry != null) {
+ RetrySettings deleteStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteStudySettings().getRetrySettings(), deleteStudyRetry);
+ clientSettingsBuilder.deleteStudySettings().setRetrySettings(deleteStudyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteStudy from properties.");
+ }
+ }
+ Retry lookupStudyRetry = clientProperties.getLookupStudyRetry();
+ if (lookupStudyRetry != null) {
+ RetrySettings lookupStudyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupStudySettings().getRetrySettings(), lookupStudyRetry);
+ clientSettingsBuilder.lookupStudySettings().setRetrySettings(lookupStudyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for lookupStudy from properties.");
+ }
+ }
+ Retry createTrialRetry = clientProperties.getCreateTrialRetry();
+ if (createTrialRetry != null) {
+ RetrySettings createTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTrialSettings().getRetrySettings(), createTrialRetry);
+ clientSettingsBuilder.createTrialSettings().setRetrySettings(createTrialRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createTrial from properties.");
+ }
+ }
+ Retry getTrialRetry = clientProperties.getGetTrialRetry();
+ if (getTrialRetry != null) {
+ RetrySettings getTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTrialSettings().getRetrySettings(), getTrialRetry);
+ clientSettingsBuilder.getTrialSettings().setRetrySettings(getTrialRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTrial from properties.");
+ }
+ }
+ Retry listTrialsRetry = clientProperties.getListTrialsRetry();
+ if (listTrialsRetry != null) {
+ RetrySettings listTrialsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTrialsSettings().getRetrySettings(), listTrialsRetry);
+ clientSettingsBuilder.listTrialsSettings().setRetrySettings(listTrialsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTrials from properties.");
+ }
+ }
+ Retry addTrialMeasurementRetry = clientProperties.getAddTrialMeasurementRetry();
+ if (addTrialMeasurementRetry != null) {
+ RetrySettings addTrialMeasurementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.addTrialMeasurementSettings().getRetrySettings(),
+ addTrialMeasurementRetry);
+ clientSettingsBuilder
+ .addTrialMeasurementSettings()
+ .setRetrySettings(addTrialMeasurementRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for addTrialMeasurement from properties.");
+ }
+ }
+ Retry completeTrialRetry = clientProperties.getCompleteTrialRetry();
+ if (completeTrialRetry != null) {
+ RetrySettings completeTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeTrialSettings().getRetrySettings(), completeTrialRetry);
+ clientSettingsBuilder.completeTrialSettings().setRetrySettings(completeTrialRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for completeTrial from properties.");
+ }
+ }
+ Retry deleteTrialRetry = clientProperties.getDeleteTrialRetry();
+ if (deleteTrialRetry != null) {
+ RetrySettings deleteTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTrialSettings().getRetrySettings(), deleteTrialRetry);
+ clientSettingsBuilder.deleteTrialSettings().setRetrySettings(deleteTrialRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteTrial from properties.");
+ }
+ }
+ Retry stopTrialRetry = clientProperties.getStopTrialRetry();
+ if (stopTrialRetry != null) {
+ RetrySettings stopTrialRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopTrialSettings().getRetrySettings(), stopTrialRetry);
+ clientSettingsBuilder.stopTrialSettings().setRetrySettings(stopTrialRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for stopTrial from properties.");
+ }
+ }
+ Retry listOptimalTrialsRetry = clientProperties.getListOptimalTrialsRetry();
+ if (listOptimalTrialsRetry != null) {
+ RetrySettings listOptimalTrialsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOptimalTrialsSettings().getRetrySettings(),
+ listOptimalTrialsRetry);
+ clientSettingsBuilder
+ .listOptimalTrialsSettings()
+ .setRetrySettings(listOptimalTrialsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listOptimalTrials 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 VizierServiceClient bean configured with VizierServiceSettings.
+ *
+ * @param vizierServiceSettings settings to configure an instance of client bean.
+ * @return a {@link VizierServiceClient} bean configured with {@link VizierServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VizierServiceClient vizierServiceClient(VizierServiceSettings vizierServiceSettings)
+ throws IOException {
+ return VizierServiceClient.create(vizierServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-vizier-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/VizierServiceSpringProperties.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringProperties.java
new file mode 100644
index 0000000000..9ceb07c35b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/VizierServiceSpringProperties.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2022 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 VizierService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.aiplatform.v1.vizier-service")
+public class VizierServiceSpringProperties 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 createStudy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createStudyRetry;
+ /**
+ * Allow override of retry settings at method-level for getStudy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getStudyRetry;
+ /**
+ * Allow override of retry settings at method-level for listStudies. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listStudiesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteStudy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteStudyRetry;
+ /**
+ * Allow override of retry settings at method-level for lookupStudy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry lookupStudyRetry;
+ /**
+ * Allow override of retry settings at method-level for createTrial. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTrialRetry;
+ /**
+ * Allow override of retry settings at method-level for getTrial. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTrialRetry;
+ /**
+ * Allow override of retry settings at method-level for listTrials. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTrialsRetry;
+ /**
+ * Allow override of retry settings at method-level for addTrialMeasurement. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry addTrialMeasurementRetry;
+ /**
+ * Allow override of retry settings at method-level for completeTrial. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry completeTrialRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTrial. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTrialRetry;
+ /**
+ * Allow override of retry settings at method-level for stopTrial. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry stopTrialRetry;
+ /**
+ * Allow override of retry settings at method-level for listOptimalTrials. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOptimalTrialsRetry;
+ /**
+ * 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 getCreateStudyRetry() {
+ return this.createStudyRetry;
+ }
+
+ public void setCreateStudyRetry(Retry createStudyRetry) {
+ this.createStudyRetry = createStudyRetry;
+ }
+
+ public Retry getGetStudyRetry() {
+ return this.getStudyRetry;
+ }
+
+ public void setGetStudyRetry(Retry getStudyRetry) {
+ this.getStudyRetry = getStudyRetry;
+ }
+
+ public Retry getListStudiesRetry() {
+ return this.listStudiesRetry;
+ }
+
+ public void setListStudiesRetry(Retry listStudiesRetry) {
+ this.listStudiesRetry = listStudiesRetry;
+ }
+
+ public Retry getDeleteStudyRetry() {
+ return this.deleteStudyRetry;
+ }
+
+ public void setDeleteStudyRetry(Retry deleteStudyRetry) {
+ this.deleteStudyRetry = deleteStudyRetry;
+ }
+
+ public Retry getLookupStudyRetry() {
+ return this.lookupStudyRetry;
+ }
+
+ public void setLookupStudyRetry(Retry lookupStudyRetry) {
+ this.lookupStudyRetry = lookupStudyRetry;
+ }
+
+ public Retry getCreateTrialRetry() {
+ return this.createTrialRetry;
+ }
+
+ public void setCreateTrialRetry(Retry createTrialRetry) {
+ this.createTrialRetry = createTrialRetry;
+ }
+
+ public Retry getGetTrialRetry() {
+ return this.getTrialRetry;
+ }
+
+ public void setGetTrialRetry(Retry getTrialRetry) {
+ this.getTrialRetry = getTrialRetry;
+ }
+
+ public Retry getListTrialsRetry() {
+ return this.listTrialsRetry;
+ }
+
+ public void setListTrialsRetry(Retry listTrialsRetry) {
+ this.listTrialsRetry = listTrialsRetry;
+ }
+
+ public Retry getAddTrialMeasurementRetry() {
+ return this.addTrialMeasurementRetry;
+ }
+
+ public void setAddTrialMeasurementRetry(Retry addTrialMeasurementRetry) {
+ this.addTrialMeasurementRetry = addTrialMeasurementRetry;
+ }
+
+ public Retry getCompleteTrialRetry() {
+ return this.completeTrialRetry;
+ }
+
+ public void setCompleteTrialRetry(Retry completeTrialRetry) {
+ this.completeTrialRetry = completeTrialRetry;
+ }
+
+ public Retry getDeleteTrialRetry() {
+ return this.deleteTrialRetry;
+ }
+
+ public void setDeleteTrialRetry(Retry deleteTrialRetry) {
+ this.deleteTrialRetry = deleteTrialRetry;
+ }
+
+ public Retry getStopTrialRetry() {
+ return this.stopTrialRetry;
+ }
+
+ public void setStopTrialRetry(Retry stopTrialRetry) {
+ this.stopTrialRetry = stopTrialRetry;
+ }
+
+ public Retry getListOptimalTrialsRetry() {
+ return this.listOptimalTrialsRetry;
+ }
+
+ public void setListOptimalTrialsRetry(Retry listOptimalTrialsRetry) {
+ this.listOptimalTrialsRetry = listOptimalTrialsRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/package-info.java
new file mode 100644
index 0000000000..4bfbb4cfb4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/java/com/google/cloud/aiplatform/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for aiplatform. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.aiplatform.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
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
new file mode 100644
index 0000000000..036d0d498b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,94 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.aiplatform.v1.dataset-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/DatasetService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.endpoint-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/EndpointService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.featurestore-online-serving-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/FeaturestoreOnlineServingService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.featurestore-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/FeaturestoreService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.index-endpoint-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/IndexEndpointService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.index-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/IndexService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.job-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/JobService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.metadata-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/MetadataService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.migration-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/MigrationService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.model-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/ModelService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.pipeline-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/PipelineService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.prediction-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/PredictionService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.specialist-pool-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/SpecialistPoolService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.tensorboard-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/TensorboardService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.aiplatform.v1.vizier-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud aiplatform/VizierService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
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
new file mode 100644
index 0000000000..394d7f752b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-aiplatform-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,15 @@
+com.google.cloud.aiplatform.v1.spring.DatasetServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.EndpointServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.FeaturestoreOnlineServingServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.FeaturestoreServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.IndexEndpointServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.IndexServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.JobServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.MetadataServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.MigrationServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.ModelServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.PipelineServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.PredictionServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.SpecialistPoolServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.TensorboardServiceSpringAutoConfiguration
+com.google.cloud.aiplatform.v1.spring.VizierServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/pom.xml
new file mode 100644
index 0000000000..3633b77820
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ApiGatewayServiceSpringProperties. 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 ApiGatewayServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ApiGatewayServiceSettings apiGatewayServiceSettings(
+ @Qualifier("defaultApiGatewayServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ApiGatewayServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ApiGatewayServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ApiGatewayServiceSettings.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 =
+ ApiGatewayServiceSettings.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 listGatewaysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGatewaysSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listGatewaysSettings().setRetrySettings(listGatewaysRetrySettings);
+
+ RetrySettings getGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGatewaySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getGatewaySettings().setRetrySettings(getGatewayRetrySettings);
+
+ RetrySettings listApisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApisSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listApisSettings().setRetrySettings(listApisRetrySettings);
+
+ RetrySettings getApiRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApiSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getApiSettings().setRetrySettings(getApiRetrySettings);
+
+ RetrySettings listApiConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApiConfigsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listApiConfigsSettings().setRetrySettings(listApiConfigsRetrySettings);
+
+ RetrySettings getApiConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApiConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getApiConfigSettings().setRetrySettings(getApiConfigRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listGatewaysRetry = clientProperties.getListGatewaysRetry();
+ if (listGatewaysRetry != null) {
+ RetrySettings listGatewaysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGatewaysSettings().getRetrySettings(), listGatewaysRetry);
+ clientSettingsBuilder.listGatewaysSettings().setRetrySettings(listGatewaysRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listGateways from properties.");
+ }
+ }
+ Retry getGatewayRetry = clientProperties.getGetGatewayRetry();
+ if (getGatewayRetry != null) {
+ RetrySettings getGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGatewaySettings().getRetrySettings(), getGatewayRetry);
+ clientSettingsBuilder.getGatewaySettings().setRetrySettings(getGatewayRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getGateway from properties.");
+ }
+ }
+ Retry listApisRetry = clientProperties.getListApisRetry();
+ if (listApisRetry != null) {
+ RetrySettings listApisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApisSettings().getRetrySettings(), listApisRetry);
+ clientSettingsBuilder.listApisSettings().setRetrySettings(listApisRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listApis from properties.");
+ }
+ }
+ Retry getApiRetry = clientProperties.getGetApiRetry();
+ if (getApiRetry != null) {
+ RetrySettings getApiRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApiSettings().getRetrySettings(), getApiRetry);
+ clientSettingsBuilder.getApiSettings().setRetrySettings(getApiRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getApi from properties.");
+ }
+ }
+ Retry listApiConfigsRetry = clientProperties.getListApiConfigsRetry();
+ if (listApiConfigsRetry != null) {
+ RetrySettings listApiConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listApiConfigsSettings().getRetrySettings(),
+ listApiConfigsRetry);
+ clientSettingsBuilder.listApiConfigsSettings().setRetrySettings(listApiConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listApiConfigs from properties.");
+ }
+ }
+ Retry getApiConfigRetry = clientProperties.getGetApiConfigRetry();
+ if (getApiConfigRetry != null) {
+ RetrySettings getApiConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getApiConfigSettings().getRetrySettings(), getApiConfigRetry);
+ clientSettingsBuilder.getApiConfigSettings().setRetrySettings(getApiConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getApiConfig from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ApiGatewayServiceClient bean configured with ApiGatewayServiceSettings.
+ *
+ * @param apiGatewayServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ApiGatewayServiceClient} bean configured with {@link
+ * ApiGatewayServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ApiGatewayServiceClient apiGatewayServiceClient(
+ ApiGatewayServiceSettings apiGatewayServiceSettings) throws IOException {
+ return ApiGatewayServiceClient.create(apiGatewayServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-api-gateway-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringProperties.java b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringProperties.java
new file mode 100644
index 0000000000..f7da3b38e2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/ApiGatewayServiceSpringProperties.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2022 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.apigateway.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 ApiGatewayService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.apigateway.v1.api-gateway-service")
+public class ApiGatewayServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listGateways. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listGatewaysRetry;
+ /**
+ * Allow override of retry settings at method-level for getGateway. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGatewayRetry;
+ /**
+ * Allow override of retry settings at method-level for listApis. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listApisRetry;
+ /**
+ * Allow override of retry settings at method-level for getApi. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getApiRetry;
+ /**
+ * Allow override of retry settings at method-level for listApiConfigs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listApiConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for getApiConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getApiConfigRetry;
+
+ @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 getListGatewaysRetry() {
+ return this.listGatewaysRetry;
+ }
+
+ public void setListGatewaysRetry(Retry listGatewaysRetry) {
+ this.listGatewaysRetry = listGatewaysRetry;
+ }
+
+ public Retry getGetGatewayRetry() {
+ return this.getGatewayRetry;
+ }
+
+ public void setGetGatewayRetry(Retry getGatewayRetry) {
+ this.getGatewayRetry = getGatewayRetry;
+ }
+
+ public Retry getListApisRetry() {
+ return this.listApisRetry;
+ }
+
+ public void setListApisRetry(Retry listApisRetry) {
+ this.listApisRetry = listApisRetry;
+ }
+
+ public Retry getGetApiRetry() {
+ return this.getApiRetry;
+ }
+
+ public void setGetApiRetry(Retry getApiRetry) {
+ this.getApiRetry = getApiRetry;
+ }
+
+ public Retry getListApiConfigsRetry() {
+ return this.listApiConfigsRetry;
+ }
+
+ public void setListApiConfigsRetry(Retry listApiConfigsRetry) {
+ this.listApiConfigsRetry = listApiConfigsRetry;
+ }
+
+ public Retry getGetApiConfigRetry() {
+ return this.getApiConfigRetry;
+ }
+
+ public void setGetApiConfigRetry(Retry getApiConfigRetry) {
+ this.getApiConfigRetry = getApiConfigRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/package-info.java
new file mode 100644
index 0000000000..5ac7b04919
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/java/com/google/cloud/apigateway/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for apigateway. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.apigateway.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..d3ab40dc68
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.apigateway.v1.api-gateway-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud apigateway/ApiGatewayService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..d20fced525
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-api-gateway-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.apigateway.v1.spring.ApiGatewayServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/pom.xml
new file mode 100644
index 0000000000..06cc09c9ad
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ConnectionServiceSpringProperties. 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 ConnectionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConnectionServiceSettings connectionServiceSettings( + @Qualifier("defaultConnectionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConnectionServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConnectionServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConnectionServiceSettings.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 = + ConnectionServiceSettings.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 listConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConnectionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listConnectionsSettings() + .setRetrySettings(listConnectionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listConnectionsRetry = clientProperties.getListConnectionsRetry(); + if (listConnectionsRetry != null) { + RetrySettings listConnectionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConnectionsSettings().getRetrySettings(), + listConnectionsRetry); + clientSettingsBuilder + .listConnectionsSettings() + .setRetrySettings(listConnectionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listConnections from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConnectionServiceClient bean configured with ConnectionServiceSettings. + * + * @param connectionServiceSettings settings to configure an instance of client bean. + * @return a {@link ConnectionServiceClient} bean configured with {@link + * ConnectionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConnectionServiceClient connectionServiceClient( + ConnectionServiceSettings connectionServiceSettings) throws IOException { + return ConnectionServiceClient.create(connectionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-connection-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringProperties.java new file mode 100644 index 0000000000..36d1a28f0f --- /dev/null +++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/ConnectionServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.apigeeconnect.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 ConnectionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.apigeeconnect.v1.connection-service") +public class ConnectionServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listConnections. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConnectionsRetry; + + @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 getListConnectionsRetry() { + return this.listConnectionsRetry; + } + + public void setListConnectionsRetry(Retry listConnectionsRetry) { + this.listConnectionsRetry = listConnectionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java new file mode 100644 index 0000000000..e1660b7bd6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringAutoConfiguration.java @@ -0,0 +1,181 @@ +/* + * Copyright 2022 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.apigeeconnect.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.apigeeconnect.v1.TetherClient; +import com.google.cloud.apigeeconnect.v1.TetherSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link TetherClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TetherSpringProperties. 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 TetherSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TetherSettings tetherSettings(
+ @Qualifier("defaultTetherTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TetherSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TetherSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TetherSettings.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 =
+ TetherSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TetherClient bean configured with TetherSettings.
+ *
+ * @param tetherSettings settings to configure an instance of client bean.
+ * @return a {@link TetherClient} bean configured with {@link TetherSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TetherClient tetherClient(TetherSettings tetherSettings) throws IOException {
+ return TetherClient.create(tetherSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-tether";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringProperties.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringProperties.java
new file mode 100644
index 0000000000..0339b95a6a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/TetherSpringProperties.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2022 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.apigeeconnect.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 Tether client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.apigeeconnect.v1.tether")
+public class TetherSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/package-info.java
new file mode 100644
index 0000000000..cf47d56217
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/java/com/google/cloud/apigeeconnect/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for apigeeconnect. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.apigeeconnect.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..11819a773f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.apigeeconnect.v1.connection-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud apigeeconnect/ConnectionService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.apigeeconnect.v1.tether.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud apigeeconnect/Tether components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a4654c402a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-apigee-connect-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.apigeeconnect.v1.spring.ConnectionServiceSpringAutoConfiguration
+com.google.cloud.apigeeconnect.v1.spring.TetherSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/pom.xml
new file mode 100644
index 0000000000..c35320a06b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ApplicationsSpringProperties. 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 ApplicationsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ApplicationsSettings applicationsSettings( + @Qualifier("defaultApplicationsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ApplicationsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ApplicationsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ApplicationsSettings.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 = + ApplicationsSettings.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 getApplicationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getApplicationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getApplicationSettings().setRetrySettings(getApplicationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getApplicationRetry = clientProperties.getGetApplicationRetry(); + if (getApplicationRetry != null) { + RetrySettings getApplicationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getApplicationSettings().getRetrySettings(), + getApplicationRetry); + clientSettingsBuilder.getApplicationSettings().setRetrySettings(getApplicationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getApplication from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ApplicationsClient bean configured with ApplicationsSettings. + * + * @param applicationsSettings settings to configure an instance of client bean. + * @return a {@link ApplicationsClient} bean configured with {@link ApplicationsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ApplicationsClient applicationsClient(ApplicationsSettings applicationsSettings) + throws IOException { + return ApplicationsClient.create(applicationsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-applications"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringProperties.java new file mode 100644 index 0000000000..c3b8460fb2 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ApplicationsSpringProperties.java @@ -0,0 +1,98 @@ +/* + * Copyright 2022 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.appengine.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 Applications client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.applications") +public class ApplicationsSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getApplication. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getApplicationRetry; + + @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 getGetApplicationRetry() { + return this.getApplicationRetry; + } + + public void setGetApplicationRetry(Retry getApplicationRetry) { + this.getApplicationRetry = getApplicationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java new file mode 100644 index 0000000000..77a8c6a385 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringAutoConfiguration.java @@ -0,0 +1,299 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.AuthorizedCertificatesClient; +import com.google.appengine.v1.AuthorizedCertificatesSettings; +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 AuthorizedCertificatesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AuthorizedCertificatesSpringProperties. 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 AuthorizedCertificatesSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AuthorizedCertificatesSettings authorizedCertificatesSettings( + @Qualifier("defaultAuthorizedCertificatesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AuthorizedCertificatesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AuthorizedCertificatesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AuthorizedCertificatesSettings.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 = + AuthorizedCertificatesSettings.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 listAuthorizedCertificatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizedCertificatesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listAuthorizedCertificatesSettings() + .setRetrySettings(listAuthorizedCertificatesRetrySettings); + + RetrySettings getAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAuthorizedCertificateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getAuthorizedCertificateSettings() + .setRetrySettings(getAuthorizedCertificateRetrySettings); + + RetrySettings createAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAuthorizedCertificateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createAuthorizedCertificateSettings() + .setRetrySettings(createAuthorizedCertificateRetrySettings); + + RetrySettings updateAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAuthorizedCertificateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateAuthorizedCertificateSettings() + .setRetrySettings(updateAuthorizedCertificateRetrySettings); + + RetrySettings deleteAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAuthorizedCertificateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteAuthorizedCertificateSettings() + .setRetrySettings(deleteAuthorizedCertificateRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listAuthorizedCertificatesRetry = clientProperties.getListAuthorizedCertificatesRetry(); + if (listAuthorizedCertificatesRetry != null) { + RetrySettings listAuthorizedCertificatesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizedCertificatesSettings().getRetrySettings(), + listAuthorizedCertificatesRetry); + clientSettingsBuilder + .listAuthorizedCertificatesSettings() + .setRetrySettings(listAuthorizedCertificatesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAuthorizedCertificates from properties."); + } + } + Retry getAuthorizedCertificateRetry = clientProperties.getGetAuthorizedCertificateRetry(); + if (getAuthorizedCertificateRetry != null) { + RetrySettings getAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAuthorizedCertificateSettings().getRetrySettings(), + getAuthorizedCertificateRetry); + clientSettingsBuilder + .getAuthorizedCertificateSettings() + .setRetrySettings(getAuthorizedCertificateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAuthorizedCertificate from properties."); + } + } + Retry createAuthorizedCertificateRetry = clientProperties.getCreateAuthorizedCertificateRetry(); + if (createAuthorizedCertificateRetry != null) { + RetrySettings createAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAuthorizedCertificateSettings().getRetrySettings(), + createAuthorizedCertificateRetry); + clientSettingsBuilder + .createAuthorizedCertificateSettings() + .setRetrySettings(createAuthorizedCertificateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createAuthorizedCertificate from properties."); + } + } + Retry updateAuthorizedCertificateRetry = clientProperties.getUpdateAuthorizedCertificateRetry(); + if (updateAuthorizedCertificateRetry != null) { + RetrySettings updateAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAuthorizedCertificateSettings().getRetrySettings(), + updateAuthorizedCertificateRetry); + clientSettingsBuilder + .updateAuthorizedCertificateSettings() + .setRetrySettings(updateAuthorizedCertificateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateAuthorizedCertificate from properties."); + } + } + Retry deleteAuthorizedCertificateRetry = clientProperties.getDeleteAuthorizedCertificateRetry(); + if (deleteAuthorizedCertificateRetry != null) { + RetrySettings deleteAuthorizedCertificateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAuthorizedCertificateSettings().getRetrySettings(), + deleteAuthorizedCertificateRetry); + clientSettingsBuilder + .deleteAuthorizedCertificateSettings() + .setRetrySettings(deleteAuthorizedCertificateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteAuthorizedCertificate from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AuthorizedCertificatesClient bean configured with AuthorizedCertificatesSettings. + * + * @param authorizedCertificatesSettings settings to configure an instance of client bean. + * @return a {@link AuthorizedCertificatesClient} bean configured with {@link + * AuthorizedCertificatesSettings} + */ + @Bean + @ConditionalOnMissingBean + public AuthorizedCertificatesClient authorizedCertificatesClient( + AuthorizedCertificatesSettings authorizedCertificatesSettings) throws IOException { + return AuthorizedCertificatesClient.create(authorizedCertificatesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-authorized-certificates"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringProperties.java new file mode 100644 index 0000000000..bf3b1258ea --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedCertificatesSpringProperties.java @@ -0,0 +1,150 @@ +/* + * Copyright 2022 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.appengine.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 AuthorizedCertificates client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.authorized-certificates") +public class AuthorizedCertificatesSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listAuthorizedCertificates. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAuthorizedCertificatesRetry; + /** + * Allow override of retry settings at method-level for getAuthorizedCertificate. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAuthorizedCertificateRetry; + /** + * Allow override of retry settings at method-level for createAuthorizedCertificate. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createAuthorizedCertificateRetry; + /** + * Allow override of retry settings at method-level for updateAuthorizedCertificate. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateAuthorizedCertificateRetry; + /** + * Allow override of retry settings at method-level for deleteAuthorizedCertificate. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteAuthorizedCertificateRetry; + + @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 getListAuthorizedCertificatesRetry() { + return this.listAuthorizedCertificatesRetry; + } + + public void setListAuthorizedCertificatesRetry(Retry listAuthorizedCertificatesRetry) { + this.listAuthorizedCertificatesRetry = listAuthorizedCertificatesRetry; + } + + public Retry getGetAuthorizedCertificateRetry() { + return this.getAuthorizedCertificateRetry; + } + + public void setGetAuthorizedCertificateRetry(Retry getAuthorizedCertificateRetry) { + this.getAuthorizedCertificateRetry = getAuthorizedCertificateRetry; + } + + public Retry getCreateAuthorizedCertificateRetry() { + return this.createAuthorizedCertificateRetry; + } + + public void setCreateAuthorizedCertificateRetry(Retry createAuthorizedCertificateRetry) { + this.createAuthorizedCertificateRetry = createAuthorizedCertificateRetry; + } + + public Retry getUpdateAuthorizedCertificateRetry() { + return this.updateAuthorizedCertificateRetry; + } + + public void setUpdateAuthorizedCertificateRetry(Retry updateAuthorizedCertificateRetry) { + this.updateAuthorizedCertificateRetry = updateAuthorizedCertificateRetry; + } + + public Retry getDeleteAuthorizedCertificateRetry() { + return this.deleteAuthorizedCertificateRetry; + } + + public void setDeleteAuthorizedCertificateRetry(Retry deleteAuthorizedCertificateRetry) { + this.deleteAuthorizedCertificateRetry = deleteAuthorizedCertificateRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java new file mode 100644 index 0000000000..f01798051e --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringAutoConfiguration.java @@ -0,0 +1,210 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.AuthorizedDomainsClient; +import com.google.appengine.v1.AuthorizedDomainsSettings; +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 AuthorizedDomainsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AuthorizedDomainsSpringProperties. 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 AuthorizedDomainsSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AuthorizedDomainsSettings authorizedDomainsSettings( + @Qualifier("defaultAuthorizedDomainsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AuthorizedDomainsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AuthorizedDomainsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AuthorizedDomainsSettings.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 = + AuthorizedDomainsSettings.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 listAuthorizedDomainsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizedDomainsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listAuthorizedDomainsSettings() + .setRetrySettings(listAuthorizedDomainsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listAuthorizedDomainsRetry = clientProperties.getListAuthorizedDomainsRetry(); + if (listAuthorizedDomainsRetry != null) { + RetrySettings listAuthorizedDomainsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAuthorizedDomainsSettings().getRetrySettings(), + listAuthorizedDomainsRetry); + clientSettingsBuilder + .listAuthorizedDomainsSettings() + .setRetrySettings(listAuthorizedDomainsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAuthorizedDomains from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AuthorizedDomainsClient bean configured with AuthorizedDomainsSettings. + * + * @param authorizedDomainsSettings settings to configure an instance of client bean. + * @return a {@link AuthorizedDomainsClient} bean configured with {@link + * AuthorizedDomainsSettings} + */ + @Bean + @ConditionalOnMissingBean + public AuthorizedDomainsClient authorizedDomainsClient( + AuthorizedDomainsSettings authorizedDomainsSettings) throws IOException { + return AuthorizedDomainsClient.create(authorizedDomainsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-authorized-domains"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringProperties.java new file mode 100644 index 0000000000..90bf7ae7be --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/AuthorizedDomainsSpringProperties.java @@ -0,0 +1,98 @@ +/* + * Copyright 2022 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.appengine.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 AuthorizedDomains client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.authorized-domains") +public class AuthorizedDomainsSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listAuthorizedDomains. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAuthorizedDomainsRetry; + + @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 getListAuthorizedDomainsRetry() { + return this.listAuthorizedDomainsRetry; + } + + public void setListAuthorizedDomainsRetry(Retry listAuthorizedDomainsRetry) { + this.listAuthorizedDomainsRetry = listAuthorizedDomainsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java new file mode 100644 index 0000000000..675efcfee6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringAutoConfiguration.java @@ -0,0 +1,228 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.DomainMappingsClient; +import com.google.appengine.v1.DomainMappingsSettings; +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 DomainMappingsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DomainMappingsSpringProperties. 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 DomainMappingsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DomainMappingsSettings domainMappingsSettings( + @Qualifier("defaultDomainMappingsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DomainMappingsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DomainMappingsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DomainMappingsSettings.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 = + DomainMappingsSettings.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 listDomainMappingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDomainMappingsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDomainMappingsSettings() + .setRetrySettings(listDomainMappingsRetrySettings); + + RetrySettings getDomainMappingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDomainMappingSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getDomainMappingSettings() + .setRetrySettings(getDomainMappingRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listDomainMappingsRetry = clientProperties.getListDomainMappingsRetry(); + if (listDomainMappingsRetry != null) { + RetrySettings listDomainMappingsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDomainMappingsSettings().getRetrySettings(), + listDomainMappingsRetry); + clientSettingsBuilder + .listDomainMappingsSettings() + .setRetrySettings(listDomainMappingsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDomainMappings from properties."); + } + } + Retry getDomainMappingRetry = clientProperties.getGetDomainMappingRetry(); + if (getDomainMappingRetry != null) { + RetrySettings getDomainMappingRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDomainMappingSettings().getRetrySettings(), + getDomainMappingRetry); + clientSettingsBuilder + .getDomainMappingSettings() + .setRetrySettings(getDomainMappingRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getDomainMapping from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DomainMappingsClient bean configured with DomainMappingsSettings. + * + * @param domainMappingsSettings settings to configure an instance of client bean. + * @return a {@link DomainMappingsClient} bean configured with {@link DomainMappingsSettings} + */ + @Bean + @ConditionalOnMissingBean + public DomainMappingsClient domainMappingsClient(DomainMappingsSettings domainMappingsSettings) + throws IOException { + return DomainMappingsClient.create(domainMappingsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-domain-mappings"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringProperties.java new file mode 100644 index 0000000000..2c0a13fc6f --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/DomainMappingsSpringProperties.java @@ -0,0 +1,111 @@ +/* + * Copyright 2022 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.appengine.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 DomainMappings client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.domain-mappings") +public class DomainMappingsSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listDomainMappings. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDomainMappingsRetry; + /** + * Allow override of retry settings at method-level for getDomainMapping. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDomainMappingRetry; + + @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 getListDomainMappingsRetry() { + return this.listDomainMappingsRetry; + } + + public void setListDomainMappingsRetry(Retry listDomainMappingsRetry) { + this.listDomainMappingsRetry = listDomainMappingsRetry; + } + + public Retry getGetDomainMappingRetry() { + return this.getDomainMappingRetry; + } + + public void setGetDomainMappingRetry(Retry getDomainMappingRetry) { + this.getDomainMappingRetry = getDomainMappingRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java new file mode 100644 index 0000000000..b6f2e59a4d --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringAutoConfiguration.java @@ -0,0 +1,303 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.FirewallClient; +import com.google.appengine.v1.FirewallSettings; +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 FirewallClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in FirewallSpringProperties. 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 FirewallSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public FirewallSettings firewallSettings( + @Qualifier("defaultFirewallTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + FirewallSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = FirewallSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = FirewallSettings.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 = + FirewallSettings.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 listIngressRulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIngressRulesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listIngressRulesSettings() + .setRetrySettings(listIngressRulesRetrySettings); + + RetrySettings batchUpdateIngressRulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchUpdateIngressRulesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchUpdateIngressRulesSettings() + .setRetrySettings(batchUpdateIngressRulesRetrySettings); + + RetrySettings createIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIngressRuleSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createIngressRuleSettings() + .setRetrySettings(createIngressRuleRetrySettings); + + RetrySettings getIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIngressRuleSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIngressRuleSettings().setRetrySettings(getIngressRuleRetrySettings); + + RetrySettings updateIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIngressRuleSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateIngressRuleSettings() + .setRetrySettings(updateIngressRuleRetrySettings); + + RetrySettings deleteIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIngressRuleSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteIngressRuleSettings() + .setRetrySettings(deleteIngressRuleRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listIngressRulesRetry = clientProperties.getListIngressRulesRetry(); + if (listIngressRulesRetry != null) { + RetrySettings listIngressRulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIngressRulesSettings().getRetrySettings(), + listIngressRulesRetry); + clientSettingsBuilder + .listIngressRulesSettings() + .setRetrySettings(listIngressRulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listIngressRules from properties."); + } + } + Retry batchUpdateIngressRulesRetry = clientProperties.getBatchUpdateIngressRulesRetry(); + if (batchUpdateIngressRulesRetry != null) { + RetrySettings batchUpdateIngressRulesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.batchUpdateIngressRulesSettings().getRetrySettings(), + batchUpdateIngressRulesRetry); + clientSettingsBuilder + .batchUpdateIngressRulesSettings() + .setRetrySettings(batchUpdateIngressRulesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchUpdateIngressRules from properties."); + } + } + Retry createIngressRuleRetry = clientProperties.getCreateIngressRuleRetry(); + if (createIngressRuleRetry != null) { + RetrySettings createIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIngressRuleSettings().getRetrySettings(), + createIngressRuleRetry); + clientSettingsBuilder + .createIngressRuleSettings() + .setRetrySettings(createIngressRuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createIngressRule from properties."); + } + } + Retry getIngressRuleRetry = clientProperties.getGetIngressRuleRetry(); + if (getIngressRuleRetry != null) { + RetrySettings getIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIngressRuleSettings().getRetrySettings(), + getIngressRuleRetry); + clientSettingsBuilder.getIngressRuleSettings().setRetrySettings(getIngressRuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIngressRule from properties."); + } + } + Retry updateIngressRuleRetry = clientProperties.getUpdateIngressRuleRetry(); + if (updateIngressRuleRetry != null) { + RetrySettings updateIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIngressRuleSettings().getRetrySettings(), + updateIngressRuleRetry); + clientSettingsBuilder + .updateIngressRuleSettings() + .setRetrySettings(updateIngressRuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateIngressRule from properties."); + } + } + Retry deleteIngressRuleRetry = clientProperties.getDeleteIngressRuleRetry(); + if (deleteIngressRuleRetry != null) { + RetrySettings deleteIngressRuleRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIngressRuleSettings().getRetrySettings(), + deleteIngressRuleRetry); + clientSettingsBuilder + .deleteIngressRuleSettings() + .setRetrySettings(deleteIngressRuleRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteIngressRule from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a FirewallClient bean configured with FirewallSettings. + * + * @param firewallSettings settings to configure an instance of client bean. + * @return a {@link FirewallClient} bean configured with {@link FirewallSettings} + */ + @Bean + @ConditionalOnMissingBean + public FirewallClient firewallClient(FirewallSettings firewallSettings) throws IOException { + return FirewallClient.create(firewallSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-firewall"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringProperties.java new file mode 100644 index 0000000000..c9117f1b94 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/FirewallSpringProperties.java @@ -0,0 +1,163 @@ +/* + * Copyright 2022 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.appengine.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 Firewall client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.firewall") +public class FirewallSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listIngressRules. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listIngressRulesRetry; + /** + * Allow override of retry settings at method-level for batchUpdateIngressRules. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchUpdateIngressRulesRetry; + /** + * Allow override of retry settings at method-level for createIngressRule. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createIngressRuleRetry; + /** + * Allow override of retry settings at method-level for getIngressRule. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIngressRuleRetry; + /** + * Allow override of retry settings at method-level for updateIngressRule. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateIngressRuleRetry; + /** + * Allow override of retry settings at method-level for deleteIngressRule. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteIngressRuleRetry; + + @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 getListIngressRulesRetry() { + return this.listIngressRulesRetry; + } + + public void setListIngressRulesRetry(Retry listIngressRulesRetry) { + this.listIngressRulesRetry = listIngressRulesRetry; + } + + public Retry getBatchUpdateIngressRulesRetry() { + return this.batchUpdateIngressRulesRetry; + } + + public void setBatchUpdateIngressRulesRetry(Retry batchUpdateIngressRulesRetry) { + this.batchUpdateIngressRulesRetry = batchUpdateIngressRulesRetry; + } + + public Retry getCreateIngressRuleRetry() { + return this.createIngressRuleRetry; + } + + public void setCreateIngressRuleRetry(Retry createIngressRuleRetry) { + this.createIngressRuleRetry = createIngressRuleRetry; + } + + public Retry getGetIngressRuleRetry() { + return this.getIngressRuleRetry; + } + + public void setGetIngressRuleRetry(Retry getIngressRuleRetry) { + this.getIngressRuleRetry = getIngressRuleRetry; + } + + public Retry getUpdateIngressRuleRetry() { + return this.updateIngressRuleRetry; + } + + public void setUpdateIngressRuleRetry(Retry updateIngressRuleRetry) { + this.updateIngressRuleRetry = updateIngressRuleRetry; + } + + public Retry getDeleteIngressRuleRetry() { + return this.deleteIngressRuleRetry; + } + + public void setDeleteIngressRuleRetry(Retry deleteIngressRuleRetry) { + this.deleteIngressRuleRetry = deleteIngressRuleRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java new file mode 100644 index 0000000000..e58bf66b73 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringAutoConfiguration.java @@ -0,0 +1,211 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.InstancesClient; +import com.google.appengine.v1.InstancesSettings; +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 InstancesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in InstancesSpringProperties. 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 InstancesSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public InstancesSettings instancesSettings( + @Qualifier("defaultInstancesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + InstancesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = InstancesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = InstancesSettings.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 = + InstancesSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings listInstancesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings); + + RetrySettings getInstanceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listInstancesRetry = clientProperties.getListInstancesRetry(); + if (listInstancesRetry != null) { + RetrySettings listInstancesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry); + clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listInstances from properties."); + } + } + Retry getInstanceRetry = clientProperties.getGetInstanceRetry(); + if (getInstanceRetry != null) { + RetrySettings getInstanceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry); + clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getInstance from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a InstancesClient bean configured with InstancesSettings. + * + * @param instancesSettings settings to configure an instance of client bean. + * @return a {@link InstancesClient} bean configured with {@link InstancesSettings} + */ + @Bean + @ConditionalOnMissingBean + public InstancesClient instancesClient(InstancesSettings instancesSettings) throws IOException { + return InstancesClient.create(instancesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-instances"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringProperties.java new file mode 100644 index 0000000000..604b1feb44 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/InstancesSpringProperties.java @@ -0,0 +1,111 @@ +/* + * Copyright 2022 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.appengine.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 Instances client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.instances") +public class InstancesSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listInstances. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listInstancesRetry; + /** + * Allow override of retry settings at method-level for getInstance. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getInstanceRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListInstancesRetry() { + return this.listInstancesRetry; + } + + public void setListInstancesRetry(Retry listInstancesRetry) { + this.listInstancesRetry = listInstancesRetry; + } + + public Retry getGetInstanceRetry() { + return this.getInstanceRetry; + } + + public void setGetInstanceRetry(Retry getInstanceRetry) { + this.getInstanceRetry = getInstanceRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java new file mode 100644 index 0000000000..3a2e449dc8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringAutoConfiguration.java @@ -0,0 +1,211 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.ServicesClient; +import com.google.appengine.v1.ServicesSettings; +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 ServicesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ServicesSpringProperties. 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 ServicesSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ServicesSettings servicesSettings( + @Qualifier("defaultServicesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ServicesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ServicesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ServicesSettings.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 = + ServicesSettings.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 listServicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings); + + RetrySettings getServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServiceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listServicesRetry = clientProperties.getListServicesRetry(); + if (listServicesRetry != null) { + RetrySettings listServicesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry); + clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listServices from properties."); + } + } + Retry getServiceRetry = clientProperties.getGetServiceRetry(); + if (getServiceRetry != null) { + RetrySettings getServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServiceSettings().getRetrySettings(), getServiceRetry); + clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getService from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ServicesClient bean configured with ServicesSettings. + * + * @param servicesSettings settings to configure an instance of client bean. + * @return a {@link ServicesClient} bean configured with {@link ServicesSettings} + */ + @Bean + @ConditionalOnMissingBean + public ServicesClient servicesClient(ServicesSettings servicesSettings) throws IOException { + return ServicesClient.create(servicesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-services"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringProperties.java new file mode 100644 index 0000000000..fbca65af09 --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/ServicesSpringProperties.java @@ -0,0 +1,111 @@ +/* + * Copyright 2022 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.appengine.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 Services client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.appengine.v1.services") +public class ServicesSpringProperties 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/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listServices. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listServicesRetry; + /** + * Allow override of retry settings at method-level for getService. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getServiceRetry; + + @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 getListServicesRetry() { + return this.listServicesRetry; + } + + public void setListServicesRetry(Retry listServicesRetry) { + this.listServicesRetry = listServicesRetry; + } + + public Retry getGetServiceRetry() { + return this.getServiceRetry; + } + + public void setGetServiceRetry(Retry getServiceRetry) { + this.getServiceRetry = getServiceRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java new file mode 100644 index 0000000000..fd04ab2d2f --- /dev/null +++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringAutoConfiguration.java @@ -0,0 +1,211 @@ +/* + * Copyright 2022 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.appengine.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.appengine.v1.VersionsClient; +import com.google.appengine.v1.VersionsSettings; +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 VersionsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VersionsSpringProperties. 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 VersionsSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VersionsSettings versionsSettings(
+ @Qualifier("defaultVersionsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VersionsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = VersionsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = VersionsSettings.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 =
+ VersionsSettings.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 listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listVersionsRetry = clientProperties.getListVersionsRetry();
+ if (listVersionsRetry != null) {
+ RetrySettings listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), listVersionsRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listVersions from properties.");
+ }
+ }
+ Retry getVersionRetry = clientProperties.getGetVersionRetry();
+ if (getVersionRetry != null) {
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), getVersionRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getVersion from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a VersionsClient bean configured with VersionsSettings.
+ *
+ * @param versionsSettings settings to configure an instance of client bean.
+ * @return a {@link VersionsClient} bean configured with {@link VersionsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VersionsClient versionsClient(VersionsSettings versionsSettings) throws IOException {
+ return VersionsClient.create(versionsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-versions";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringProperties.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringProperties.java
new file mode 100644
index 0000000000..8997c3d66c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/VersionsSpringProperties.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2022 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.appengine.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 Versions client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.appengine.v1.versions")
+public class VersionsSpringProperties 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/appengine.admin",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listVersions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getVersionRetry;
+
+ @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 getListVersionsRetry() {
+ return this.listVersionsRetry;
+ }
+
+ public void setListVersionsRetry(Retry listVersionsRetry) {
+ this.listVersionsRetry = listVersionsRetry;
+ }
+
+ public Retry getGetVersionRetry() {
+ return this.getVersionRetry;
+ }
+
+ public void setGetVersionRetry(Retry getVersionRetry) {
+ this.getVersionRetry = getVersionRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/package-info.java
new file mode 100644
index 0000000000..6a56713172
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/java/com/google/appengine/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for appengine. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.appengine.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..8f6753968e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,52 @@
+{
+ "properties": [
+ {
+ "name": "com.google.appengine.v1.applications.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/Applications components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.services.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/Services components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.versions.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/Versions components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.instances.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/Instances components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.firewall.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/Firewall components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.authorized-domains.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/AuthorizedDomains components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.authorized-certificates.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/AuthorizedCertificates components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.appengine.v1.domain-mappings.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud appengine/DomainMappings components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..0d2bfc957d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-appengine-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,8 @@
+com.google.appengine.v1.spring.ApplicationsSpringAutoConfiguration
+com.google.appengine.v1.spring.ServicesSpringAutoConfiguration
+com.google.appengine.v1.spring.VersionsSpringAutoConfiguration
+com.google.appengine.v1.spring.InstancesSpringAutoConfiguration
+com.google.appengine.v1.spring.FirewallSpringAutoConfiguration
+com.google.appengine.v1.spring.AuthorizedDomainsSpringAutoConfiguration
+com.google.appengine.v1.spring.AuthorizedCertificatesSpringAutoConfiguration
+com.google.appengine.v1.spring.DomainMappingsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/pom.xml
new file mode 100644
index 0000000000..a1cd35478b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ArtifactRegistrySpringProperties. 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 ArtifactRegistrySettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ArtifactRegistrySettings artifactRegistrySettings(
+ @Qualifier("defaultArtifactRegistryTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ArtifactRegistrySettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ArtifactRegistrySettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ArtifactRegistrySettings.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 =
+ ArtifactRegistrySettings.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 listDockerImagesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDockerImagesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listDockerImagesSettings()
+ .setRetrySettings(listDockerImagesRetrySettings);
+
+ RetrySettings getDockerImageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDockerImageSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDockerImageSettings().setRetrySettings(getDockerImageRetrySettings);
+
+ RetrySettings listRepositoriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRepositoriesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listRepositoriesSettings()
+ .setRetrySettings(listRepositoriesRetrySettings);
+
+ RetrySettings getRepositoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRepositorySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRepositorySettings().setRetrySettings(getRepositoryRetrySettings);
+
+ RetrySettings updateRepositoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRepositorySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateRepositorySettings()
+ .setRetrySettings(updateRepositoryRetrySettings);
+
+ RetrySettings listPackagesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPackagesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listPackagesSettings().setRetrySettings(listPackagesRetrySettings);
+
+ RetrySettings getPackageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPackageSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getPackageSettings().setRetrySettings(getPackageRetrySettings);
+
+ RetrySettings listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+
+ RetrySettings listFilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFilesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFilesSettings().setRetrySettings(listFilesRetrySettings);
+
+ RetrySettings getFileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFileSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getFileSettings().setRetrySettings(getFileRetrySettings);
+
+ RetrySettings listTagsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTagsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTagsSettings().setRetrySettings(listTagsRetrySettings);
+
+ RetrySettings getTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTagSettings().setRetrySettings(getTagRetrySettings);
+
+ RetrySettings createTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createTagSettings().setRetrySettings(createTagRetrySettings);
+
+ RetrySettings updateTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateTagSettings().setRetrySettings(updateTagRetrySettings);
+
+ RetrySettings deleteTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteTagSettings().setRetrySettings(deleteTagRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings getProjectSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProjectSettingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getProjectSettingsSettings()
+ .setRetrySettings(getProjectSettingsRetrySettings);
+
+ RetrySettings updateProjectSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateProjectSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateProjectSettingsSettings()
+ .setRetrySettings(updateProjectSettingsRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listDockerImagesRetry = clientProperties.getListDockerImagesRetry();
+ if (listDockerImagesRetry != null) {
+ RetrySettings listDockerImagesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDockerImagesSettings().getRetrySettings(),
+ listDockerImagesRetry);
+ clientSettingsBuilder
+ .listDockerImagesSettings()
+ .setRetrySettings(listDockerImagesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDockerImages from properties.");
+ }
+ }
+ Retry getDockerImageRetry = clientProperties.getGetDockerImageRetry();
+ if (getDockerImageRetry != null) {
+ RetrySettings getDockerImageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDockerImageSettings().getRetrySettings(),
+ getDockerImageRetry);
+ clientSettingsBuilder.getDockerImageSettings().setRetrySettings(getDockerImageRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDockerImage from properties.");
+ }
+ }
+ Retry listRepositoriesRetry = clientProperties.getListRepositoriesRetry();
+ if (listRepositoriesRetry != null) {
+ RetrySettings listRepositoriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRepositoriesSettings().getRetrySettings(),
+ listRepositoriesRetry);
+ clientSettingsBuilder
+ .listRepositoriesSettings()
+ .setRetrySettings(listRepositoriesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRepositories from properties.");
+ }
+ }
+ Retry getRepositoryRetry = clientProperties.getGetRepositoryRetry();
+ if (getRepositoryRetry != null) {
+ RetrySettings getRepositoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRepositorySettings().getRetrySettings(), getRepositoryRetry);
+ clientSettingsBuilder.getRepositorySettings().setRetrySettings(getRepositoryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRepository from properties.");
+ }
+ }
+ Retry updateRepositoryRetry = clientProperties.getUpdateRepositoryRetry();
+ if (updateRepositoryRetry != null) {
+ RetrySettings updateRepositoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRepositorySettings().getRetrySettings(),
+ updateRepositoryRetry);
+ clientSettingsBuilder
+ .updateRepositorySettings()
+ .setRetrySettings(updateRepositoryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateRepository from properties.");
+ }
+ }
+ Retry listPackagesRetry = clientProperties.getListPackagesRetry();
+ if (listPackagesRetry != null) {
+ RetrySettings listPackagesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPackagesSettings().getRetrySettings(), listPackagesRetry);
+ clientSettingsBuilder.listPackagesSettings().setRetrySettings(listPackagesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listPackages from properties.");
+ }
+ }
+ Retry getPackageRetry = clientProperties.getGetPackageRetry();
+ if (getPackageRetry != null) {
+ RetrySettings getPackageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPackageSettings().getRetrySettings(), getPackageRetry);
+ clientSettingsBuilder.getPackageSettings().setRetrySettings(getPackageRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getPackage from properties.");
+ }
+ }
+ Retry listVersionsRetry = clientProperties.getListVersionsRetry();
+ if (listVersionsRetry != null) {
+ RetrySettings listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), listVersionsRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listVersions from properties.");
+ }
+ }
+ Retry getVersionRetry = clientProperties.getGetVersionRetry();
+ if (getVersionRetry != null) {
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), getVersionRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getVersion from properties.");
+ }
+ }
+ Retry listFilesRetry = clientProperties.getListFilesRetry();
+ if (listFilesRetry != null) {
+ RetrySettings listFilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFilesSettings().getRetrySettings(), listFilesRetry);
+ clientSettingsBuilder.listFilesSettings().setRetrySettings(listFilesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFiles from properties.");
+ }
+ }
+ Retry getFileRetry = clientProperties.getGetFileRetry();
+ if (getFileRetry != null) {
+ RetrySettings getFileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFileSettings().getRetrySettings(), getFileRetry);
+ clientSettingsBuilder.getFileSettings().setRetrySettings(getFileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getFile from properties.");
+ }
+ }
+ Retry listTagsRetry = clientProperties.getListTagsRetry();
+ if (listTagsRetry != null) {
+ RetrySettings listTagsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTagsSettings().getRetrySettings(), listTagsRetry);
+ clientSettingsBuilder.listTagsSettings().setRetrySettings(listTagsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTags from properties.");
+ }
+ }
+ Retry getTagRetry = clientProperties.getGetTagRetry();
+ if (getTagRetry != null) {
+ RetrySettings getTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTagSettings().getRetrySettings(), getTagRetry);
+ clientSettingsBuilder.getTagSettings().setRetrySettings(getTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTag from properties.");
+ }
+ }
+ Retry createTagRetry = clientProperties.getCreateTagRetry();
+ if (createTagRetry != null) {
+ RetrySettings createTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTagSettings().getRetrySettings(), createTagRetry);
+ clientSettingsBuilder.createTagSettings().setRetrySettings(createTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createTag from properties.");
+ }
+ }
+ Retry updateTagRetry = clientProperties.getUpdateTagRetry();
+ if (updateTagRetry != null) {
+ RetrySettings updateTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTagSettings().getRetrySettings(), updateTagRetry);
+ clientSettingsBuilder.updateTagSettings().setRetrySettings(updateTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateTag from properties.");
+ }
+ }
+ Retry deleteTagRetry = clientProperties.getDeleteTagRetry();
+ if (deleteTagRetry != null) {
+ RetrySettings deleteTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTagSettings().getRetrySettings(), deleteTagRetry);
+ clientSettingsBuilder.deleteTagSettings().setRetrySettings(deleteTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteTag from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ Retry getProjectSettingsRetry = clientProperties.getGetProjectSettingsRetry();
+ if (getProjectSettingsRetry != null) {
+ RetrySettings getProjectSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProjectSettingsSettings().getRetrySettings(),
+ getProjectSettingsRetry);
+ clientSettingsBuilder
+ .getProjectSettingsSettings()
+ .setRetrySettings(getProjectSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getProjectSettings from properties.");
+ }
+ }
+ Retry updateProjectSettingsRetry = clientProperties.getUpdateProjectSettingsRetry();
+ if (updateProjectSettingsRetry != null) {
+ RetrySettings updateProjectSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateProjectSettingsSettings().getRetrySettings(),
+ updateProjectSettingsRetry);
+ clientSettingsBuilder
+ .updateProjectSettingsSettings()
+ .setRetrySettings(updateProjectSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateProjectSettings from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ArtifactRegistryClient bean configured with ArtifactRegistrySettings.
+ *
+ * @param artifactRegistrySettings settings to configure an instance of client bean.
+ * @return a {@link ArtifactRegistryClient} bean configured with {@link ArtifactRegistrySettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ArtifactRegistryClient artifactRegistryClient(
+ ArtifactRegistrySettings artifactRegistrySettings) throws IOException {
+ return ArtifactRegistryClient.create(artifactRegistrySettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-artifact-registry";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringProperties.java b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringProperties.java
new file mode 100644
index 0000000000..a787e45f98
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/ArtifactRegistrySpringProperties.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright 2022 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.artifactregistry.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 ArtifactRegistry client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.devtools.artifactregistry.v1.artifact-registry")
+public class ArtifactRegistrySpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listDockerImages. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDockerImagesRetry;
+ /**
+ * Allow override of retry settings at method-level for getDockerImage. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDockerImageRetry;
+ /**
+ * Allow override of retry settings at method-level for listRepositories. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRepositoriesRetry;
+ /**
+ * Allow override of retry settings at method-level for getRepository. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRepositoryRetry;
+ /**
+ * Allow override of retry settings at method-level for updateRepository. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateRepositoryRetry;
+ /**
+ * Allow override of retry settings at method-level for listPackages. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPackagesRetry;
+ /**
+ * Allow override of retry settings at method-level for getPackage. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPackageRetry;
+ /**
+ * Allow override of retry settings at method-level for listVersions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for listFiles. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFilesRetry;
+ /**
+ * Allow override of retry settings at method-level for getFile. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getFileRetry;
+ /**
+ * Allow override of retry settings at method-level for listTags. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTagsRetry;
+ /**
+ * Allow override of retry settings at method-level for getTag. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTagRetry;
+ /**
+ * Allow override of retry settings at method-level for createTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTagRetry;
+ /**
+ * Allow override of retry settings at method-level for updateTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateTagRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTagRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getProjectSettings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getProjectSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateProjectSettings. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateProjectSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListDockerImagesRetry() {
+ return this.listDockerImagesRetry;
+ }
+
+ public void setListDockerImagesRetry(Retry listDockerImagesRetry) {
+ this.listDockerImagesRetry = listDockerImagesRetry;
+ }
+
+ public Retry getGetDockerImageRetry() {
+ return this.getDockerImageRetry;
+ }
+
+ public void setGetDockerImageRetry(Retry getDockerImageRetry) {
+ this.getDockerImageRetry = getDockerImageRetry;
+ }
+
+ public Retry getListRepositoriesRetry() {
+ return this.listRepositoriesRetry;
+ }
+
+ public void setListRepositoriesRetry(Retry listRepositoriesRetry) {
+ this.listRepositoriesRetry = listRepositoriesRetry;
+ }
+
+ public Retry getGetRepositoryRetry() {
+ return this.getRepositoryRetry;
+ }
+
+ public void setGetRepositoryRetry(Retry getRepositoryRetry) {
+ this.getRepositoryRetry = getRepositoryRetry;
+ }
+
+ public Retry getUpdateRepositoryRetry() {
+ return this.updateRepositoryRetry;
+ }
+
+ public void setUpdateRepositoryRetry(Retry updateRepositoryRetry) {
+ this.updateRepositoryRetry = updateRepositoryRetry;
+ }
+
+ public Retry getListPackagesRetry() {
+ return this.listPackagesRetry;
+ }
+
+ public void setListPackagesRetry(Retry listPackagesRetry) {
+ this.listPackagesRetry = listPackagesRetry;
+ }
+
+ public Retry getGetPackageRetry() {
+ return this.getPackageRetry;
+ }
+
+ public void setGetPackageRetry(Retry getPackageRetry) {
+ this.getPackageRetry = getPackageRetry;
+ }
+
+ public Retry getListVersionsRetry() {
+ return this.listVersionsRetry;
+ }
+
+ public void setListVersionsRetry(Retry listVersionsRetry) {
+ this.listVersionsRetry = listVersionsRetry;
+ }
+
+ public Retry getGetVersionRetry() {
+ return this.getVersionRetry;
+ }
+
+ public void setGetVersionRetry(Retry getVersionRetry) {
+ this.getVersionRetry = getVersionRetry;
+ }
+
+ public Retry getListFilesRetry() {
+ return this.listFilesRetry;
+ }
+
+ public void setListFilesRetry(Retry listFilesRetry) {
+ this.listFilesRetry = listFilesRetry;
+ }
+
+ public Retry getGetFileRetry() {
+ return this.getFileRetry;
+ }
+
+ public void setGetFileRetry(Retry getFileRetry) {
+ this.getFileRetry = getFileRetry;
+ }
+
+ public Retry getListTagsRetry() {
+ return this.listTagsRetry;
+ }
+
+ public void setListTagsRetry(Retry listTagsRetry) {
+ this.listTagsRetry = listTagsRetry;
+ }
+
+ public Retry getGetTagRetry() {
+ return this.getTagRetry;
+ }
+
+ public void setGetTagRetry(Retry getTagRetry) {
+ this.getTagRetry = getTagRetry;
+ }
+
+ public Retry getCreateTagRetry() {
+ return this.createTagRetry;
+ }
+
+ public void setCreateTagRetry(Retry createTagRetry) {
+ this.createTagRetry = createTagRetry;
+ }
+
+ public Retry getUpdateTagRetry() {
+ return this.updateTagRetry;
+ }
+
+ public void setUpdateTagRetry(Retry updateTagRetry) {
+ this.updateTagRetry = updateTagRetry;
+ }
+
+ public Retry getDeleteTagRetry() {
+ return this.deleteTagRetry;
+ }
+
+ public void setDeleteTagRetry(Retry deleteTagRetry) {
+ this.deleteTagRetry = deleteTagRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+
+ public Retry getGetProjectSettingsRetry() {
+ return this.getProjectSettingsRetry;
+ }
+
+ public void setGetProjectSettingsRetry(Retry getProjectSettingsRetry) {
+ this.getProjectSettingsRetry = getProjectSettingsRetry;
+ }
+
+ public Retry getUpdateProjectSettingsRetry() {
+ return this.updateProjectSettingsRetry;
+ }
+
+ public void setUpdateProjectSettingsRetry(Retry updateProjectSettingsRetry) {
+ this.updateProjectSettingsRetry = updateProjectSettingsRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/package-info.java
new file mode 100644
index 0000000000..97789f6a48
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/java/com/google/devtools/artifactregistry/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for artifactregistry. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.devtools.artifactregistry.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..fcc00fad88
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.devtools.artifactregistry.v1.artifact-registry.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud artifactregistry/ArtifactRegistry components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..d322858a27
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-artifact-registry-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.devtools.artifactregistry.v1.spring.ArtifactRegistrySpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-asset-spring-starter/pom.xml
new file mode 100644
index 0000000000..376893f8f5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-asset-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in AssetServiceSpringProperties. 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 AssetServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AssetServiceSettings assetServiceSettings(
+ @Qualifier("defaultAssetServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ AssetServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = AssetServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = AssetServiceSettings.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 =
+ AssetServiceSettings.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 listAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings);
+
+ RetrySettings batchGetAssetsHistoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetAssetsHistorySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .batchGetAssetsHistorySettings()
+ .setRetrySettings(batchGetAssetsHistoryRetrySettings);
+
+ RetrySettings createFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createFeedSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createFeedSettings().setRetrySettings(createFeedRetrySettings);
+
+ RetrySettings getFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFeedSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getFeedSettings().setRetrySettings(getFeedRetrySettings);
+
+ RetrySettings listFeedsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFeedsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFeedsSettings().setRetrySettings(listFeedsRetrySettings);
+
+ RetrySettings updateFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateFeedSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateFeedSettings().setRetrySettings(updateFeedRetrySettings);
+
+ RetrySettings deleteFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteFeedSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteFeedSettings().setRetrySettings(deleteFeedRetrySettings);
+
+ RetrySettings searchAllResourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllResourcesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .searchAllResourcesSettings()
+ .setRetrySettings(searchAllResourcesRetrySettings);
+
+ RetrySettings searchAllIamPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllIamPoliciesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .searchAllIamPoliciesSettings()
+ .setRetrySettings(searchAllIamPoliciesRetrySettings);
+
+ RetrySettings analyzeIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .analyzeIamPolicySettings()
+ .setRetrySettings(analyzeIamPolicyRetrySettings);
+
+ RetrySettings analyzeMoveRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeMoveSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.analyzeMoveSettings().setRetrySettings(analyzeMoveRetrySettings);
+
+ RetrySettings queryAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryAssetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.queryAssetsSettings().setRetrySettings(queryAssetsRetrySettings);
+
+ RetrySettings createSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSavedQuerySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createSavedQuerySettings()
+ .setRetrySettings(createSavedQueryRetrySettings);
+
+ RetrySettings getSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSavedQuerySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getSavedQuerySettings().setRetrySettings(getSavedQueryRetrySettings);
+
+ RetrySettings listSavedQueriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSavedQueriesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listSavedQueriesSettings()
+ .setRetrySettings(listSavedQueriesRetrySettings);
+
+ RetrySettings updateSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSavedQuerySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateSavedQuerySettings()
+ .setRetrySettings(updateSavedQueryRetrySettings);
+
+ RetrySettings deleteSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteSavedQuerySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteSavedQuerySettings()
+ .setRetrySettings(deleteSavedQueryRetrySettings);
+
+ RetrySettings batchGetEffectiveIamPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetEffectiveIamPoliciesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .batchGetEffectiveIamPoliciesSettings()
+ .setRetrySettings(batchGetEffectiveIamPoliciesRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listAssetsRetry = clientProperties.getListAssetsRetry();
+ if (listAssetsRetry != null) {
+ RetrySettings listAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssetsSettings().getRetrySettings(), listAssetsRetry);
+ clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listAssets from properties.");
+ }
+ }
+ Retry batchGetAssetsHistoryRetry = clientProperties.getBatchGetAssetsHistoryRetry();
+ if (batchGetAssetsHistoryRetry != null) {
+ RetrySettings batchGetAssetsHistoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetAssetsHistorySettings().getRetrySettings(),
+ batchGetAssetsHistoryRetry);
+ clientSettingsBuilder
+ .batchGetAssetsHistorySettings()
+ .setRetrySettings(batchGetAssetsHistoryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for batchGetAssetsHistory from properties.");
+ }
+ }
+ Retry createFeedRetry = clientProperties.getCreateFeedRetry();
+ if (createFeedRetry != null) {
+ RetrySettings createFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createFeedSettings().getRetrySettings(), createFeedRetry);
+ clientSettingsBuilder.createFeedSettings().setRetrySettings(createFeedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createFeed from properties.");
+ }
+ }
+ Retry getFeedRetry = clientProperties.getGetFeedRetry();
+ if (getFeedRetry != null) {
+ RetrySettings getFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFeedSettings().getRetrySettings(), getFeedRetry);
+ clientSettingsBuilder.getFeedSettings().setRetrySettings(getFeedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getFeed from properties.");
+ }
+ }
+ Retry listFeedsRetry = clientProperties.getListFeedsRetry();
+ if (listFeedsRetry != null) {
+ RetrySettings listFeedsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFeedsSettings().getRetrySettings(), listFeedsRetry);
+ clientSettingsBuilder.listFeedsSettings().setRetrySettings(listFeedsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFeeds from properties.");
+ }
+ }
+ Retry updateFeedRetry = clientProperties.getUpdateFeedRetry();
+ if (updateFeedRetry != null) {
+ RetrySettings updateFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateFeedSettings().getRetrySettings(), updateFeedRetry);
+ clientSettingsBuilder.updateFeedSettings().setRetrySettings(updateFeedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateFeed from properties.");
+ }
+ }
+ Retry deleteFeedRetry = clientProperties.getDeleteFeedRetry();
+ if (deleteFeedRetry != null) {
+ RetrySettings deleteFeedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteFeedSettings().getRetrySettings(), deleteFeedRetry);
+ clientSettingsBuilder.deleteFeedSettings().setRetrySettings(deleteFeedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteFeed from properties.");
+ }
+ }
+ Retry searchAllResourcesRetry = clientProperties.getSearchAllResourcesRetry();
+ if (searchAllResourcesRetry != null) {
+ RetrySettings searchAllResourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllResourcesSettings().getRetrySettings(),
+ searchAllResourcesRetry);
+ clientSettingsBuilder
+ .searchAllResourcesSettings()
+ .setRetrySettings(searchAllResourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for searchAllResources from properties.");
+ }
+ }
+ Retry searchAllIamPoliciesRetry = clientProperties.getSearchAllIamPoliciesRetry();
+ if (searchAllIamPoliciesRetry != null) {
+ RetrySettings searchAllIamPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllIamPoliciesSettings().getRetrySettings(),
+ searchAllIamPoliciesRetry);
+ clientSettingsBuilder
+ .searchAllIamPoliciesSettings()
+ .setRetrySettings(searchAllIamPoliciesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for searchAllIamPolicies from properties.");
+ }
+ }
+ Retry analyzeIamPolicyRetry = clientProperties.getAnalyzeIamPolicyRetry();
+ if (analyzeIamPolicyRetry != null) {
+ RetrySettings analyzeIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeIamPolicySettings().getRetrySettings(),
+ analyzeIamPolicyRetry);
+ clientSettingsBuilder
+ .analyzeIamPolicySettings()
+ .setRetrySettings(analyzeIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for analyzeIamPolicy from properties.");
+ }
+ }
+ Retry analyzeMoveRetry = clientProperties.getAnalyzeMoveRetry();
+ if (analyzeMoveRetry != null) {
+ RetrySettings analyzeMoveRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeMoveSettings().getRetrySettings(), analyzeMoveRetry);
+ clientSettingsBuilder.analyzeMoveSettings().setRetrySettings(analyzeMoveRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for analyzeMove from properties.");
+ }
+ }
+ Retry queryAssetsRetry = clientProperties.getQueryAssetsRetry();
+ if (queryAssetsRetry != null) {
+ RetrySettings queryAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryAssetsSettings().getRetrySettings(), queryAssetsRetry);
+ clientSettingsBuilder.queryAssetsSettings().setRetrySettings(queryAssetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for queryAssets from properties.");
+ }
+ }
+ Retry createSavedQueryRetry = clientProperties.getCreateSavedQueryRetry();
+ if (createSavedQueryRetry != null) {
+ RetrySettings createSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSavedQuerySettings().getRetrySettings(),
+ createSavedQueryRetry);
+ clientSettingsBuilder
+ .createSavedQuerySettings()
+ .setRetrySettings(createSavedQueryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createSavedQuery from properties.");
+ }
+ }
+ Retry getSavedQueryRetry = clientProperties.getGetSavedQueryRetry();
+ if (getSavedQueryRetry != null) {
+ RetrySettings getSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSavedQuerySettings().getRetrySettings(), getSavedQueryRetry);
+ clientSettingsBuilder.getSavedQuerySettings().setRetrySettings(getSavedQueryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSavedQuery from properties.");
+ }
+ }
+ Retry listSavedQueriesRetry = clientProperties.getListSavedQueriesRetry();
+ if (listSavedQueriesRetry != null) {
+ RetrySettings listSavedQueriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSavedQueriesSettings().getRetrySettings(),
+ listSavedQueriesRetry);
+ clientSettingsBuilder
+ .listSavedQueriesSettings()
+ .setRetrySettings(listSavedQueriesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listSavedQueries from properties.");
+ }
+ }
+ Retry updateSavedQueryRetry = clientProperties.getUpdateSavedQueryRetry();
+ if (updateSavedQueryRetry != null) {
+ RetrySettings updateSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSavedQuerySettings().getRetrySettings(),
+ updateSavedQueryRetry);
+ clientSettingsBuilder
+ .updateSavedQuerySettings()
+ .setRetrySettings(updateSavedQueryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateSavedQuery from properties.");
+ }
+ }
+ Retry deleteSavedQueryRetry = clientProperties.getDeleteSavedQueryRetry();
+ if (deleteSavedQueryRetry != null) {
+ RetrySettings deleteSavedQueryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteSavedQuerySettings().getRetrySettings(),
+ deleteSavedQueryRetry);
+ clientSettingsBuilder
+ .deleteSavedQuerySettings()
+ .setRetrySettings(deleteSavedQueryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteSavedQuery from properties.");
+ }
+ }
+ Retry batchGetEffectiveIamPoliciesRetry =
+ clientProperties.getBatchGetEffectiveIamPoliciesRetry();
+ if (batchGetEffectiveIamPoliciesRetry != null) {
+ RetrySettings batchGetEffectiveIamPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetEffectiveIamPoliciesSettings().getRetrySettings(),
+ batchGetEffectiveIamPoliciesRetry);
+ clientSettingsBuilder
+ .batchGetEffectiveIamPoliciesSettings()
+ .setRetrySettings(batchGetEffectiveIamPoliciesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for batchGetEffectiveIamPolicies from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a AssetServiceClient bean configured with AssetServiceSettings.
+ *
+ * @param assetServiceSettings settings to configure an instance of client bean.
+ * @return a {@link AssetServiceClient} bean configured with {@link AssetServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AssetServiceClient assetServiceClient(AssetServiceSettings assetServiceSettings)
+ throws IOException {
+ return AssetServiceClient.create(assetServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-asset-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringProperties.java b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringProperties.java
new file mode 100644
index 0000000000..c1569b649d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/AssetServiceSpringProperties.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2022 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.asset.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 AssetService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.asset.v1.asset-service")
+public class AssetServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listAssets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAssetsRetry;
+ /**
+ * Allow override of retry settings at method-level for batchGetAssetsHistory. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry batchGetAssetsHistoryRetry;
+ /**
+ * Allow override of retry settings at method-level for createFeed. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createFeedRetry;
+ /**
+ * Allow override of retry settings at method-level for getFeed. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getFeedRetry;
+ /**
+ * Allow override of retry settings at method-level for listFeeds. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFeedsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateFeed. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateFeedRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteFeed. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteFeedRetry;
+ /**
+ * Allow override of retry settings at method-level for searchAllResources. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchAllResourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for searchAllIamPolicies. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchAllIamPoliciesRetry;
+ /**
+ * Allow override of retry settings at method-level for analyzeIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for analyzeMove. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeMoveRetry;
+ /**
+ * Allow override of retry settings at method-level for queryAssets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry queryAssetsRetry;
+ /**
+ * Allow override of retry settings at method-level for createSavedQuery. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createSavedQueryRetry;
+ /**
+ * Allow override of retry settings at method-level for getSavedQuery. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSavedQueryRetry;
+ /**
+ * Allow override of retry settings at method-level for listSavedQueries. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSavedQueriesRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSavedQuery. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSavedQueryRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteSavedQuery. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteSavedQueryRetry;
+ /**
+ * Allow override of retry settings at method-level for batchGetEffectiveIamPolicies. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry batchGetEffectiveIamPoliciesRetry;
+
+ @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 getListAssetsRetry() {
+ return this.listAssetsRetry;
+ }
+
+ public void setListAssetsRetry(Retry listAssetsRetry) {
+ this.listAssetsRetry = listAssetsRetry;
+ }
+
+ public Retry getBatchGetAssetsHistoryRetry() {
+ return this.batchGetAssetsHistoryRetry;
+ }
+
+ public void setBatchGetAssetsHistoryRetry(Retry batchGetAssetsHistoryRetry) {
+ this.batchGetAssetsHistoryRetry = batchGetAssetsHistoryRetry;
+ }
+
+ public Retry getCreateFeedRetry() {
+ return this.createFeedRetry;
+ }
+
+ public void setCreateFeedRetry(Retry createFeedRetry) {
+ this.createFeedRetry = createFeedRetry;
+ }
+
+ public Retry getGetFeedRetry() {
+ return this.getFeedRetry;
+ }
+
+ public void setGetFeedRetry(Retry getFeedRetry) {
+ this.getFeedRetry = getFeedRetry;
+ }
+
+ public Retry getListFeedsRetry() {
+ return this.listFeedsRetry;
+ }
+
+ public void setListFeedsRetry(Retry listFeedsRetry) {
+ this.listFeedsRetry = listFeedsRetry;
+ }
+
+ public Retry getUpdateFeedRetry() {
+ return this.updateFeedRetry;
+ }
+
+ public void setUpdateFeedRetry(Retry updateFeedRetry) {
+ this.updateFeedRetry = updateFeedRetry;
+ }
+
+ public Retry getDeleteFeedRetry() {
+ return this.deleteFeedRetry;
+ }
+
+ public void setDeleteFeedRetry(Retry deleteFeedRetry) {
+ this.deleteFeedRetry = deleteFeedRetry;
+ }
+
+ public Retry getSearchAllResourcesRetry() {
+ return this.searchAllResourcesRetry;
+ }
+
+ public void setSearchAllResourcesRetry(Retry searchAllResourcesRetry) {
+ this.searchAllResourcesRetry = searchAllResourcesRetry;
+ }
+
+ public Retry getSearchAllIamPoliciesRetry() {
+ return this.searchAllIamPoliciesRetry;
+ }
+
+ public void setSearchAllIamPoliciesRetry(Retry searchAllIamPoliciesRetry) {
+ this.searchAllIamPoliciesRetry = searchAllIamPoliciesRetry;
+ }
+
+ public Retry getAnalyzeIamPolicyRetry() {
+ return this.analyzeIamPolicyRetry;
+ }
+
+ public void setAnalyzeIamPolicyRetry(Retry analyzeIamPolicyRetry) {
+ this.analyzeIamPolicyRetry = analyzeIamPolicyRetry;
+ }
+
+ public Retry getAnalyzeMoveRetry() {
+ return this.analyzeMoveRetry;
+ }
+
+ public void setAnalyzeMoveRetry(Retry analyzeMoveRetry) {
+ this.analyzeMoveRetry = analyzeMoveRetry;
+ }
+
+ public Retry getQueryAssetsRetry() {
+ return this.queryAssetsRetry;
+ }
+
+ public void setQueryAssetsRetry(Retry queryAssetsRetry) {
+ this.queryAssetsRetry = queryAssetsRetry;
+ }
+
+ public Retry getCreateSavedQueryRetry() {
+ return this.createSavedQueryRetry;
+ }
+
+ public void setCreateSavedQueryRetry(Retry createSavedQueryRetry) {
+ this.createSavedQueryRetry = createSavedQueryRetry;
+ }
+
+ public Retry getGetSavedQueryRetry() {
+ return this.getSavedQueryRetry;
+ }
+
+ public void setGetSavedQueryRetry(Retry getSavedQueryRetry) {
+ this.getSavedQueryRetry = getSavedQueryRetry;
+ }
+
+ public Retry getListSavedQueriesRetry() {
+ return this.listSavedQueriesRetry;
+ }
+
+ public void setListSavedQueriesRetry(Retry listSavedQueriesRetry) {
+ this.listSavedQueriesRetry = listSavedQueriesRetry;
+ }
+
+ public Retry getUpdateSavedQueryRetry() {
+ return this.updateSavedQueryRetry;
+ }
+
+ public void setUpdateSavedQueryRetry(Retry updateSavedQueryRetry) {
+ this.updateSavedQueryRetry = updateSavedQueryRetry;
+ }
+
+ public Retry getDeleteSavedQueryRetry() {
+ return this.deleteSavedQueryRetry;
+ }
+
+ public void setDeleteSavedQueryRetry(Retry deleteSavedQueryRetry) {
+ this.deleteSavedQueryRetry = deleteSavedQueryRetry;
+ }
+
+ public Retry getBatchGetEffectiveIamPoliciesRetry() {
+ return this.batchGetEffectiveIamPoliciesRetry;
+ }
+
+ public void setBatchGetEffectiveIamPoliciesRetry(Retry batchGetEffectiveIamPoliciesRetry) {
+ this.batchGetEffectiveIamPoliciesRetry = batchGetEffectiveIamPoliciesRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/package-info.java
new file mode 100644
index 0000000000..562d0314e1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/java/com/google/cloud/asset/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudasset. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.asset.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..203703ecb3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.asset.v1.asset-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudasset/AssetService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1251093c3f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-asset-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.asset.v1.spring.AssetServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/pom.xml
new file mode 100644
index 0000000000..45fcc3a48a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in AssuredWorkloadsServiceSpringProperties. 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 AssuredWorkloadsServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings(
+ @Qualifier("defaultAssuredWorkloadsServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ AssuredWorkloadsServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = AssuredWorkloadsServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = AssuredWorkloadsServiceSettings.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 =
+ AssuredWorkloadsServiceSettings.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 updateWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateWorkloadSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateWorkloadSettings().setRetrySettings(updateWorkloadRetrySettings);
+
+ RetrySettings restrictAllowedResourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.restrictAllowedResourcesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .restrictAllowedResourcesSettings()
+ .setRetrySettings(restrictAllowedResourcesRetrySettings);
+
+ RetrySettings deleteWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteWorkloadSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteWorkloadSettings().setRetrySettings(deleteWorkloadRetrySettings);
+
+ RetrySettings getWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkloadSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getWorkloadSettings().setRetrySettings(getWorkloadRetrySettings);
+
+ RetrySettings listWorkloadsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings);
+
+ RetrySettings listViolationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listViolationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listViolationsSettings().setRetrySettings(listViolationsRetrySettings);
+
+ RetrySettings getViolationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getViolationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getViolationSettings().setRetrySettings(getViolationRetrySettings);
+
+ RetrySettings acknowledgeViolationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.acknowledgeViolationSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .acknowledgeViolationSettings()
+ .setRetrySettings(acknowledgeViolationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry updateWorkloadRetry = clientProperties.getUpdateWorkloadRetry();
+ if (updateWorkloadRetry != null) {
+ RetrySettings updateWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateWorkloadSettings().getRetrySettings(),
+ updateWorkloadRetry);
+ clientSettingsBuilder.updateWorkloadSettings().setRetrySettings(updateWorkloadRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateWorkload from properties.");
+ }
+ }
+ Retry restrictAllowedResourcesRetry = clientProperties.getRestrictAllowedResourcesRetry();
+ if (restrictAllowedResourcesRetry != null) {
+ RetrySettings restrictAllowedResourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.restrictAllowedResourcesSettings().getRetrySettings(),
+ restrictAllowedResourcesRetry);
+ clientSettingsBuilder
+ .restrictAllowedResourcesSettings()
+ .setRetrySettings(restrictAllowedResourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for restrictAllowedResources from properties.");
+ }
+ }
+ Retry deleteWorkloadRetry = clientProperties.getDeleteWorkloadRetry();
+ if (deleteWorkloadRetry != null) {
+ RetrySettings deleteWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteWorkloadSettings().getRetrySettings(),
+ deleteWorkloadRetry);
+ clientSettingsBuilder.deleteWorkloadSettings().setRetrySettings(deleteWorkloadRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteWorkload from properties.");
+ }
+ }
+ Retry getWorkloadRetry = clientProperties.getGetWorkloadRetry();
+ if (getWorkloadRetry != null) {
+ RetrySettings getWorkloadRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkloadSettings().getRetrySettings(), getWorkloadRetry);
+ clientSettingsBuilder.getWorkloadSettings().setRetrySettings(getWorkloadRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getWorkload from properties.");
+ }
+ }
+ Retry listWorkloadsRetry = clientProperties.getListWorkloadsRetry();
+ if (listWorkloadsRetry != null) {
+ RetrySettings listWorkloadsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkloadsSettings().getRetrySettings(), listWorkloadsRetry);
+ clientSettingsBuilder.listWorkloadsSettings().setRetrySettings(listWorkloadsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listWorkloads from properties.");
+ }
+ }
+ Retry listViolationsRetry = clientProperties.getListViolationsRetry();
+ if (listViolationsRetry != null) {
+ RetrySettings listViolationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listViolationsSettings().getRetrySettings(),
+ listViolationsRetry);
+ clientSettingsBuilder.listViolationsSettings().setRetrySettings(listViolationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listViolations from properties.");
+ }
+ }
+ Retry getViolationRetry = clientProperties.getGetViolationRetry();
+ if (getViolationRetry != null) {
+ RetrySettings getViolationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getViolationSettings().getRetrySettings(), getViolationRetry);
+ clientSettingsBuilder.getViolationSettings().setRetrySettings(getViolationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getViolation from properties.");
+ }
+ }
+ Retry acknowledgeViolationRetry = clientProperties.getAcknowledgeViolationRetry();
+ if (acknowledgeViolationRetry != null) {
+ RetrySettings acknowledgeViolationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.acknowledgeViolationSettings().getRetrySettings(),
+ acknowledgeViolationRetry);
+ clientSettingsBuilder
+ .acknowledgeViolationSettings()
+ .setRetrySettings(acknowledgeViolationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for acknowledgeViolation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a AssuredWorkloadsServiceClient bean configured with AssuredWorkloadsServiceSettings.
+ *
+ * @param assuredWorkloadsServiceSettings settings to configure an instance of client bean.
+ * @return a {@link AssuredWorkloadsServiceClient} bean configured with {@link
+ * AssuredWorkloadsServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AssuredWorkloadsServiceClient assuredWorkloadsServiceClient(
+ AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings) throws IOException {
+ return AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-assured-workloads-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringProperties.java
new file mode 100644
index 0000000000..eccc217bb1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/AssuredWorkloadsServiceSpringProperties.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2022 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.assuredworkloads.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 AssuredWorkloadsService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.assuredworkloads.v1.assured-workloads-service")
+public class AssuredWorkloadsServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for updateWorkload. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateWorkloadRetry;
+ /**
+ * Allow override of retry settings at method-level for restrictAllowedResources. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry restrictAllowedResourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteWorkload. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteWorkloadRetry;
+ /**
+ * Allow override of retry settings at method-level for getWorkload. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getWorkloadRetry;
+ /**
+ * Allow override of retry settings at method-level for listWorkloads. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listWorkloadsRetry;
+ /**
+ * Allow override of retry settings at method-level for listViolations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listViolationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getViolation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getViolationRetry;
+ /**
+ * Allow override of retry settings at method-level for acknowledgeViolation. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry acknowledgeViolationRetry;
+
+ @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 getUpdateWorkloadRetry() {
+ return this.updateWorkloadRetry;
+ }
+
+ public void setUpdateWorkloadRetry(Retry updateWorkloadRetry) {
+ this.updateWorkloadRetry = updateWorkloadRetry;
+ }
+
+ public Retry getRestrictAllowedResourcesRetry() {
+ return this.restrictAllowedResourcesRetry;
+ }
+
+ public void setRestrictAllowedResourcesRetry(Retry restrictAllowedResourcesRetry) {
+ this.restrictAllowedResourcesRetry = restrictAllowedResourcesRetry;
+ }
+
+ public Retry getDeleteWorkloadRetry() {
+ return this.deleteWorkloadRetry;
+ }
+
+ public void setDeleteWorkloadRetry(Retry deleteWorkloadRetry) {
+ this.deleteWorkloadRetry = deleteWorkloadRetry;
+ }
+
+ public Retry getGetWorkloadRetry() {
+ return this.getWorkloadRetry;
+ }
+
+ public void setGetWorkloadRetry(Retry getWorkloadRetry) {
+ this.getWorkloadRetry = getWorkloadRetry;
+ }
+
+ public Retry getListWorkloadsRetry() {
+ return this.listWorkloadsRetry;
+ }
+
+ public void setListWorkloadsRetry(Retry listWorkloadsRetry) {
+ this.listWorkloadsRetry = listWorkloadsRetry;
+ }
+
+ public Retry getListViolationsRetry() {
+ return this.listViolationsRetry;
+ }
+
+ public void setListViolationsRetry(Retry listViolationsRetry) {
+ this.listViolationsRetry = listViolationsRetry;
+ }
+
+ public Retry getGetViolationRetry() {
+ return this.getViolationRetry;
+ }
+
+ public void setGetViolationRetry(Retry getViolationRetry) {
+ this.getViolationRetry = getViolationRetry;
+ }
+
+ public Retry getAcknowledgeViolationRetry() {
+ return this.acknowledgeViolationRetry;
+ }
+
+ public void setAcknowledgeViolationRetry(Retry acknowledgeViolationRetry) {
+ this.acknowledgeViolationRetry = acknowledgeViolationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/package-info.java
new file mode 100644
index 0000000000..24e8c0094a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/java/com/google/cloud/assuredworkloads/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for assuredworkloads. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.assuredworkloads.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..40a7ab4729
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.assuredworkloads.v1.assured-workloads-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud assuredworkloads/AssuredWorkloadsService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..f3f59b9038
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-assured-workloads-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.assuredworkloads.v1.spring.AssuredWorkloadsServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-automl-spring-starter/pom.xml
new file mode 100644
index 0000000000..e0ec8bc09c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-automl-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AutoMlSpringProperties. 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 AutoMlSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AutoMlSettings autoMlSettings( + @Qualifier("defaultAutoMlTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AutoMlSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AutoMlSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AutoMlSettings.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 = + AutoMlSettings.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 getDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDatasetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDatasetSettings().setRetrySettings(getDatasetRetrySettings); + + RetrySettings listDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDatasetsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDatasetsSettings().setRetrySettings(listDatasetsRetrySettings); + + RetrySettings updateDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateDatasetSettings().setRetrySettings(updateDatasetRetrySettings); + + RetrySettings getAnnotationSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnnotationSpecSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getAnnotationSpecSettings() + .setRetrySettings(getAnnotationSpecRetrySettings); + + RetrySettings getModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getModelSettings().setRetrySettings(getModelRetrySettings); + + RetrySettings listModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listModelsSettings().setRetrySettings(listModelsRetrySettings); + + RetrySettings updateModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateModelSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateModelSettings().setRetrySettings(updateModelRetrySettings); + + RetrySettings getModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getModelEvaluationSettings() + .setRetrySettings(getModelEvaluationRetrySettings); + + RetrySettings listModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listModelEvaluationsSettings() + .setRetrySettings(listModelEvaluationsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getDatasetRetry = clientProperties.getGetDatasetRetry(); + if (getDatasetRetry != null) { + RetrySettings getDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDatasetSettings().getRetrySettings(), getDatasetRetry); + clientSettingsBuilder.getDatasetSettings().setRetrySettings(getDatasetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataset from properties."); + } + } + Retry listDatasetsRetry = clientProperties.getListDatasetsRetry(); + if (listDatasetsRetry != null) { + RetrySettings listDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDatasetsSettings().getRetrySettings(), listDatasetsRetry); + clientSettingsBuilder.listDatasetsSettings().setRetrySettings(listDatasetsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDatasets from properties."); + } + } + Retry updateDatasetRetry = clientProperties.getUpdateDatasetRetry(); + if (updateDatasetRetry != null) { + RetrySettings updateDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateDatasetSettings().getRetrySettings(), updateDatasetRetry); + clientSettingsBuilder.updateDatasetSettings().setRetrySettings(updateDatasetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateDataset from properties."); + } + } + Retry getAnnotationSpecRetry = clientProperties.getGetAnnotationSpecRetry(); + if (getAnnotationSpecRetry != null) { + RetrySettings getAnnotationSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAnnotationSpecSettings().getRetrySettings(), + getAnnotationSpecRetry); + clientSettingsBuilder + .getAnnotationSpecSettings() + .setRetrySettings(getAnnotationSpecRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAnnotationSpec from properties."); + } + } + Retry getModelRetry = clientProperties.getGetModelRetry(); + if (getModelRetry != null) { + RetrySettings getModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelSettings().getRetrySettings(), getModelRetry); + clientSettingsBuilder.getModelSettings().setRetrySettings(getModelRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getModel from properties."); + } + } + Retry listModelsRetry = clientProperties.getListModelsRetry(); + if (listModelsRetry != null) { + RetrySettings listModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelsSettings().getRetrySettings(), listModelsRetry); + clientSettingsBuilder.listModelsSettings().setRetrySettings(listModelsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listModels from properties."); + } + } + Retry updateModelRetry = clientProperties.getUpdateModelRetry(); + if (updateModelRetry != null) { + RetrySettings updateModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateModelSettings().getRetrySettings(), updateModelRetry); + clientSettingsBuilder.updateModelSettings().setRetrySettings(updateModelRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateModel from properties."); + } + } + Retry getModelEvaluationRetry = clientProperties.getGetModelEvaluationRetry(); + if (getModelEvaluationRetry != null) { + RetrySettings getModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getModelEvaluationSettings().getRetrySettings(), + getModelEvaluationRetry); + clientSettingsBuilder + .getModelEvaluationSettings() + .setRetrySettings(getModelEvaluationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getModelEvaluation from properties."); + } + } + Retry listModelEvaluationsRetry = clientProperties.getListModelEvaluationsRetry(); + if (listModelEvaluationsRetry != null) { + RetrySettings listModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listModelEvaluationsSettings().getRetrySettings(), + listModelEvaluationsRetry); + clientSettingsBuilder + .listModelEvaluationsSettings() + .setRetrySettings(listModelEvaluationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listModelEvaluations from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AutoMlClient bean configured with AutoMlSettings. + * + * @param autoMlSettings settings to configure an instance of client bean. + * @return a {@link AutoMlClient} bean configured with {@link AutoMlSettings} + */ + @Bean + @ConditionalOnMissingBean + public AutoMlClient autoMlClient(AutoMlSettings autoMlSettings) throws IOException { + return AutoMlClient.create(autoMlSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-auto-ml"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringProperties.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringProperties.java new file mode 100644 index 0000000000..ec80b7c385 --- /dev/null +++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/AutoMlSpringProperties.java @@ -0,0 +1,199 @@ +/* + * Copyright 2022 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.automl.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 AutoMl client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.automl.v1.auto-ml") +public class AutoMlSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getDataset. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDatasetRetry; + /** + * Allow override of retry settings at method-level for listDatasets. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDatasetsRetry; + /** + * Allow override of retry settings at method-level for updateDataset. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateDatasetRetry; + /** + * Allow override of retry settings at method-level for getAnnotationSpec. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAnnotationSpecRetry; + /** + * Allow override of retry settings at method-level for getModel. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelRetry; + /** + * Allow override of retry settings at method-level for listModels. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelsRetry; + /** + * Allow override of retry settings at method-level for updateModel. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateModelRetry; + /** + * Allow override of retry settings at method-level for getModelEvaluation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getModelEvaluationRetry; + /** + * Allow override of retry settings at method-level for listModelEvaluations. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listModelEvaluationsRetry; + + @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 getGetDatasetRetry() { + return this.getDatasetRetry; + } + + public void setGetDatasetRetry(Retry getDatasetRetry) { + this.getDatasetRetry = getDatasetRetry; + } + + public Retry getListDatasetsRetry() { + return this.listDatasetsRetry; + } + + public void setListDatasetsRetry(Retry listDatasetsRetry) { + this.listDatasetsRetry = listDatasetsRetry; + } + + public Retry getUpdateDatasetRetry() { + return this.updateDatasetRetry; + } + + public void setUpdateDatasetRetry(Retry updateDatasetRetry) { + this.updateDatasetRetry = updateDatasetRetry; + } + + public Retry getGetAnnotationSpecRetry() { + return this.getAnnotationSpecRetry; + } + + public void setGetAnnotationSpecRetry(Retry getAnnotationSpecRetry) { + this.getAnnotationSpecRetry = getAnnotationSpecRetry; + } + + public Retry getGetModelRetry() { + return this.getModelRetry; + } + + public void setGetModelRetry(Retry getModelRetry) { + this.getModelRetry = getModelRetry; + } + + public Retry getListModelsRetry() { + return this.listModelsRetry; + } + + public void setListModelsRetry(Retry listModelsRetry) { + this.listModelsRetry = listModelsRetry; + } + + public Retry getUpdateModelRetry() { + return this.updateModelRetry; + } + + public void setUpdateModelRetry(Retry updateModelRetry) { + this.updateModelRetry = updateModelRetry; + } + + public Retry getGetModelEvaluationRetry() { + return this.getModelEvaluationRetry; + } + + public void setGetModelEvaluationRetry(Retry getModelEvaluationRetry) { + this.getModelEvaluationRetry = getModelEvaluationRetry; + } + + public Retry getListModelEvaluationsRetry() { + return this.listModelEvaluationsRetry; + } + + public void setListModelEvaluationsRetry(Retry listModelEvaluationsRetry) { + this.listModelEvaluationsRetry = listModelEvaluationsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..3fa0f7db82 --- /dev/null +++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * Copyright 2022 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.automl.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.automl.v1.PredictionServiceClient; +import com.google.cloud.automl.v1.PredictionServiceSettings; +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 PredictionServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in PredictionServiceSpringProperties. 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 PredictionServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PredictionServiceSettings predictionServiceSettings(
+ @Qualifier("defaultPredictionServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ PredictionServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = PredictionServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = PredictionServiceSettings.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 =
+ PredictionServiceSettings.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 predictRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.predictSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry predictRetry = clientProperties.getPredictRetry();
+ if (predictRetry != null) {
+ RetrySettings predictRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.predictSettings().getRetrySettings(), predictRetry);
+ clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for predict from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a PredictionServiceClient bean configured with PredictionServiceSettings.
+ *
+ * @param predictionServiceSettings settings to configure an instance of client bean.
+ * @return a {@link PredictionServiceClient} bean configured with {@link
+ * PredictionServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PredictionServiceClient predictionServiceClient(
+ PredictionServiceSettings predictionServiceSettings) throws IOException {
+ return PredictionServiceClient.create(predictionServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-prediction-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringProperties.java
new file mode 100644
index 0000000000..ff19cad091
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/PredictionServiceSpringProperties.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2022 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.automl.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 PredictionService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.automl.v1.prediction-service")
+public class PredictionServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** 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 predict. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry predictRetry;
+
+ @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 getPredictRetry() {
+ return this.predictRetry;
+ }
+
+ public void setPredictRetry(Retry predictRetry) {
+ this.predictRetry = predictRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/package-info.java
new file mode 100644
index 0000000000..82ff4cb0c9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/java/com/google/cloud/automl/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for automl. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.automl.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..6af52c4660
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.automl.v1.prediction-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud automl/PredictionService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.automl.v1.auto-ml.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud automl/AutoMl components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..63cbdbef95
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-automl-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.automl.v1.spring.PredictionServiceSpringAutoConfiguration
+com.google.cloud.automl.v1.spring.AutoMlSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/pom.xml
new file mode 100644
index 0000000000..e79d19106e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ConnectionServiceSpringProperties. 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 ConnectionServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ConnectionServiceSettings connectionServiceSettings(
+ @Qualifier("defaultConnectionServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ConnectionServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ConnectionServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ConnectionServiceSettings.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 =
+ ConnectionServiceSettings.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 createConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createConnectionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createConnectionSettings()
+ .setRetrySettings(createConnectionRetrySettings);
+
+ RetrySettings getConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getConnectionSettings().setRetrySettings(getConnectionRetrySettings);
+
+ RetrySettings listConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listConnectionsSettings()
+ .setRetrySettings(listConnectionsRetrySettings);
+
+ RetrySettings updateConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConnectionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateConnectionSettings()
+ .setRetrySettings(updateConnectionRetrySettings);
+
+ RetrySettings deleteConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteConnectionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteConnectionSettings()
+ .setRetrySettings(deleteConnectionRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createConnectionRetry = clientProperties.getCreateConnectionRetry();
+ if (createConnectionRetry != null) {
+ RetrySettings createConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createConnectionSettings().getRetrySettings(),
+ createConnectionRetry);
+ clientSettingsBuilder
+ .createConnectionSettings()
+ .setRetrySettings(createConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createConnection from properties.");
+ }
+ }
+ Retry getConnectionRetry = clientProperties.getGetConnectionRetry();
+ if (getConnectionRetry != null) {
+ RetrySettings getConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionSettings().getRetrySettings(), getConnectionRetry);
+ clientSettingsBuilder.getConnectionSettings().setRetrySettings(getConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getConnection from properties.");
+ }
+ }
+ Retry listConnectionsRetry = clientProperties.getListConnectionsRetry();
+ if (listConnectionsRetry != null) {
+ RetrySettings listConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionsSettings().getRetrySettings(),
+ listConnectionsRetry);
+ clientSettingsBuilder
+ .listConnectionsSettings()
+ .setRetrySettings(listConnectionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listConnections from properties.");
+ }
+ }
+ Retry updateConnectionRetry = clientProperties.getUpdateConnectionRetry();
+ if (updateConnectionRetry != null) {
+ RetrySettings updateConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConnectionSettings().getRetrySettings(),
+ updateConnectionRetry);
+ clientSettingsBuilder
+ .updateConnectionSettings()
+ .setRetrySettings(updateConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateConnection from properties.");
+ }
+ }
+ Retry deleteConnectionRetry = clientProperties.getDeleteConnectionRetry();
+ if (deleteConnectionRetry != null) {
+ RetrySettings deleteConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteConnectionSettings().getRetrySettings(),
+ deleteConnectionRetry);
+ clientSettingsBuilder
+ .deleteConnectionSettings()
+ .setRetrySettings(deleteConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteConnection from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ConnectionServiceClient bean configured with ConnectionServiceSettings.
+ *
+ * @param connectionServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ConnectionServiceClient} bean configured with {@link
+ * ConnectionServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ConnectionServiceClient connectionServiceClient(
+ ConnectionServiceSettings connectionServiceSettings) throws IOException {
+ return ConnectionServiceClient.create(connectionServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-connection-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringProperties.java
new file mode 100644
index 0000000000..f7e2d7fe55
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/ConnectionServiceSpringProperties.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2022 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.bigqueryconnection.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 ConnectionService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.bigqueryconnection.v1.connection-service")
+public class ConnectionServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createConnection. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for getConnection. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for listConnections. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConnectionsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateConnection. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteConnection. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getCreateConnectionRetry() {
+ return this.createConnectionRetry;
+ }
+
+ public void setCreateConnectionRetry(Retry createConnectionRetry) {
+ this.createConnectionRetry = createConnectionRetry;
+ }
+
+ public Retry getGetConnectionRetry() {
+ return this.getConnectionRetry;
+ }
+
+ public void setGetConnectionRetry(Retry getConnectionRetry) {
+ this.getConnectionRetry = getConnectionRetry;
+ }
+
+ public Retry getListConnectionsRetry() {
+ return this.listConnectionsRetry;
+ }
+
+ public void setListConnectionsRetry(Retry listConnectionsRetry) {
+ this.listConnectionsRetry = listConnectionsRetry;
+ }
+
+ public Retry getUpdateConnectionRetry() {
+ return this.updateConnectionRetry;
+ }
+
+ public void setUpdateConnectionRetry(Retry updateConnectionRetry) {
+ this.updateConnectionRetry = updateConnectionRetry;
+ }
+
+ public Retry getDeleteConnectionRetry() {
+ return this.deleteConnectionRetry;
+ }
+
+ public void setDeleteConnectionRetry(Retry deleteConnectionRetry) {
+ this.deleteConnectionRetry = deleteConnectionRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/package-info.java
new file mode 100644
index 0000000000..4b43d90c8a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/java/com/google/cloud/bigqueryconnection/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for bigqueryconnection. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.bigqueryconnection.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..9309d9e185
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.bigqueryconnection.v1.connection-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud bigqueryconnection/ConnectionService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..ac56cf6a7b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryconnection-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.bigqueryconnection.v1.spring.ConnectionServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/pom.xml
new file mode 100644
index 0000000000..3e2ba4508a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DataTransferServiceSpringProperties. 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 DataTransferServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataTransferServiceSettings dataTransferServiceSettings(
+ @Qualifier("defaultDataTransferServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DataTransferServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DataTransferServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DataTransferServiceSettings.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 =
+ DataTransferServiceSettings.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 getDataSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDataSourceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDataSourceSettings().setRetrySettings(getDataSourceRetrySettings);
+
+ RetrySettings listDataSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDataSourcesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listDataSourcesSettings()
+ .setRetrySettings(listDataSourcesRetrySettings);
+
+ RetrySettings createTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTransferConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createTransferConfigSettings()
+ .setRetrySettings(createTransferConfigRetrySettings);
+
+ RetrySettings updateTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTransferConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateTransferConfigSettings()
+ .setRetrySettings(updateTransferConfigRetrySettings);
+
+ RetrySettings deleteTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteTransferConfigSettings()
+ .setRetrySettings(deleteTransferConfigRetrySettings);
+
+ RetrySettings getTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getTransferConfigSettings()
+ .setRetrySettings(getTransferConfigRetrySettings);
+
+ RetrySettings listTransferConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferConfigsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listTransferConfigsSettings()
+ .setRetrySettings(listTransferConfigsRetrySettings);
+
+ RetrySettings scheduleTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.scheduleTransferRunsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .scheduleTransferRunsSettings()
+ .setRetrySettings(scheduleTransferRunsRetrySettings);
+
+ RetrySettings startManualTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startManualTransferRunsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .startManualTransferRunsSettings()
+ .setRetrySettings(startManualTransferRunsRetrySettings);
+
+ RetrySettings getTransferRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTransferRunSettings().setRetrySettings(getTransferRunRetrySettings);
+
+ RetrySettings deleteTransferRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteTransferRunSettings()
+ .setRetrySettings(deleteTransferRunRetrySettings);
+
+ RetrySettings listTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferRunsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listTransferRunsSettings()
+ .setRetrySettings(listTransferRunsRetrySettings);
+
+ RetrySettings listTransferLogsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferLogsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listTransferLogsSettings()
+ .setRetrySettings(listTransferLogsRetrySettings);
+
+ RetrySettings checkValidCredsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkValidCredsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .checkValidCredsSettings()
+ .setRetrySettings(checkValidCredsRetrySettings);
+
+ RetrySettings enrollDataSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enrollDataSourcesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .enrollDataSourcesSettings()
+ .setRetrySettings(enrollDataSourcesRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getDataSourceRetry = clientProperties.getGetDataSourceRetry();
+ if (getDataSourceRetry != null) {
+ RetrySettings getDataSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDataSourceSettings().getRetrySettings(), getDataSourceRetry);
+ clientSettingsBuilder.getDataSourceSettings().setRetrySettings(getDataSourceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDataSource from properties.");
+ }
+ }
+ Retry listDataSourcesRetry = clientProperties.getListDataSourcesRetry();
+ if (listDataSourcesRetry != null) {
+ RetrySettings listDataSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDataSourcesSettings().getRetrySettings(),
+ listDataSourcesRetry);
+ clientSettingsBuilder
+ .listDataSourcesSettings()
+ .setRetrySettings(listDataSourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDataSources from properties.");
+ }
+ }
+ Retry createTransferConfigRetry = clientProperties.getCreateTransferConfigRetry();
+ if (createTransferConfigRetry != null) {
+ RetrySettings createTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTransferConfigSettings().getRetrySettings(),
+ createTransferConfigRetry);
+ clientSettingsBuilder
+ .createTransferConfigSettings()
+ .setRetrySettings(createTransferConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createTransferConfig from properties.");
+ }
+ }
+ Retry updateTransferConfigRetry = clientProperties.getUpdateTransferConfigRetry();
+ if (updateTransferConfigRetry != null) {
+ RetrySettings updateTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTransferConfigSettings().getRetrySettings(),
+ updateTransferConfigRetry);
+ clientSettingsBuilder
+ .updateTransferConfigSettings()
+ .setRetrySettings(updateTransferConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateTransferConfig from properties.");
+ }
+ }
+ Retry deleteTransferConfigRetry = clientProperties.getDeleteTransferConfigRetry();
+ if (deleteTransferConfigRetry != null) {
+ RetrySettings deleteTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferConfigSettings().getRetrySettings(),
+ deleteTransferConfigRetry);
+ clientSettingsBuilder
+ .deleteTransferConfigSettings()
+ .setRetrySettings(deleteTransferConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteTransferConfig from properties.");
+ }
+ }
+ Retry getTransferConfigRetry = clientProperties.getGetTransferConfigRetry();
+ if (getTransferConfigRetry != null) {
+ RetrySettings getTransferConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferConfigSettings().getRetrySettings(),
+ getTransferConfigRetry);
+ clientSettingsBuilder
+ .getTransferConfigSettings()
+ .setRetrySettings(getTransferConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getTransferConfig from properties.");
+ }
+ }
+ Retry listTransferConfigsRetry = clientProperties.getListTransferConfigsRetry();
+ if (listTransferConfigsRetry != null) {
+ RetrySettings listTransferConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferConfigsSettings().getRetrySettings(),
+ listTransferConfigsRetry);
+ clientSettingsBuilder
+ .listTransferConfigsSettings()
+ .setRetrySettings(listTransferConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferConfigs from properties.");
+ }
+ }
+ Retry scheduleTransferRunsRetry = clientProperties.getScheduleTransferRunsRetry();
+ if (scheduleTransferRunsRetry != null) {
+ RetrySettings scheduleTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.scheduleTransferRunsSettings().getRetrySettings(),
+ scheduleTransferRunsRetry);
+ clientSettingsBuilder
+ .scheduleTransferRunsSettings()
+ .setRetrySettings(scheduleTransferRunsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for scheduleTransferRuns from properties.");
+ }
+ }
+ Retry startManualTransferRunsRetry = clientProperties.getStartManualTransferRunsRetry();
+ if (startManualTransferRunsRetry != null) {
+ RetrySettings startManualTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startManualTransferRunsSettings().getRetrySettings(),
+ startManualTransferRunsRetry);
+ clientSettingsBuilder
+ .startManualTransferRunsSettings()
+ .setRetrySettings(startManualTransferRunsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for startManualTransferRuns from properties.");
+ }
+ }
+ Retry getTransferRunRetry = clientProperties.getGetTransferRunRetry();
+ if (getTransferRunRetry != null) {
+ RetrySettings getTransferRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferRunSettings().getRetrySettings(),
+ getTransferRunRetry);
+ clientSettingsBuilder.getTransferRunSettings().setRetrySettings(getTransferRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTransferRun from properties.");
+ }
+ }
+ Retry deleteTransferRunRetry = clientProperties.getDeleteTransferRunRetry();
+ if (deleteTransferRunRetry != null) {
+ RetrySettings deleteTransferRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferRunSettings().getRetrySettings(),
+ deleteTransferRunRetry);
+ clientSettingsBuilder
+ .deleteTransferRunSettings()
+ .setRetrySettings(deleteTransferRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteTransferRun from properties.");
+ }
+ }
+ Retry listTransferRunsRetry = clientProperties.getListTransferRunsRetry();
+ if (listTransferRunsRetry != null) {
+ RetrySettings listTransferRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferRunsSettings().getRetrySettings(),
+ listTransferRunsRetry);
+ clientSettingsBuilder
+ .listTransferRunsSettings()
+ .setRetrySettings(listTransferRunsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferRuns from properties.");
+ }
+ }
+ Retry listTransferLogsRetry = clientProperties.getListTransferLogsRetry();
+ if (listTransferLogsRetry != null) {
+ RetrySettings listTransferLogsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferLogsSettings().getRetrySettings(),
+ listTransferLogsRetry);
+ clientSettingsBuilder
+ .listTransferLogsSettings()
+ .setRetrySettings(listTransferLogsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferLogs from properties.");
+ }
+ }
+ Retry checkValidCredsRetry = clientProperties.getCheckValidCredsRetry();
+ if (checkValidCredsRetry != null) {
+ RetrySettings checkValidCredsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkValidCredsSettings().getRetrySettings(),
+ checkValidCredsRetry);
+ clientSettingsBuilder
+ .checkValidCredsSettings()
+ .setRetrySettings(checkValidCredsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for checkValidCreds from properties.");
+ }
+ }
+ Retry enrollDataSourcesRetry = clientProperties.getEnrollDataSourcesRetry();
+ if (enrollDataSourcesRetry != null) {
+ RetrySettings enrollDataSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enrollDataSourcesSettings().getRetrySettings(),
+ enrollDataSourcesRetry);
+ clientSettingsBuilder
+ .enrollDataSourcesSettings()
+ .setRetrySettings(enrollDataSourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for enrollDataSources from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DataTransferServiceClient bean configured with DataTransferServiceSettings.
+ *
+ * @param dataTransferServiceSettings settings to configure an instance of client bean.
+ * @return a {@link DataTransferServiceClient} bean configured with {@link
+ * DataTransferServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataTransferServiceClient dataTransferServiceClient(
+ DataTransferServiceSettings dataTransferServiceSettings) throws IOException {
+ return DataTransferServiceClient.create(dataTransferServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-data-transfer-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringProperties.java b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringProperties.java
new file mode 100644
index 0000000000..5179acfc15
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/DataTransferServiceSpringProperties.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.bigquery.datatransfer.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 DataTransferService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.bigquery.datatransfer.v1.data-transfer-service")
+public class DataTransferServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getDataSource. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDataSourceRetry;
+ /**
+ * Allow override of retry settings at method-level for listDataSources. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDataSourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for createTransferConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTransferConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateTransferConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateTransferConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTransferConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTransferConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getTransferConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTransferConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferConfigs. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for scheduleTransferRuns. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry scheduleTransferRunsRetry;
+ /**
+ * Allow override of retry settings at method-level for startManualTransferRuns. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry startManualTransferRunsRetry;
+ /**
+ * Allow override of retry settings at method-level for getTransferRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTransferRunRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTransferRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTransferRunRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferRuns. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferRunsRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferLogs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferLogsRetry;
+ /**
+ * Allow override of retry settings at method-level for checkValidCreds. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry checkValidCredsRetry;
+ /**
+ * Allow override of retry settings at method-level for enrollDataSources. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry enrollDataSourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getGetDataSourceRetry() {
+ return this.getDataSourceRetry;
+ }
+
+ public void setGetDataSourceRetry(Retry getDataSourceRetry) {
+ this.getDataSourceRetry = getDataSourceRetry;
+ }
+
+ public Retry getListDataSourcesRetry() {
+ return this.listDataSourcesRetry;
+ }
+
+ public void setListDataSourcesRetry(Retry listDataSourcesRetry) {
+ this.listDataSourcesRetry = listDataSourcesRetry;
+ }
+
+ public Retry getCreateTransferConfigRetry() {
+ return this.createTransferConfigRetry;
+ }
+
+ public void setCreateTransferConfigRetry(Retry createTransferConfigRetry) {
+ this.createTransferConfigRetry = createTransferConfigRetry;
+ }
+
+ public Retry getUpdateTransferConfigRetry() {
+ return this.updateTransferConfigRetry;
+ }
+
+ public void setUpdateTransferConfigRetry(Retry updateTransferConfigRetry) {
+ this.updateTransferConfigRetry = updateTransferConfigRetry;
+ }
+
+ public Retry getDeleteTransferConfigRetry() {
+ return this.deleteTransferConfigRetry;
+ }
+
+ public void setDeleteTransferConfigRetry(Retry deleteTransferConfigRetry) {
+ this.deleteTransferConfigRetry = deleteTransferConfigRetry;
+ }
+
+ public Retry getGetTransferConfigRetry() {
+ return this.getTransferConfigRetry;
+ }
+
+ public void setGetTransferConfigRetry(Retry getTransferConfigRetry) {
+ this.getTransferConfigRetry = getTransferConfigRetry;
+ }
+
+ public Retry getListTransferConfigsRetry() {
+ return this.listTransferConfigsRetry;
+ }
+
+ public void setListTransferConfigsRetry(Retry listTransferConfigsRetry) {
+ this.listTransferConfigsRetry = listTransferConfigsRetry;
+ }
+
+ public Retry getScheduleTransferRunsRetry() {
+ return this.scheduleTransferRunsRetry;
+ }
+
+ public void setScheduleTransferRunsRetry(Retry scheduleTransferRunsRetry) {
+ this.scheduleTransferRunsRetry = scheduleTransferRunsRetry;
+ }
+
+ public Retry getStartManualTransferRunsRetry() {
+ return this.startManualTransferRunsRetry;
+ }
+
+ public void setStartManualTransferRunsRetry(Retry startManualTransferRunsRetry) {
+ this.startManualTransferRunsRetry = startManualTransferRunsRetry;
+ }
+
+ public Retry getGetTransferRunRetry() {
+ return this.getTransferRunRetry;
+ }
+
+ public void setGetTransferRunRetry(Retry getTransferRunRetry) {
+ this.getTransferRunRetry = getTransferRunRetry;
+ }
+
+ public Retry getDeleteTransferRunRetry() {
+ return this.deleteTransferRunRetry;
+ }
+
+ public void setDeleteTransferRunRetry(Retry deleteTransferRunRetry) {
+ this.deleteTransferRunRetry = deleteTransferRunRetry;
+ }
+
+ public Retry getListTransferRunsRetry() {
+ return this.listTransferRunsRetry;
+ }
+
+ public void setListTransferRunsRetry(Retry listTransferRunsRetry) {
+ this.listTransferRunsRetry = listTransferRunsRetry;
+ }
+
+ public Retry getListTransferLogsRetry() {
+ return this.listTransferLogsRetry;
+ }
+
+ public void setListTransferLogsRetry(Retry listTransferLogsRetry) {
+ this.listTransferLogsRetry = listTransferLogsRetry;
+ }
+
+ public Retry getCheckValidCredsRetry() {
+ return this.checkValidCredsRetry;
+ }
+
+ public void setCheckValidCredsRetry(Retry checkValidCredsRetry) {
+ this.checkValidCredsRetry = checkValidCredsRetry;
+ }
+
+ public Retry getEnrollDataSourcesRetry() {
+ return this.enrollDataSourcesRetry;
+ }
+
+ public void setEnrollDataSourcesRetry(Retry enrollDataSourcesRetry) {
+ this.enrollDataSourcesRetry = enrollDataSourcesRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/package-info.java
new file mode 100644
index 0000000000..51c69a1f9b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/java/com/google/cloud/bigquery/datatransfer/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for bigquerydatatransfer. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.bigquery.datatransfer.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..05cd2e2489
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.bigquery.datatransfer.v1.data-transfer-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud bigquerydatatransfer/DataTransferService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..eefdc07c7e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigquerydatatransfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.bigquery.datatransfer.v1.spring.DataTransferServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/pom.xml
new file mode 100644
index 0000000000..21ba134279
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ReservationServiceSpringProperties. 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 ReservationServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ReservationServiceSettings reservationServiceSettings(
+ @Qualifier("defaultReservationServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ReservationServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ReservationServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ReservationServiceSettings.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 =
+ ReservationServiceSettings.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 createReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createReservationSettings()
+ .setRetrySettings(createReservationRetrySettings);
+
+ RetrySettings listReservationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReservationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listReservationsSettings()
+ .setRetrySettings(listReservationsRetrySettings);
+
+ RetrySettings getReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getReservationSettings().setRetrySettings(getReservationRetrySettings);
+
+ RetrySettings deleteReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteReservationSettings()
+ .setRetrySettings(deleteReservationRetrySettings);
+
+ RetrySettings updateReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateReservationSettings()
+ .setRetrySettings(updateReservationRetrySettings);
+
+ RetrySettings createCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCapacityCommitmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createCapacityCommitmentSettings()
+ .setRetrySettings(createCapacityCommitmentRetrySettings);
+
+ RetrySettings listCapacityCommitmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCapacityCommitmentsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listCapacityCommitmentsSettings()
+ .setRetrySettings(listCapacityCommitmentsRetrySettings);
+
+ RetrySettings getCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCapacityCommitmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getCapacityCommitmentSettings()
+ .setRetrySettings(getCapacityCommitmentRetrySettings);
+
+ RetrySettings deleteCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCapacityCommitmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteCapacityCommitmentSettings()
+ .setRetrySettings(deleteCapacityCommitmentRetrySettings);
+
+ RetrySettings updateCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCapacityCommitmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateCapacityCommitmentSettings()
+ .setRetrySettings(updateCapacityCommitmentRetrySettings);
+
+ RetrySettings splitCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.splitCapacityCommitmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .splitCapacityCommitmentSettings()
+ .setRetrySettings(splitCapacityCommitmentRetrySettings);
+
+ RetrySettings mergeCapacityCommitmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.mergeCapacityCommitmentsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .mergeCapacityCommitmentsSettings()
+ .setRetrySettings(mergeCapacityCommitmentsRetrySettings);
+
+ RetrySettings createAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAssignmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createAssignmentSettings()
+ .setRetrySettings(createAssignmentRetrySettings);
+
+ RetrySettings listAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssignmentsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listAssignmentsSettings()
+ .setRetrySettings(listAssignmentsRetrySettings);
+
+ RetrySettings deleteAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAssignmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteAssignmentSettings()
+ .setRetrySettings(deleteAssignmentRetrySettings);
+
+ RetrySettings searchAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAssignmentsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .searchAssignmentsSettings()
+ .setRetrySettings(searchAssignmentsRetrySettings);
+
+ RetrySettings searchAllAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllAssignmentsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .searchAllAssignmentsSettings()
+ .setRetrySettings(searchAllAssignmentsRetrySettings);
+
+ RetrySettings moveAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.moveAssignmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.moveAssignmentSettings().setRetrySettings(moveAssignmentRetrySettings);
+
+ RetrySettings updateAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAssignmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateAssignmentSettings()
+ .setRetrySettings(updateAssignmentRetrySettings);
+
+ RetrySettings getBiReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBiReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getBiReservationSettings()
+ .setRetrySettings(getBiReservationRetrySettings);
+
+ RetrySettings updateBiReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBiReservationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateBiReservationSettings()
+ .setRetrySettings(updateBiReservationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createReservationRetry = clientProperties.getCreateReservationRetry();
+ if (createReservationRetry != null) {
+ RetrySettings createReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createReservationSettings().getRetrySettings(),
+ createReservationRetry);
+ clientSettingsBuilder
+ .createReservationSettings()
+ .setRetrySettings(createReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createReservation from properties.");
+ }
+ }
+ Retry listReservationsRetry = clientProperties.getListReservationsRetry();
+ if (listReservationsRetry != null) {
+ RetrySettings listReservationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReservationsSettings().getRetrySettings(),
+ listReservationsRetry);
+ clientSettingsBuilder
+ .listReservationsSettings()
+ .setRetrySettings(listReservationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listReservations from properties.");
+ }
+ }
+ Retry getReservationRetry = clientProperties.getGetReservationRetry();
+ if (getReservationRetry != null) {
+ RetrySettings getReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReservationSettings().getRetrySettings(),
+ getReservationRetry);
+ clientSettingsBuilder.getReservationSettings().setRetrySettings(getReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getReservation from properties.");
+ }
+ }
+ Retry deleteReservationRetry = clientProperties.getDeleteReservationRetry();
+ if (deleteReservationRetry != null) {
+ RetrySettings deleteReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteReservationSettings().getRetrySettings(),
+ deleteReservationRetry);
+ clientSettingsBuilder
+ .deleteReservationSettings()
+ .setRetrySettings(deleteReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteReservation from properties.");
+ }
+ }
+ Retry updateReservationRetry = clientProperties.getUpdateReservationRetry();
+ if (updateReservationRetry != null) {
+ RetrySettings updateReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateReservationSettings().getRetrySettings(),
+ updateReservationRetry);
+ clientSettingsBuilder
+ .updateReservationSettings()
+ .setRetrySettings(updateReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateReservation from properties.");
+ }
+ }
+ Retry createCapacityCommitmentRetry = clientProperties.getCreateCapacityCommitmentRetry();
+ if (createCapacityCommitmentRetry != null) {
+ RetrySettings createCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCapacityCommitmentSettings().getRetrySettings(),
+ createCapacityCommitmentRetry);
+ clientSettingsBuilder
+ .createCapacityCommitmentSettings()
+ .setRetrySettings(createCapacityCommitmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createCapacityCommitment from properties.");
+ }
+ }
+ Retry listCapacityCommitmentsRetry = clientProperties.getListCapacityCommitmentsRetry();
+ if (listCapacityCommitmentsRetry != null) {
+ RetrySettings listCapacityCommitmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCapacityCommitmentsSettings().getRetrySettings(),
+ listCapacityCommitmentsRetry);
+ clientSettingsBuilder
+ .listCapacityCommitmentsSettings()
+ .setRetrySettings(listCapacityCommitmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCapacityCommitments from properties.");
+ }
+ }
+ Retry getCapacityCommitmentRetry = clientProperties.getGetCapacityCommitmentRetry();
+ if (getCapacityCommitmentRetry != null) {
+ RetrySettings getCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCapacityCommitmentSettings().getRetrySettings(),
+ getCapacityCommitmentRetry);
+ clientSettingsBuilder
+ .getCapacityCommitmentSettings()
+ .setRetrySettings(getCapacityCommitmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getCapacityCommitment from properties.");
+ }
+ }
+ Retry deleteCapacityCommitmentRetry = clientProperties.getDeleteCapacityCommitmentRetry();
+ if (deleteCapacityCommitmentRetry != null) {
+ RetrySettings deleteCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCapacityCommitmentSettings().getRetrySettings(),
+ deleteCapacityCommitmentRetry);
+ clientSettingsBuilder
+ .deleteCapacityCommitmentSettings()
+ .setRetrySettings(deleteCapacityCommitmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteCapacityCommitment from properties.");
+ }
+ }
+ Retry updateCapacityCommitmentRetry = clientProperties.getUpdateCapacityCommitmentRetry();
+ if (updateCapacityCommitmentRetry != null) {
+ RetrySettings updateCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCapacityCommitmentSettings().getRetrySettings(),
+ updateCapacityCommitmentRetry);
+ clientSettingsBuilder
+ .updateCapacityCommitmentSettings()
+ .setRetrySettings(updateCapacityCommitmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateCapacityCommitment from properties.");
+ }
+ }
+ Retry splitCapacityCommitmentRetry = clientProperties.getSplitCapacityCommitmentRetry();
+ if (splitCapacityCommitmentRetry != null) {
+ RetrySettings splitCapacityCommitmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.splitCapacityCommitmentSettings().getRetrySettings(),
+ splitCapacityCommitmentRetry);
+ clientSettingsBuilder
+ .splitCapacityCommitmentSettings()
+ .setRetrySettings(splitCapacityCommitmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for splitCapacityCommitment from properties.");
+ }
+ }
+ Retry mergeCapacityCommitmentsRetry = clientProperties.getMergeCapacityCommitmentsRetry();
+ if (mergeCapacityCommitmentsRetry != null) {
+ RetrySettings mergeCapacityCommitmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.mergeCapacityCommitmentsSettings().getRetrySettings(),
+ mergeCapacityCommitmentsRetry);
+ clientSettingsBuilder
+ .mergeCapacityCommitmentsSettings()
+ .setRetrySettings(mergeCapacityCommitmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for mergeCapacityCommitments from properties.");
+ }
+ }
+ Retry createAssignmentRetry = clientProperties.getCreateAssignmentRetry();
+ if (createAssignmentRetry != null) {
+ RetrySettings createAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAssignmentSettings().getRetrySettings(),
+ createAssignmentRetry);
+ clientSettingsBuilder
+ .createAssignmentSettings()
+ .setRetrySettings(createAssignmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createAssignment from properties.");
+ }
+ }
+ Retry listAssignmentsRetry = clientProperties.getListAssignmentsRetry();
+ if (listAssignmentsRetry != null) {
+ RetrySettings listAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssignmentsSettings().getRetrySettings(),
+ listAssignmentsRetry);
+ clientSettingsBuilder
+ .listAssignmentsSettings()
+ .setRetrySettings(listAssignmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listAssignments from properties.");
+ }
+ }
+ Retry deleteAssignmentRetry = clientProperties.getDeleteAssignmentRetry();
+ if (deleteAssignmentRetry != null) {
+ RetrySettings deleteAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAssignmentSettings().getRetrySettings(),
+ deleteAssignmentRetry);
+ clientSettingsBuilder
+ .deleteAssignmentSettings()
+ .setRetrySettings(deleteAssignmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteAssignment from properties.");
+ }
+ }
+ Retry searchAssignmentsRetry = clientProperties.getSearchAssignmentsRetry();
+ if (searchAssignmentsRetry != null) {
+ RetrySettings searchAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAssignmentsSettings().getRetrySettings(),
+ searchAssignmentsRetry);
+ clientSettingsBuilder
+ .searchAssignmentsSettings()
+ .setRetrySettings(searchAssignmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for searchAssignments from properties.");
+ }
+ }
+ Retry searchAllAssignmentsRetry = clientProperties.getSearchAllAssignmentsRetry();
+ if (searchAllAssignmentsRetry != null) {
+ RetrySettings searchAllAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchAllAssignmentsSettings().getRetrySettings(),
+ searchAllAssignmentsRetry);
+ clientSettingsBuilder
+ .searchAllAssignmentsSettings()
+ .setRetrySettings(searchAllAssignmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for searchAllAssignments from properties.");
+ }
+ }
+ Retry moveAssignmentRetry = clientProperties.getMoveAssignmentRetry();
+ if (moveAssignmentRetry != null) {
+ RetrySettings moveAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.moveAssignmentSettings().getRetrySettings(),
+ moveAssignmentRetry);
+ clientSettingsBuilder.moveAssignmentSettings().setRetrySettings(moveAssignmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for moveAssignment from properties.");
+ }
+ }
+ Retry updateAssignmentRetry = clientProperties.getUpdateAssignmentRetry();
+ if (updateAssignmentRetry != null) {
+ RetrySettings updateAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAssignmentSettings().getRetrySettings(),
+ updateAssignmentRetry);
+ clientSettingsBuilder
+ .updateAssignmentSettings()
+ .setRetrySettings(updateAssignmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateAssignment from properties.");
+ }
+ }
+ Retry getBiReservationRetry = clientProperties.getGetBiReservationRetry();
+ if (getBiReservationRetry != null) {
+ RetrySettings getBiReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBiReservationSettings().getRetrySettings(),
+ getBiReservationRetry);
+ clientSettingsBuilder
+ .getBiReservationSettings()
+ .setRetrySettings(getBiReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getBiReservation from properties.");
+ }
+ }
+ Retry updateBiReservationRetry = clientProperties.getUpdateBiReservationRetry();
+ if (updateBiReservationRetry != null) {
+ RetrySettings updateBiReservationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBiReservationSettings().getRetrySettings(),
+ updateBiReservationRetry);
+ clientSettingsBuilder
+ .updateBiReservationSettings()
+ .setRetrySettings(updateBiReservationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateBiReservation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ReservationServiceClient bean configured with ReservationServiceSettings.
+ *
+ * @param reservationServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ReservationServiceClient} bean configured with {@link
+ * ReservationServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ReservationServiceClient reservationServiceClient(
+ ReservationServiceSettings reservationServiceSettings) throws IOException {
+ return ReservationServiceClient.create(reservationServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-reservation-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java
new file mode 100644
index 0000000000..a9f6a8d0ac
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/ReservationServiceSpringProperties.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.bigquery.reservation.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 ReservationService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.bigquery.reservation.v1.reservation-service")
+public class ReservationServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createReservation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createReservationRetry;
+ /**
+ * Allow override of retry settings at method-level for listReservations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listReservationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getReservation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getReservationRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteReservation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteReservationRetry;
+ /**
+ * Allow override of retry settings at method-level for updateReservation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateReservationRetry;
+ /**
+ * Allow override of retry settings at method-level for createCapacityCommitment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createCapacityCommitmentRetry;
+ /**
+ * Allow override of retry settings at method-level for listCapacityCommitments. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCapacityCommitmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for getCapacityCommitment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCapacityCommitmentRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteCapacityCommitment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteCapacityCommitmentRetry;
+ /**
+ * Allow override of retry settings at method-level for updateCapacityCommitment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateCapacityCommitmentRetry;
+ /**
+ * Allow override of retry settings at method-level for splitCapacityCommitment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry splitCapacityCommitmentRetry;
+ /**
+ * Allow override of retry settings at method-level for mergeCapacityCommitments. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry mergeCapacityCommitmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for createAssignment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createAssignmentRetry;
+ /**
+ * Allow override of retry settings at method-level for listAssignments. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAssignmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteAssignment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteAssignmentRetry;
+ /**
+ * Allow override of retry settings at method-level for searchAssignments. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchAssignmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for searchAllAssignments. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchAllAssignmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for moveAssignment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry moveAssignmentRetry;
+ /**
+ * Allow override of retry settings at method-level for updateAssignment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateAssignmentRetry;
+ /**
+ * Allow override of retry settings at method-level for getBiReservation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBiReservationRetry;
+ /**
+ * Allow override of retry settings at method-level for updateBiReservation. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateBiReservationRetry;
+
+ @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 getCreateReservationRetry() {
+ return this.createReservationRetry;
+ }
+
+ public void setCreateReservationRetry(Retry createReservationRetry) {
+ this.createReservationRetry = createReservationRetry;
+ }
+
+ public Retry getListReservationsRetry() {
+ return this.listReservationsRetry;
+ }
+
+ public void setListReservationsRetry(Retry listReservationsRetry) {
+ this.listReservationsRetry = listReservationsRetry;
+ }
+
+ public Retry getGetReservationRetry() {
+ return this.getReservationRetry;
+ }
+
+ public void setGetReservationRetry(Retry getReservationRetry) {
+ this.getReservationRetry = getReservationRetry;
+ }
+
+ public Retry getDeleteReservationRetry() {
+ return this.deleteReservationRetry;
+ }
+
+ public void setDeleteReservationRetry(Retry deleteReservationRetry) {
+ this.deleteReservationRetry = deleteReservationRetry;
+ }
+
+ public Retry getUpdateReservationRetry() {
+ return this.updateReservationRetry;
+ }
+
+ public void setUpdateReservationRetry(Retry updateReservationRetry) {
+ this.updateReservationRetry = updateReservationRetry;
+ }
+
+ public Retry getCreateCapacityCommitmentRetry() {
+ return this.createCapacityCommitmentRetry;
+ }
+
+ public void setCreateCapacityCommitmentRetry(Retry createCapacityCommitmentRetry) {
+ this.createCapacityCommitmentRetry = createCapacityCommitmentRetry;
+ }
+
+ public Retry getListCapacityCommitmentsRetry() {
+ return this.listCapacityCommitmentsRetry;
+ }
+
+ public void setListCapacityCommitmentsRetry(Retry listCapacityCommitmentsRetry) {
+ this.listCapacityCommitmentsRetry = listCapacityCommitmentsRetry;
+ }
+
+ public Retry getGetCapacityCommitmentRetry() {
+ return this.getCapacityCommitmentRetry;
+ }
+
+ public void setGetCapacityCommitmentRetry(Retry getCapacityCommitmentRetry) {
+ this.getCapacityCommitmentRetry = getCapacityCommitmentRetry;
+ }
+
+ public Retry getDeleteCapacityCommitmentRetry() {
+ return this.deleteCapacityCommitmentRetry;
+ }
+
+ public void setDeleteCapacityCommitmentRetry(Retry deleteCapacityCommitmentRetry) {
+ this.deleteCapacityCommitmentRetry = deleteCapacityCommitmentRetry;
+ }
+
+ public Retry getUpdateCapacityCommitmentRetry() {
+ return this.updateCapacityCommitmentRetry;
+ }
+
+ public void setUpdateCapacityCommitmentRetry(Retry updateCapacityCommitmentRetry) {
+ this.updateCapacityCommitmentRetry = updateCapacityCommitmentRetry;
+ }
+
+ public Retry getSplitCapacityCommitmentRetry() {
+ return this.splitCapacityCommitmentRetry;
+ }
+
+ public void setSplitCapacityCommitmentRetry(Retry splitCapacityCommitmentRetry) {
+ this.splitCapacityCommitmentRetry = splitCapacityCommitmentRetry;
+ }
+
+ public Retry getMergeCapacityCommitmentsRetry() {
+ return this.mergeCapacityCommitmentsRetry;
+ }
+
+ public void setMergeCapacityCommitmentsRetry(Retry mergeCapacityCommitmentsRetry) {
+ this.mergeCapacityCommitmentsRetry = mergeCapacityCommitmentsRetry;
+ }
+
+ public Retry getCreateAssignmentRetry() {
+ return this.createAssignmentRetry;
+ }
+
+ public void setCreateAssignmentRetry(Retry createAssignmentRetry) {
+ this.createAssignmentRetry = createAssignmentRetry;
+ }
+
+ public Retry getListAssignmentsRetry() {
+ return this.listAssignmentsRetry;
+ }
+
+ public void setListAssignmentsRetry(Retry listAssignmentsRetry) {
+ this.listAssignmentsRetry = listAssignmentsRetry;
+ }
+
+ public Retry getDeleteAssignmentRetry() {
+ return this.deleteAssignmentRetry;
+ }
+
+ public void setDeleteAssignmentRetry(Retry deleteAssignmentRetry) {
+ this.deleteAssignmentRetry = deleteAssignmentRetry;
+ }
+
+ public Retry getSearchAssignmentsRetry() {
+ return this.searchAssignmentsRetry;
+ }
+
+ public void setSearchAssignmentsRetry(Retry searchAssignmentsRetry) {
+ this.searchAssignmentsRetry = searchAssignmentsRetry;
+ }
+
+ public Retry getSearchAllAssignmentsRetry() {
+ return this.searchAllAssignmentsRetry;
+ }
+
+ public void setSearchAllAssignmentsRetry(Retry searchAllAssignmentsRetry) {
+ this.searchAllAssignmentsRetry = searchAllAssignmentsRetry;
+ }
+
+ public Retry getMoveAssignmentRetry() {
+ return this.moveAssignmentRetry;
+ }
+
+ public void setMoveAssignmentRetry(Retry moveAssignmentRetry) {
+ this.moveAssignmentRetry = moveAssignmentRetry;
+ }
+
+ public Retry getUpdateAssignmentRetry() {
+ return this.updateAssignmentRetry;
+ }
+
+ public void setUpdateAssignmentRetry(Retry updateAssignmentRetry) {
+ this.updateAssignmentRetry = updateAssignmentRetry;
+ }
+
+ public Retry getGetBiReservationRetry() {
+ return this.getBiReservationRetry;
+ }
+
+ public void setGetBiReservationRetry(Retry getBiReservationRetry) {
+ this.getBiReservationRetry = getBiReservationRetry;
+ }
+
+ public Retry getUpdateBiReservationRetry() {
+ return this.updateBiReservationRetry;
+ }
+
+ public void setUpdateBiReservationRetry(Retry updateBiReservationRetry) {
+ this.updateBiReservationRetry = updateBiReservationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/package-info.java
new file mode 100644
index 0000000000..9f6b121225
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/java/com/google/cloud/bigquery/reservation/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for bigqueryreservation. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.bigquery.reservation.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..8f524c0f96
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.bigquery.reservation.v1.reservation-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud bigqueryreservation/ReservationService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a906b94b61
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-bigqueryreservation-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.bigquery.reservation.v1.spring.ReservationServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-billing-spring-starter/pom.xml
new file mode 100644
index 0000000000..71bf7f3ce1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billing-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CloudBillingSpringProperties. 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 CloudBillingSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public CloudBillingSettings cloudBillingSettings( + @Qualifier("defaultCloudBillingTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CloudBillingSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CloudBillingSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CloudBillingSettings.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 = + CloudBillingSettings.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 getBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBillingAccountSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getBillingAccountSettings() + .setRetrySettings(getBillingAccountRetrySettings); + + RetrySettings listBillingAccountsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBillingAccountsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listBillingAccountsSettings() + .setRetrySettings(listBillingAccountsRetrySettings); + + RetrySettings updateBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateBillingAccountSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateBillingAccountSettings() + .setRetrySettings(updateBillingAccountRetrySettings); + + RetrySettings createBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBillingAccountSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createBillingAccountSettings() + .setRetrySettings(createBillingAccountRetrySettings); + + RetrySettings listProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProjectBillingInfoSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listProjectBillingInfoSettings() + .setRetrySettings(listProjectBillingInfoRetrySettings); + + RetrySettings getProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProjectBillingInfoSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getProjectBillingInfoSettings() + .setRetrySettings(getProjectBillingInfoRetrySettings); + + RetrySettings updateProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProjectBillingInfoSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateProjectBillingInfoSettings() + .setRetrySettings(updateProjectBillingInfoRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getBillingAccountRetry = clientProperties.getGetBillingAccountRetry(); + if (getBillingAccountRetry != null) { + RetrySettings getBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBillingAccountSettings().getRetrySettings(), + getBillingAccountRetry); + clientSettingsBuilder + .getBillingAccountSettings() + .setRetrySettings(getBillingAccountRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getBillingAccount from properties."); + } + } + Retry listBillingAccountsRetry = clientProperties.getListBillingAccountsRetry(); + if (listBillingAccountsRetry != null) { + RetrySettings listBillingAccountsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBillingAccountsSettings().getRetrySettings(), + listBillingAccountsRetry); + clientSettingsBuilder + .listBillingAccountsSettings() + .setRetrySettings(listBillingAccountsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listBillingAccounts from properties."); + } + } + Retry updateBillingAccountRetry = clientProperties.getUpdateBillingAccountRetry(); + if (updateBillingAccountRetry != null) { + RetrySettings updateBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateBillingAccountSettings().getRetrySettings(), + updateBillingAccountRetry); + clientSettingsBuilder + .updateBillingAccountSettings() + .setRetrySettings(updateBillingAccountRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateBillingAccount from properties."); + } + } + Retry createBillingAccountRetry = clientProperties.getCreateBillingAccountRetry(); + if (createBillingAccountRetry != null) { + RetrySettings createBillingAccountRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createBillingAccountSettings().getRetrySettings(), + createBillingAccountRetry); + clientSettingsBuilder + .createBillingAccountSettings() + .setRetrySettings(createBillingAccountRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createBillingAccount from properties."); + } + } + Retry listProjectBillingInfoRetry = clientProperties.getListProjectBillingInfoRetry(); + if (listProjectBillingInfoRetry != null) { + RetrySettings listProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProjectBillingInfoSettings().getRetrySettings(), + listProjectBillingInfoRetry); + clientSettingsBuilder + .listProjectBillingInfoSettings() + .setRetrySettings(listProjectBillingInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listProjectBillingInfo from properties."); + } + } + Retry getProjectBillingInfoRetry = clientProperties.getGetProjectBillingInfoRetry(); + if (getProjectBillingInfoRetry != null) { + RetrySettings getProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProjectBillingInfoSettings().getRetrySettings(), + getProjectBillingInfoRetry); + clientSettingsBuilder + .getProjectBillingInfoSettings() + .setRetrySettings(getProjectBillingInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getProjectBillingInfo from properties."); + } + } + Retry updateProjectBillingInfoRetry = clientProperties.getUpdateProjectBillingInfoRetry(); + if (updateProjectBillingInfoRetry != null) { + RetrySettings updateProjectBillingInfoRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProjectBillingInfoSettings().getRetrySettings(), + updateProjectBillingInfoRetry); + clientSettingsBuilder + .updateProjectBillingInfoSettings() + .setRetrySettings(updateProjectBillingInfoRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateProjectBillingInfo from properties."); + } + } + Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry(); + if (getIamPolicyRetry != null) { + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); + } + } + Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); + if (setIamPolicyRetry != null) { + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties."); + } + } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CloudBillingClient bean configured with CloudBillingSettings. + * + * @param cloudBillingSettings settings to configure an instance of client bean. + * @return a {@link CloudBillingClient} bean configured with {@link CloudBillingSettings} + */ + @Bean + @ConditionalOnMissingBean + public CloudBillingClient cloudBillingClient(CloudBillingSettings cloudBillingSettings) + throws IOException { + return CloudBillingClient.create(cloudBillingSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cloud-billing"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} 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 new file mode 100644 index 0000000000..57bca339b5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudBillingSpringProperties.java @@ -0,0 +1,215 @@ +/* + * Copyright 2022 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.billing.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 CloudBilling client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.billing.v1.cloud-billing") +public class CloudBillingSpringProperties 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-billing", + "https://www.googleapis.com/auth/cloud-billing.readonly", + "https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getBillingAccount. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getBillingAccountRetry; + /** + * Allow override of retry settings at method-level for listBillingAccounts. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBillingAccountsRetry; + /** + * Allow override of retry settings at method-level for updateBillingAccount. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateBillingAccountRetry; + /** + * Allow override of retry settings at method-level for createBillingAccount. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createBillingAccountRetry; + /** + * Allow override of retry settings at method-level for listProjectBillingInfo. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listProjectBillingInfoRetry; + /** + * Allow override of retry settings at method-level for getProjectBillingInfo. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getProjectBillingInfoRetry; + /** + * Allow override of retry settings at method-level for updateProjectBillingInfo. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateProjectBillingInfoRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetBillingAccountRetry() { + return this.getBillingAccountRetry; + } + + public void setGetBillingAccountRetry(Retry getBillingAccountRetry) { + this.getBillingAccountRetry = getBillingAccountRetry; + } + + public Retry getListBillingAccountsRetry() { + return this.listBillingAccountsRetry; + } + + public void setListBillingAccountsRetry(Retry listBillingAccountsRetry) { + this.listBillingAccountsRetry = listBillingAccountsRetry; + } + + public Retry getUpdateBillingAccountRetry() { + return this.updateBillingAccountRetry; + } + + public void setUpdateBillingAccountRetry(Retry updateBillingAccountRetry) { + this.updateBillingAccountRetry = updateBillingAccountRetry; + } + + public Retry getCreateBillingAccountRetry() { + return this.createBillingAccountRetry; + } + + public void setCreateBillingAccountRetry(Retry createBillingAccountRetry) { + this.createBillingAccountRetry = createBillingAccountRetry; + } + + public Retry getListProjectBillingInfoRetry() { + return this.listProjectBillingInfoRetry; + } + + public void setListProjectBillingInfoRetry(Retry listProjectBillingInfoRetry) { + this.listProjectBillingInfoRetry = listProjectBillingInfoRetry; + } + + public Retry getGetProjectBillingInfoRetry() { + return this.getProjectBillingInfoRetry; + } + + public void setGetProjectBillingInfoRetry(Retry getProjectBillingInfoRetry) { + this.getProjectBillingInfoRetry = getProjectBillingInfoRetry; + } + + public Retry getUpdateProjectBillingInfoRetry() { + return this.updateProjectBillingInfoRetry; + } + + public void setUpdateProjectBillingInfoRetry(Retry updateProjectBillingInfoRetry) { + this.updateProjectBillingInfoRetry = updateProjectBillingInfoRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java new file mode 100644 index 0000000000..53e1ceab05 --- /dev/null +++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringAutoConfiguration.java @@ -0,0 +1,216 @@ +/* + * Copyright 2022 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.billing.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.billing.v1.CloudCatalogClient; +import com.google.cloud.billing.v1.CloudCatalogSettings; +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 CloudCatalogClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudCatalogSpringProperties. 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 CloudCatalogSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudCatalogSettings cloudCatalogSettings(
+ @Qualifier("defaultCloudCatalogTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudCatalogSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudCatalogSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudCatalogSettings.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 =
+ CloudCatalogSettings.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 listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+
+ RetrySettings listSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSkusSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSkusSettings().setRetrySettings(listSkusRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listServicesRetry = clientProperties.getListServicesRetry();
+ if (listServicesRetry != null) {
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listServices from properties.");
+ }
+ }
+ Retry listSkusRetry = clientProperties.getListSkusRetry();
+ if (listSkusRetry != null) {
+ RetrySettings listSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSkusSettings().getRetrySettings(), listSkusRetry);
+ clientSettingsBuilder.listSkusSettings().setRetrySettings(listSkusRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSkus from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudCatalogClient bean configured with CloudCatalogSettings.
+ *
+ * @param cloudCatalogSettings settings to configure an instance of client bean.
+ * @return a {@link CloudCatalogClient} bean configured with {@link CloudCatalogSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudCatalogClient cloudCatalogClient(CloudCatalogSettings cloudCatalogSettings)
+ throws IOException {
+ return CloudCatalogClient.create(cloudCatalogSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-catalog";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringProperties.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringProperties.java
new file mode 100644
index 0000000000..bf7f6e47b5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/CloudCatalogSpringProperties.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2022 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.billing.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 CloudCatalog client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.billing.v1.cloud-catalog")
+public class CloudCatalogSpringProperties 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-billing",
+ "https://www.googleapis.com/auth/cloud-billing.readonly",
+ "https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for listSkus. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSkusRetry;
+
+ @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 getListServicesRetry() {
+ return this.listServicesRetry;
+ }
+
+ public void setListServicesRetry(Retry listServicesRetry) {
+ this.listServicesRetry = listServicesRetry;
+ }
+
+ public Retry getListSkusRetry() {
+ return this.listSkusRetry;
+ }
+
+ public void setListSkusRetry(Retry listSkusRetry) {
+ this.listSkusRetry = listSkusRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/package-info.java
new file mode 100644
index 0000000000..41a1551268
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/java/com/google/cloud/billing/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudbilling. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.billing.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..71297d4370
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.billing.v1.cloud-billing.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudbilling/CloudBilling components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.billing.v1.cloud-catalog.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudbilling/CloudCatalog components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..9b58827357
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billing-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.billing.v1.spring.CloudBillingSpringAutoConfiguration
+com.google.cloud.billing.v1.spring.CloudCatalogSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/pom.xml
new file mode 100644
index 0000000000..8a2ab36623
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in BudgetServiceSpringProperties. 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 BudgetServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public BudgetServiceSettings budgetServiceSettings(
+ @Qualifier("defaultBudgetServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ BudgetServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = BudgetServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = BudgetServiceSettings.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 =
+ BudgetServiceSettings.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 createBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBudgetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createBudgetSettings().setRetrySettings(createBudgetRetrySettings);
+
+ RetrySettings updateBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBudgetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateBudgetSettings().setRetrySettings(updateBudgetRetrySettings);
+
+ RetrySettings getBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBudgetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getBudgetSettings().setRetrySettings(getBudgetRetrySettings);
+
+ RetrySettings listBudgetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBudgetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listBudgetsSettings().setRetrySettings(listBudgetsRetrySettings);
+
+ RetrySettings deleteBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBudgetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteBudgetSettings().setRetrySettings(deleteBudgetRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createBudgetRetry = clientProperties.getCreateBudgetRetry();
+ if (createBudgetRetry != null) {
+ RetrySettings createBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBudgetSettings().getRetrySettings(), createBudgetRetry);
+ clientSettingsBuilder.createBudgetSettings().setRetrySettings(createBudgetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createBudget from properties.");
+ }
+ }
+ Retry updateBudgetRetry = clientProperties.getUpdateBudgetRetry();
+ if (updateBudgetRetry != null) {
+ RetrySettings updateBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBudgetSettings().getRetrySettings(), updateBudgetRetry);
+ clientSettingsBuilder.updateBudgetSettings().setRetrySettings(updateBudgetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateBudget from properties.");
+ }
+ }
+ Retry getBudgetRetry = clientProperties.getGetBudgetRetry();
+ if (getBudgetRetry != null) {
+ RetrySettings getBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBudgetSettings().getRetrySettings(), getBudgetRetry);
+ clientSettingsBuilder.getBudgetSettings().setRetrySettings(getBudgetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBudget from properties.");
+ }
+ }
+ Retry listBudgetsRetry = clientProperties.getListBudgetsRetry();
+ if (listBudgetsRetry != null) {
+ RetrySettings listBudgetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBudgetsSettings().getRetrySettings(), listBudgetsRetry);
+ clientSettingsBuilder.listBudgetsSettings().setRetrySettings(listBudgetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listBudgets from properties.");
+ }
+ }
+ Retry deleteBudgetRetry = clientProperties.getDeleteBudgetRetry();
+ if (deleteBudgetRetry != null) {
+ RetrySettings deleteBudgetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBudgetSettings().getRetrySettings(), deleteBudgetRetry);
+ clientSettingsBuilder.deleteBudgetSettings().setRetrySettings(deleteBudgetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteBudget from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a BudgetServiceClient bean configured with BudgetServiceSettings.
+ *
+ * @param budgetServiceSettings settings to configure an instance of client bean.
+ * @return a {@link BudgetServiceClient} bean configured with {@link BudgetServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public BudgetServiceClient budgetServiceClient(BudgetServiceSettings budgetServiceSettings)
+ throws IOException {
+ return BudgetServiceClient.create(budgetServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-budget-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringProperties.java b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringProperties.java
new file mode 100644
index 0000000000..b1da8e8e49
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/BudgetServiceSpringProperties.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2022 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.billing.budgets.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 BudgetService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.billing.budgets.v1.budget-service")
+public class BudgetServiceSpringProperties 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-billing",
+ "https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createBudget. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createBudgetRetry;
+ /**
+ * Allow override of retry settings at method-level for updateBudget. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateBudgetRetry;
+ /**
+ * Allow override of retry settings at method-level for getBudget. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBudgetRetry;
+ /**
+ * Allow override of retry settings at method-level for listBudgets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBudgetsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteBudget. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteBudgetRetry;
+
+ @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 getCreateBudgetRetry() {
+ return this.createBudgetRetry;
+ }
+
+ public void setCreateBudgetRetry(Retry createBudgetRetry) {
+ this.createBudgetRetry = createBudgetRetry;
+ }
+
+ public Retry getUpdateBudgetRetry() {
+ return this.updateBudgetRetry;
+ }
+
+ public void setUpdateBudgetRetry(Retry updateBudgetRetry) {
+ this.updateBudgetRetry = updateBudgetRetry;
+ }
+
+ public Retry getGetBudgetRetry() {
+ return this.getBudgetRetry;
+ }
+
+ public void setGetBudgetRetry(Retry getBudgetRetry) {
+ this.getBudgetRetry = getBudgetRetry;
+ }
+
+ public Retry getListBudgetsRetry() {
+ return this.listBudgetsRetry;
+ }
+
+ public void setListBudgetsRetry(Retry listBudgetsRetry) {
+ this.listBudgetsRetry = listBudgetsRetry;
+ }
+
+ public Retry getDeleteBudgetRetry() {
+ return this.deleteBudgetRetry;
+ }
+
+ public void setDeleteBudgetRetry(Retry deleteBudgetRetry) {
+ this.deleteBudgetRetry = deleteBudgetRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/package-info.java
new file mode 100644
index 0000000000..9811dd52f3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/java/com/google/cloud/billing/budgets/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for billingbudgets. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.billing.budgets.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..c00b93b22f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.billing.budgets.v1.budget-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud billingbudgets/BudgetService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..c646ce7042
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-billingbudgets-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.billing.budgets.v1.spring.BudgetServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/pom.xml
new file mode 100644
index 0000000000..e257c4733a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in BinauthzManagementServiceV1SpringProperties. 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 BinauthzManagementServiceV1Settings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings( + @Qualifier("defaultBinauthzManagementServiceV1TransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + BinauthzManagementServiceV1Settings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = BinauthzManagementServiceV1Settings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = BinauthzManagementServiceV1Settings.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 = + BinauthzManagementServiceV1Settings.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 getPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPolicySettings().setRetrySettings(getPolicyRetrySettings); + + RetrySettings updatePolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updatePolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updatePolicySettings().setRetrySettings(updatePolicyRetrySettings); + + RetrySettings createAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAttestorSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createAttestorSettings().setRetrySettings(createAttestorRetrySettings); + + RetrySettings getAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAttestorSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getAttestorSettings().setRetrySettings(getAttestorRetrySettings); + + RetrySettings updateAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAttestorSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateAttestorSettings().setRetrySettings(updateAttestorRetrySettings); + + RetrySettings listAttestorsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAttestorsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listAttestorsSettings().setRetrySettings(listAttestorsRetrySettings); + + RetrySettings deleteAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAttestorSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteAttestorSettings().setRetrySettings(deleteAttestorRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getPolicyRetry = clientProperties.getGetPolicyRetry(); + if (getPolicyRetry != null) { + RetrySettings getPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPolicySettings().getRetrySettings(), getPolicyRetry); + clientSettingsBuilder.getPolicySettings().setRetrySettings(getPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPolicy from properties."); + } + } + Retry updatePolicyRetry = clientProperties.getUpdatePolicyRetry(); + if (updatePolicyRetry != null) { + RetrySettings updatePolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updatePolicySettings().getRetrySettings(), updatePolicyRetry); + clientSettingsBuilder.updatePolicySettings().setRetrySettings(updatePolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updatePolicy from properties."); + } + } + Retry createAttestorRetry = clientProperties.getCreateAttestorRetry(); + if (createAttestorRetry != null) { + RetrySettings createAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAttestorSettings().getRetrySettings(), + createAttestorRetry); + clientSettingsBuilder.createAttestorSettings().setRetrySettings(createAttestorRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createAttestor from properties."); + } + } + Retry getAttestorRetry = clientProperties.getGetAttestorRetry(); + if (getAttestorRetry != null) { + RetrySettings getAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAttestorSettings().getRetrySettings(), getAttestorRetry); + clientSettingsBuilder.getAttestorSettings().setRetrySettings(getAttestorRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getAttestor from properties."); + } + } + Retry updateAttestorRetry = clientProperties.getUpdateAttestorRetry(); + if (updateAttestorRetry != null) { + RetrySettings updateAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAttestorSettings().getRetrySettings(), + updateAttestorRetry); + clientSettingsBuilder.updateAttestorSettings().setRetrySettings(updateAttestorRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateAttestor from properties."); + } + } + Retry listAttestorsRetry = clientProperties.getListAttestorsRetry(); + if (listAttestorsRetry != null) { + RetrySettings listAttestorsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAttestorsSettings().getRetrySettings(), listAttestorsRetry); + clientSettingsBuilder.listAttestorsSettings().setRetrySettings(listAttestorsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listAttestors from properties."); + } + } + Retry deleteAttestorRetry = clientProperties.getDeleteAttestorRetry(); + if (deleteAttestorRetry != null) { + RetrySettings deleteAttestorRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAttestorSettings().getRetrySettings(), + deleteAttestorRetry); + clientSettingsBuilder.deleteAttestorSettings().setRetrySettings(deleteAttestorRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteAttestor from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a BinauthzManagementServiceV1Client bean configured with + * BinauthzManagementServiceV1Settings. + * + * @param binauthzManagementServiceV1Settings settings to configure an instance of client bean. + * @return a {@link BinauthzManagementServiceV1Client} bean configured with {@link + * BinauthzManagementServiceV1Settings} + */ + @Bean + @ConditionalOnMissingBean + public BinauthzManagementServiceV1Client binauthzManagementServiceV1Client( + BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings) throws IOException { + return BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-binauthz-management-service-v1"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringProperties.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringProperties.java new file mode 100644 index 0000000000..b661d70ccb --- /dev/null +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/BinauthzManagementServiceV1SpringProperties.java @@ -0,0 +1,174 @@ +/* + * Copyright 2022 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.protos.google.cloud.binaryauthorization.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 BinauthzManagementServiceV1 client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties( + "com.google.protos.google.cloud.binaryauthorization.v1.binauthz-management-service-v1") +public class BinauthzManagementServiceV1SpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPolicyRetry; + /** + * Allow override of retry settings at method-level for updatePolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updatePolicyRetry; + /** + * Allow override of retry settings at method-level for createAttestor. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createAttestorRetry; + /** + * Allow override of retry settings at method-level for getAttestor. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAttestorRetry; + /** + * Allow override of retry settings at method-level for updateAttestor. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateAttestorRetry; + /** + * Allow override of retry settings at method-level for listAttestors. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAttestorsRetry; + /** + * Allow override of retry settings at method-level for deleteAttestor. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteAttestorRetry; + + @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 getGetPolicyRetry() { + return this.getPolicyRetry; + } + + public void setGetPolicyRetry(Retry getPolicyRetry) { + this.getPolicyRetry = getPolicyRetry; + } + + public Retry getUpdatePolicyRetry() { + return this.updatePolicyRetry; + } + + public void setUpdatePolicyRetry(Retry updatePolicyRetry) { + this.updatePolicyRetry = updatePolicyRetry; + } + + public Retry getCreateAttestorRetry() { + return this.createAttestorRetry; + } + + public void setCreateAttestorRetry(Retry createAttestorRetry) { + this.createAttestorRetry = createAttestorRetry; + } + + public Retry getGetAttestorRetry() { + return this.getAttestorRetry; + } + + public void setGetAttestorRetry(Retry getAttestorRetry) { + this.getAttestorRetry = getAttestorRetry; + } + + public Retry getUpdateAttestorRetry() { + return this.updateAttestorRetry; + } + + public void setUpdateAttestorRetry(Retry updateAttestorRetry) { + this.updateAttestorRetry = updateAttestorRetry; + } + + public Retry getListAttestorsRetry() { + return this.listAttestorsRetry; + } + + public void setListAttestorsRetry(Retry listAttestorsRetry) { + this.listAttestorsRetry = listAttestorsRetry; + } + + public Retry getDeleteAttestorRetry() { + return this.deleteAttestorRetry; + } + + public void setDeleteAttestorRetry(Retry deleteAttestorRetry) { + this.deleteAttestorRetry = deleteAttestorRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java new file mode 100644 index 0000000000..e6c5490d9f --- /dev/null +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringAutoConfiguration.java @@ -0,0 +1,206 @@ +/* + * Copyright 2022 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.protos.google.cloud.binaryauthorization.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Settings; +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 SystemPolicyV1Client}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in SystemPolicyV1SpringProperties. 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 SystemPolicyV1Settings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public SystemPolicyV1Settings systemPolicyV1Settings( + @Qualifier("defaultSystemPolicyV1TransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SystemPolicyV1Settings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SystemPolicyV1Settings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SystemPolicyV1Settings.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 = + SystemPolicyV1Settings.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 getSystemPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSystemPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getSystemPolicySettings() + .setRetrySettings(getSystemPolicyRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getSystemPolicyRetry = clientProperties.getGetSystemPolicyRetry(); + if (getSystemPolicyRetry != null) { + RetrySettings getSystemPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSystemPolicySettings().getRetrySettings(), + getSystemPolicyRetry); + clientSettingsBuilder + .getSystemPolicySettings() + .setRetrySettings(getSystemPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSystemPolicy from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SystemPolicyV1Client bean configured with SystemPolicyV1Settings. + * + * @param systemPolicyV1Settings settings to configure an instance of client bean. + * @return a {@link SystemPolicyV1Client} bean configured with {@link SystemPolicyV1Settings} + */ + @Bean + @ConditionalOnMissingBean + public SystemPolicyV1Client systemPolicyV1Client(SystemPolicyV1Settings systemPolicyV1Settings) + throws IOException { + return SystemPolicyV1Client.create(systemPolicyV1Settings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-system-policy-v1"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringProperties.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringProperties.java new file mode 100644 index 0000000000..0b5973eb92 --- /dev/null +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/SystemPolicyV1SpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.protos.google.cloud.binaryauthorization.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 SystemPolicyV1 client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.protos.google.cloud.binaryauthorization.v1.system-policy-v1") +public class SystemPolicyV1SpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getSystemPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSystemPolicyRetry; + + @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 getGetSystemPolicyRetry() { + return this.getSystemPolicyRetry; + } + + public void setGetSystemPolicyRetry(Retry getSystemPolicyRetry) { + this.getSystemPolicyRetry = getSystemPolicyRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java new file mode 100644 index 0000000000..b5579f34af --- /dev/null +++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringAutoConfiguration.java @@ -0,0 +1,211 @@ +/* + * Copyright 2022 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.protos.google.cloud.binaryauthorization.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Settings; +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 ValidationHelperV1Client}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ValidationHelperV1SpringProperties. 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 ValidationHelperV1Settings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ValidationHelperV1Settings validationHelperV1Settings(
+ @Qualifier("defaultValidationHelperV1TransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ValidationHelperV1Settings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ValidationHelperV1Settings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ValidationHelperV1Settings.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 =
+ ValidationHelperV1Settings.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 validateAttestationOccurrenceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.validateAttestationOccurrenceSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .validateAttestationOccurrenceSettings()
+ .setRetrySettings(validateAttestationOccurrenceRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry validateAttestationOccurrenceRetry =
+ clientProperties.getValidateAttestationOccurrenceRetry();
+ if (validateAttestationOccurrenceRetry != null) {
+ RetrySettings validateAttestationOccurrenceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.validateAttestationOccurrenceSettings().getRetrySettings(),
+ validateAttestationOccurrenceRetry);
+ clientSettingsBuilder
+ .validateAttestationOccurrenceSettings()
+ .setRetrySettings(validateAttestationOccurrenceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for validateAttestationOccurrence from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ValidationHelperV1Client bean configured with ValidationHelperV1Settings.
+ *
+ * @param validationHelperV1Settings settings to configure an instance of client bean.
+ * @return a {@link ValidationHelperV1Client} bean configured with {@link
+ * ValidationHelperV1Settings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ValidationHelperV1Client validationHelperV1Client(
+ ValidationHelperV1Settings validationHelperV1Settings) throws IOException {
+ return ValidationHelperV1Client.create(validationHelperV1Settings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-validation-helper-v1";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringProperties.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringProperties.java
new file mode 100644
index 0000000000..1e7761108b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/ValidationHelperV1SpringProperties.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2022 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.protos.google.cloud.binaryauthorization.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 ValidationHelperV1 client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties(
+ "com.google.protos.google.cloud.binaryauthorization.v1.validation-helper-v1")
+public class ValidationHelperV1SpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for validateAttestationOccurrence. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry validateAttestationOccurrenceRetry;
+
+ @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 getValidateAttestationOccurrenceRetry() {
+ return this.validateAttestationOccurrenceRetry;
+ }
+
+ public void setValidateAttestationOccurrenceRetry(Retry validateAttestationOccurrenceRetry) {
+ this.validateAttestationOccurrenceRetry = validateAttestationOccurrenceRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/package-info.java
new file mode 100644
index 0000000000..575333b9bd
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for binaryauthorization. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.protos.google.cloud.binaryauthorization.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..412e7008fc
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,22 @@
+{
+ "properties": [
+ {
+ "name": "com.google.protos.google.cloud.binaryauthorization.v1.binauthz-management-service-v1.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud binaryauthorization/BinauthzManagementServiceV1 components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.protos.google.cloud.binaryauthorization.v1.system-policy-v1.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud binaryauthorization/SystemPolicyV1 components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.protos.google.cloud.binaryauthorization.v1.validation-helper-v1.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud binaryauthorization/ValidationHelperV1 components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..ac1c216ad7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-binary-authorization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,3 @@
+com.google.protos.google.cloud.binaryauthorization.v1.spring.BinauthzManagementServiceV1SpringAutoConfiguration
+com.google.protos.google.cloud.binaryauthorization.v1.spring.SystemPolicyV1SpringAutoConfiguration
+com.google.protos.google.cloud.binaryauthorization.v1.spring.ValidationHelperV1SpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-build-spring-starter/pom.xml
new file mode 100644
index 0000000000..f4e1821232
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-build-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudBuildSpringProperties. 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 CloudBuildSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudBuildSettings cloudBuildSettings(
+ @Qualifier("defaultCloudBuildTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudBuildSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudBuildSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudBuildSettings.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 =
+ CloudBuildSettings.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 getBuildRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBuildSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getBuildSettings().setRetrySettings(getBuildRetrySettings);
+
+ RetrySettings listBuildsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBuildsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listBuildsSettings().setRetrySettings(listBuildsRetrySettings);
+
+ RetrySettings cancelBuildRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelBuildSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.cancelBuildSettings().setRetrySettings(cancelBuildRetrySettings);
+
+ RetrySettings createBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBuildTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createBuildTriggerSettings()
+ .setRetrySettings(createBuildTriggerRetrySettings);
+
+ RetrySettings getBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBuildTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getBuildTriggerSettings()
+ .setRetrySettings(getBuildTriggerRetrySettings);
+
+ RetrySettings listBuildTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBuildTriggersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listBuildTriggersSettings()
+ .setRetrySettings(listBuildTriggersRetrySettings);
+
+ RetrySettings deleteBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBuildTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteBuildTriggerSettings()
+ .setRetrySettings(deleteBuildTriggerRetrySettings);
+
+ RetrySettings updateBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBuildTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateBuildTriggerSettings()
+ .setRetrySettings(updateBuildTriggerRetrySettings);
+
+ RetrySettings receiveTriggerWebhookRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.receiveTriggerWebhookSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .receiveTriggerWebhookSettings()
+ .setRetrySettings(receiveTriggerWebhookRetrySettings);
+
+ RetrySettings getWorkerPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkerPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getWorkerPoolSettings().setRetrySettings(getWorkerPoolRetrySettings);
+
+ RetrySettings listWorkerPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkerPoolsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listWorkerPoolsSettings()
+ .setRetrySettings(listWorkerPoolsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getBuildRetry = clientProperties.getGetBuildRetry();
+ if (getBuildRetry != null) {
+ RetrySettings getBuildRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBuildSettings().getRetrySettings(), getBuildRetry);
+ clientSettingsBuilder.getBuildSettings().setRetrySettings(getBuildRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBuild from properties.");
+ }
+ }
+ Retry listBuildsRetry = clientProperties.getListBuildsRetry();
+ if (listBuildsRetry != null) {
+ RetrySettings listBuildsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBuildsSettings().getRetrySettings(), listBuildsRetry);
+ clientSettingsBuilder.listBuildsSettings().setRetrySettings(listBuildsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listBuilds from properties.");
+ }
+ }
+ Retry cancelBuildRetry = clientProperties.getCancelBuildRetry();
+ if (cancelBuildRetry != null) {
+ RetrySettings cancelBuildRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelBuildSettings().getRetrySettings(), cancelBuildRetry);
+ clientSettingsBuilder.cancelBuildSettings().setRetrySettings(cancelBuildRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for cancelBuild from properties.");
+ }
+ }
+ Retry createBuildTriggerRetry = clientProperties.getCreateBuildTriggerRetry();
+ if (createBuildTriggerRetry != null) {
+ RetrySettings createBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBuildTriggerSettings().getRetrySettings(),
+ createBuildTriggerRetry);
+ clientSettingsBuilder
+ .createBuildTriggerSettings()
+ .setRetrySettings(createBuildTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createBuildTrigger from properties.");
+ }
+ }
+ Retry getBuildTriggerRetry = clientProperties.getGetBuildTriggerRetry();
+ if (getBuildTriggerRetry != null) {
+ RetrySettings getBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBuildTriggerSettings().getRetrySettings(),
+ getBuildTriggerRetry);
+ clientSettingsBuilder
+ .getBuildTriggerSettings()
+ .setRetrySettings(getBuildTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBuildTrigger from properties.");
+ }
+ }
+ Retry listBuildTriggersRetry = clientProperties.getListBuildTriggersRetry();
+ if (listBuildTriggersRetry != null) {
+ RetrySettings listBuildTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBuildTriggersSettings().getRetrySettings(),
+ listBuildTriggersRetry);
+ clientSettingsBuilder
+ .listBuildTriggersSettings()
+ .setRetrySettings(listBuildTriggersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listBuildTriggers from properties.");
+ }
+ }
+ Retry deleteBuildTriggerRetry = clientProperties.getDeleteBuildTriggerRetry();
+ if (deleteBuildTriggerRetry != null) {
+ RetrySettings deleteBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBuildTriggerSettings().getRetrySettings(),
+ deleteBuildTriggerRetry);
+ clientSettingsBuilder
+ .deleteBuildTriggerSettings()
+ .setRetrySettings(deleteBuildTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteBuildTrigger from properties.");
+ }
+ }
+ Retry updateBuildTriggerRetry = clientProperties.getUpdateBuildTriggerRetry();
+ if (updateBuildTriggerRetry != null) {
+ RetrySettings updateBuildTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBuildTriggerSettings().getRetrySettings(),
+ updateBuildTriggerRetry);
+ clientSettingsBuilder
+ .updateBuildTriggerSettings()
+ .setRetrySettings(updateBuildTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateBuildTrigger from properties.");
+ }
+ }
+ Retry receiveTriggerWebhookRetry = clientProperties.getReceiveTriggerWebhookRetry();
+ if (receiveTriggerWebhookRetry != null) {
+ RetrySettings receiveTriggerWebhookRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.receiveTriggerWebhookSettings().getRetrySettings(),
+ receiveTriggerWebhookRetry);
+ clientSettingsBuilder
+ .receiveTriggerWebhookSettings()
+ .setRetrySettings(receiveTriggerWebhookRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for receiveTriggerWebhook from properties.");
+ }
+ }
+ Retry getWorkerPoolRetry = clientProperties.getGetWorkerPoolRetry();
+ if (getWorkerPoolRetry != null) {
+ RetrySettings getWorkerPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkerPoolSettings().getRetrySettings(), getWorkerPoolRetry);
+ clientSettingsBuilder.getWorkerPoolSettings().setRetrySettings(getWorkerPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getWorkerPool from properties.");
+ }
+ }
+ Retry listWorkerPoolsRetry = clientProperties.getListWorkerPoolsRetry();
+ if (listWorkerPoolsRetry != null) {
+ RetrySettings listWorkerPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkerPoolsSettings().getRetrySettings(),
+ listWorkerPoolsRetry);
+ clientSettingsBuilder
+ .listWorkerPoolsSettings()
+ .setRetrySettings(listWorkerPoolsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listWorkerPools from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudBuildClient bean configured with CloudBuildSettings.
+ *
+ * @param cloudBuildSettings settings to configure an instance of client bean.
+ * @return a {@link CloudBuildClient} bean configured with {@link CloudBuildSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudBuildClient cloudBuildClient(CloudBuildSettings cloudBuildSettings)
+ throws IOException {
+ return CloudBuildClient.create(cloudBuildSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-build";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/CloudBuildSpringProperties.java b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/CloudBuildSpringProperties.java
new file mode 100644
index 0000000000..1fc658f26c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/CloudBuildSpringProperties.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2022 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.devtools.cloudbuild.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 CloudBuild client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.devtools.cloudbuild.v1.cloud-build")
+public class CloudBuildSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getBuild. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBuildRetry;
+ /**
+ * Allow override of retry settings at method-level for listBuilds. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBuildsRetry;
+ /**
+ * Allow override of retry settings at method-level for cancelBuild. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry cancelBuildRetry;
+ /**
+ * Allow override of retry settings at method-level for createBuildTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createBuildTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for getBuildTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBuildTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for listBuildTriggers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBuildTriggersRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteBuildTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteBuildTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for updateBuildTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateBuildTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for receiveTriggerWebhook. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry receiveTriggerWebhookRetry;
+ /**
+ * Allow override of retry settings at method-level for getWorkerPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getWorkerPoolRetry;
+ /**
+ * Allow override of retry settings at method-level for listWorkerPools. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listWorkerPoolsRetry;
+
+ @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 getGetBuildRetry() {
+ return this.getBuildRetry;
+ }
+
+ public void setGetBuildRetry(Retry getBuildRetry) {
+ this.getBuildRetry = getBuildRetry;
+ }
+
+ public Retry getListBuildsRetry() {
+ return this.listBuildsRetry;
+ }
+
+ public void setListBuildsRetry(Retry listBuildsRetry) {
+ this.listBuildsRetry = listBuildsRetry;
+ }
+
+ public Retry getCancelBuildRetry() {
+ return this.cancelBuildRetry;
+ }
+
+ public void setCancelBuildRetry(Retry cancelBuildRetry) {
+ this.cancelBuildRetry = cancelBuildRetry;
+ }
+
+ public Retry getCreateBuildTriggerRetry() {
+ return this.createBuildTriggerRetry;
+ }
+
+ public void setCreateBuildTriggerRetry(Retry createBuildTriggerRetry) {
+ this.createBuildTriggerRetry = createBuildTriggerRetry;
+ }
+
+ public Retry getGetBuildTriggerRetry() {
+ return this.getBuildTriggerRetry;
+ }
+
+ public void setGetBuildTriggerRetry(Retry getBuildTriggerRetry) {
+ this.getBuildTriggerRetry = getBuildTriggerRetry;
+ }
+
+ public Retry getListBuildTriggersRetry() {
+ return this.listBuildTriggersRetry;
+ }
+
+ public void setListBuildTriggersRetry(Retry listBuildTriggersRetry) {
+ this.listBuildTriggersRetry = listBuildTriggersRetry;
+ }
+
+ public Retry getDeleteBuildTriggerRetry() {
+ return this.deleteBuildTriggerRetry;
+ }
+
+ public void setDeleteBuildTriggerRetry(Retry deleteBuildTriggerRetry) {
+ this.deleteBuildTriggerRetry = deleteBuildTriggerRetry;
+ }
+
+ public Retry getUpdateBuildTriggerRetry() {
+ return this.updateBuildTriggerRetry;
+ }
+
+ public void setUpdateBuildTriggerRetry(Retry updateBuildTriggerRetry) {
+ this.updateBuildTriggerRetry = updateBuildTriggerRetry;
+ }
+
+ public Retry getReceiveTriggerWebhookRetry() {
+ return this.receiveTriggerWebhookRetry;
+ }
+
+ public void setReceiveTriggerWebhookRetry(Retry receiveTriggerWebhookRetry) {
+ this.receiveTriggerWebhookRetry = receiveTriggerWebhookRetry;
+ }
+
+ public Retry getGetWorkerPoolRetry() {
+ return this.getWorkerPoolRetry;
+ }
+
+ public void setGetWorkerPoolRetry(Retry getWorkerPoolRetry) {
+ this.getWorkerPoolRetry = getWorkerPoolRetry;
+ }
+
+ public Retry getListWorkerPoolsRetry() {
+ return this.listWorkerPoolsRetry;
+ }
+
+ public void setListWorkerPoolsRetry(Retry listWorkerPoolsRetry) {
+ this.listWorkerPoolsRetry = listWorkerPoolsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/package-info.java
new file mode 100644
index 0000000000..d8cb436510
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/java/com/google/cloud/devtools/cloudbuild/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudbuild. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.devtools.cloudbuild.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..8fcf88e2e2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.devtools.cloudbuild.v1.cloud-build.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudbuild/CloudBuild components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..81cb8d4ce7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-build-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.devtools.cloudbuild.v1.spring.CloudBuildSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-channel-spring-starter/pom.xml
new file mode 100644
index 0000000000..f21850857b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-channel-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CloudChannelReportsServiceSpringProperties. 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 CloudChannelReportsServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public CloudChannelReportsServiceSettings cloudChannelReportsServiceSettings( + @Qualifier("defaultCloudChannelReportsServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CloudChannelReportsServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CloudChannelReportsServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CloudChannelReportsServiceSettings.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 = + CloudChannelReportsServiceSettings.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 fetchReportResultsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchReportResultsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .fetchReportResultsSettings() + .setRetrySettings(fetchReportResultsRetrySettings); + + RetrySettings listReportsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listReportsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listReportsSettings().setRetrySettings(listReportsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry fetchReportResultsRetry = clientProperties.getFetchReportResultsRetry(); + if (fetchReportResultsRetry != null) { + RetrySettings fetchReportResultsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchReportResultsSettings().getRetrySettings(), + fetchReportResultsRetry); + clientSettingsBuilder + .fetchReportResultsSettings() + .setRetrySettings(fetchReportResultsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for fetchReportResults from properties."); + } + } + Retry listReportsRetry = clientProperties.getListReportsRetry(); + if (listReportsRetry != null) { + RetrySettings listReportsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listReportsSettings().getRetrySettings(), listReportsRetry); + clientSettingsBuilder.listReportsSettings().setRetrySettings(listReportsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listReports from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CloudChannelReportsServiceClient bean configured with + * CloudChannelReportsServiceSettings. + * + * @param cloudChannelReportsServiceSettings settings to configure an instance of client bean. + * @return a {@link CloudChannelReportsServiceClient} bean configured with {@link + * CloudChannelReportsServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public CloudChannelReportsServiceClient cloudChannelReportsServiceClient( + CloudChannelReportsServiceSettings cloudChannelReportsServiceSettings) throws IOException { + return CloudChannelReportsServiceClient.create(cloudChannelReportsServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cloud-channel-reports-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringProperties.java new file mode 100644 index 0000000000..4baac0da1e --- /dev/null +++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelReportsServiceSpringProperties.java @@ -0,0 +1,108 @@ +/* + * Copyright 2022 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.channel.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 CloudChannelReportsService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.channel.v1.cloud-channel-reports-service") +public class CloudChannelReportsServiceSpringProperties 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/apps.reports.usage.readonly"); + /** 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 fetchReportResults. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry fetchReportResultsRetry; + /** + * Allow override of retry settings at method-level for listReports. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listReportsRetry; + + @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 getFetchReportResultsRetry() { + return this.fetchReportResultsRetry; + } + + public void setFetchReportResultsRetry(Retry fetchReportResultsRetry) { + this.fetchReportResultsRetry = fetchReportResultsRetry; + } + + public Retry getListReportsRetry() { + return this.listReportsRetry; + } + + public void setListReportsRetry(Retry listReportsRetry) { + this.listReportsRetry = listReportsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..97575e1882 --- /dev/null +++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringAutoConfiguration.java @@ -0,0 +1,881 @@ +/* + * Copyright 2022 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.channel.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.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudChannelServiceSettings; +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 CloudChannelServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudChannelServiceSpringProperties. 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 CloudChannelServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudChannelServiceSettings cloudChannelServiceSettings(
+ @Qualifier("defaultCloudChannelServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudChannelServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudChannelServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudChannelServiceSettings.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 =
+ CloudChannelServiceSettings.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 listCustomersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listCustomersSettings().setRetrySettings(listCustomersRetrySettings);
+
+ RetrySettings getCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCustomerSettings().setRetrySettings(getCustomerRetrySettings);
+
+ RetrySettings checkCloudIdentityAccountsExistRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkCloudIdentityAccountsExistSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .checkCloudIdentityAccountsExistSettings()
+ .setRetrySettings(checkCloudIdentityAccountsExistRetrySettings);
+
+ RetrySettings createCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCustomerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createCustomerSettings().setRetrySettings(createCustomerRetrySettings);
+
+ RetrySettings updateCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCustomerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateCustomerSettings().setRetrySettings(updateCustomerRetrySettings);
+
+ RetrySettings deleteCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCustomerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteCustomerSettings().setRetrySettings(deleteCustomerRetrySettings);
+
+ RetrySettings importCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.importCustomerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.importCustomerSettings().setRetrySettings(importCustomerRetrySettings);
+
+ RetrySettings listEntitlementsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEntitlementsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listEntitlementsSettings()
+ .setRetrySettings(listEntitlementsRetrySettings);
+
+ RetrySettings listTransferableSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferableSkusSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listTransferableSkusSettings()
+ .setRetrySettings(listTransferableSkusRetrySettings);
+
+ RetrySettings listTransferableOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferableOffersSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listTransferableOffersSettings()
+ .setRetrySettings(listTransferableOffersRetrySettings);
+
+ RetrySettings getEntitlementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEntitlementSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEntitlementSettings().setRetrySettings(getEntitlementRetrySettings);
+
+ RetrySettings listChannelPartnerLinksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelPartnerLinksSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listChannelPartnerLinksSettings()
+ .setRetrySettings(listChannelPartnerLinksRetrySettings);
+
+ RetrySettings getChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelPartnerLinkSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getChannelPartnerLinkSettings()
+ .setRetrySettings(getChannelPartnerLinkRetrySettings);
+
+ RetrySettings createChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createChannelPartnerLinkSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createChannelPartnerLinkSettings()
+ .setRetrySettings(createChannelPartnerLinkRetrySettings);
+
+ RetrySettings updateChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateChannelPartnerLinkSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateChannelPartnerLinkSettings()
+ .setRetrySettings(updateChannelPartnerLinkRetrySettings);
+
+ RetrySettings getCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomerRepricingConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getCustomerRepricingConfigSettings()
+ .setRetrySettings(getCustomerRepricingConfigRetrySettings);
+
+ RetrySettings listCustomerRepricingConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomerRepricingConfigsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listCustomerRepricingConfigsSettings()
+ .setRetrySettings(listCustomerRepricingConfigsRetrySettings);
+
+ RetrySettings createCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCustomerRepricingConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createCustomerRepricingConfigSettings()
+ .setRetrySettings(createCustomerRepricingConfigRetrySettings);
+
+ RetrySettings updateCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCustomerRepricingConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateCustomerRepricingConfigSettings()
+ .setRetrySettings(updateCustomerRepricingConfigRetrySettings);
+
+ RetrySettings deleteCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCustomerRepricingConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteCustomerRepricingConfigSettings()
+ .setRetrySettings(deleteCustomerRepricingConfigRetrySettings);
+
+ RetrySettings getChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelPartnerRepricingConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(getChannelPartnerRepricingConfigRetrySettings);
+
+ RetrySettings listChannelPartnerRepricingConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelPartnerRepricingConfigsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listChannelPartnerRepricingConfigsSettings()
+ .setRetrySettings(listChannelPartnerRepricingConfigsRetrySettings);
+
+ RetrySettings createChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .createChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(createChannelPartnerRepricingConfigRetrySettings);
+
+ RetrySettings updateChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .updateChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(updateChannelPartnerRepricingConfigRetrySettings);
+
+ RetrySettings deleteChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .deleteChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(deleteChannelPartnerRepricingConfigRetrySettings);
+
+ RetrySettings lookupOfferRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupOfferSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.lookupOfferSettings().setRetrySettings(lookupOfferRetrySettings);
+
+ RetrySettings listProductsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProductsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listProductsSettings().setRetrySettings(listProductsRetrySettings);
+
+ RetrySettings listSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSkusSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSkusSettings().setRetrySettings(listSkusRetrySettings);
+
+ RetrySettings listOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOffersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listOffersSettings().setRetrySettings(listOffersRetrySettings);
+
+ RetrySettings listPurchasableSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPurchasableSkusSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listPurchasableSkusSettings()
+ .setRetrySettings(listPurchasableSkusRetrySettings);
+
+ RetrySettings listPurchasableOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPurchasableOffersSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listPurchasableOffersSettings()
+ .setRetrySettings(listPurchasableOffersRetrySettings);
+
+ RetrySettings registerSubscriberRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.registerSubscriberSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .registerSubscriberSettings()
+ .setRetrySettings(registerSubscriberRetrySettings);
+
+ RetrySettings unregisterSubscriberRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.unregisterSubscriberSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .unregisterSubscriberSettings()
+ .setRetrySettings(unregisterSubscriberRetrySettings);
+
+ RetrySettings listSubscribersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSubscribersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listSubscribersSettings()
+ .setRetrySettings(listSubscribersRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listCustomersRetry = clientProperties.getListCustomersRetry();
+ if (listCustomersRetry != null) {
+ RetrySettings listCustomersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomersSettings().getRetrySettings(), listCustomersRetry);
+ clientSettingsBuilder.listCustomersSettings().setRetrySettings(listCustomersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listCustomers from properties.");
+ }
+ }
+ Retry getCustomerRetry = clientProperties.getGetCustomerRetry();
+ if (getCustomerRetry != null) {
+ RetrySettings getCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomerSettings().getRetrySettings(), getCustomerRetry);
+ clientSettingsBuilder.getCustomerSettings().setRetrySettings(getCustomerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCustomer from properties.");
+ }
+ }
+ Retry checkCloudIdentityAccountsExistRetry =
+ clientProperties.getCheckCloudIdentityAccountsExistRetry();
+ if (checkCloudIdentityAccountsExistRetry != null) {
+ RetrySettings checkCloudIdentityAccountsExistRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkCloudIdentityAccountsExistSettings().getRetrySettings(),
+ checkCloudIdentityAccountsExistRetry);
+ clientSettingsBuilder
+ .checkCloudIdentityAccountsExistSettings()
+ .setRetrySettings(checkCloudIdentityAccountsExistRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for checkCloudIdentityAccountsExist from properties.");
+ }
+ }
+ Retry createCustomerRetry = clientProperties.getCreateCustomerRetry();
+ if (createCustomerRetry != null) {
+ RetrySettings createCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCustomerSettings().getRetrySettings(),
+ createCustomerRetry);
+ clientSettingsBuilder.createCustomerSettings().setRetrySettings(createCustomerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createCustomer from properties.");
+ }
+ }
+ Retry updateCustomerRetry = clientProperties.getUpdateCustomerRetry();
+ if (updateCustomerRetry != null) {
+ RetrySettings updateCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCustomerSettings().getRetrySettings(),
+ updateCustomerRetry);
+ clientSettingsBuilder.updateCustomerSettings().setRetrySettings(updateCustomerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateCustomer from properties.");
+ }
+ }
+ Retry deleteCustomerRetry = clientProperties.getDeleteCustomerRetry();
+ if (deleteCustomerRetry != null) {
+ RetrySettings deleteCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCustomerSettings().getRetrySettings(),
+ deleteCustomerRetry);
+ clientSettingsBuilder.deleteCustomerSettings().setRetrySettings(deleteCustomerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteCustomer from properties.");
+ }
+ }
+ Retry importCustomerRetry = clientProperties.getImportCustomerRetry();
+ if (importCustomerRetry != null) {
+ RetrySettings importCustomerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.importCustomerSettings().getRetrySettings(),
+ importCustomerRetry);
+ clientSettingsBuilder.importCustomerSettings().setRetrySettings(importCustomerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for importCustomer from properties.");
+ }
+ }
+ Retry listEntitlementsRetry = clientProperties.getListEntitlementsRetry();
+ if (listEntitlementsRetry != null) {
+ RetrySettings listEntitlementsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEntitlementsSettings().getRetrySettings(),
+ listEntitlementsRetry);
+ clientSettingsBuilder
+ .listEntitlementsSettings()
+ .setRetrySettings(listEntitlementsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listEntitlements from properties.");
+ }
+ }
+ Retry listTransferableSkusRetry = clientProperties.getListTransferableSkusRetry();
+ if (listTransferableSkusRetry != null) {
+ RetrySettings listTransferableSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferableSkusSettings().getRetrySettings(),
+ listTransferableSkusRetry);
+ clientSettingsBuilder
+ .listTransferableSkusSettings()
+ .setRetrySettings(listTransferableSkusRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferableSkus from properties.");
+ }
+ }
+ Retry listTransferableOffersRetry = clientProperties.getListTransferableOffersRetry();
+ if (listTransferableOffersRetry != null) {
+ RetrySettings listTransferableOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferableOffersSettings().getRetrySettings(),
+ listTransferableOffersRetry);
+ clientSettingsBuilder
+ .listTransferableOffersSettings()
+ .setRetrySettings(listTransferableOffersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferableOffers from properties.");
+ }
+ }
+ Retry getEntitlementRetry = clientProperties.getGetEntitlementRetry();
+ if (getEntitlementRetry != null) {
+ RetrySettings getEntitlementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEntitlementSettings().getRetrySettings(),
+ getEntitlementRetry);
+ clientSettingsBuilder.getEntitlementSettings().setRetrySettings(getEntitlementRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEntitlement from properties.");
+ }
+ }
+ Retry listChannelPartnerLinksRetry = clientProperties.getListChannelPartnerLinksRetry();
+ if (listChannelPartnerLinksRetry != null) {
+ RetrySettings listChannelPartnerLinksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelPartnerLinksSettings().getRetrySettings(),
+ listChannelPartnerLinksRetry);
+ clientSettingsBuilder
+ .listChannelPartnerLinksSettings()
+ .setRetrySettings(listChannelPartnerLinksRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listChannelPartnerLinks from properties.");
+ }
+ }
+ Retry getChannelPartnerLinkRetry = clientProperties.getGetChannelPartnerLinkRetry();
+ if (getChannelPartnerLinkRetry != null) {
+ RetrySettings getChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelPartnerLinkSettings().getRetrySettings(),
+ getChannelPartnerLinkRetry);
+ clientSettingsBuilder
+ .getChannelPartnerLinkSettings()
+ .setRetrySettings(getChannelPartnerLinkRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getChannelPartnerLink from properties.");
+ }
+ }
+ Retry createChannelPartnerLinkRetry = clientProperties.getCreateChannelPartnerLinkRetry();
+ if (createChannelPartnerLinkRetry != null) {
+ RetrySettings createChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createChannelPartnerLinkSettings().getRetrySettings(),
+ createChannelPartnerLinkRetry);
+ clientSettingsBuilder
+ .createChannelPartnerLinkSettings()
+ .setRetrySettings(createChannelPartnerLinkRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createChannelPartnerLink from properties.");
+ }
+ }
+ Retry updateChannelPartnerLinkRetry = clientProperties.getUpdateChannelPartnerLinkRetry();
+ if (updateChannelPartnerLinkRetry != null) {
+ RetrySettings updateChannelPartnerLinkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateChannelPartnerLinkSettings().getRetrySettings(),
+ updateChannelPartnerLinkRetry);
+ clientSettingsBuilder
+ .updateChannelPartnerLinkSettings()
+ .setRetrySettings(updateChannelPartnerLinkRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateChannelPartnerLink from properties.");
+ }
+ }
+ Retry getCustomerRepricingConfigRetry = clientProperties.getGetCustomerRepricingConfigRetry();
+ if (getCustomerRepricingConfigRetry != null) {
+ RetrySettings getCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomerRepricingConfigSettings().getRetrySettings(),
+ getCustomerRepricingConfigRetry);
+ clientSettingsBuilder
+ .getCustomerRepricingConfigSettings()
+ .setRetrySettings(getCustomerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getCustomerRepricingConfig from properties.");
+ }
+ }
+ Retry listCustomerRepricingConfigsRetry =
+ clientProperties.getListCustomerRepricingConfigsRetry();
+ if (listCustomerRepricingConfigsRetry != null) {
+ RetrySettings listCustomerRepricingConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomerRepricingConfigsSettings().getRetrySettings(),
+ listCustomerRepricingConfigsRetry);
+ clientSettingsBuilder
+ .listCustomerRepricingConfigsSettings()
+ .setRetrySettings(listCustomerRepricingConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCustomerRepricingConfigs from properties.");
+ }
+ }
+ Retry createCustomerRepricingConfigRetry =
+ clientProperties.getCreateCustomerRepricingConfigRetry();
+ if (createCustomerRepricingConfigRetry != null) {
+ RetrySettings createCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCustomerRepricingConfigSettings().getRetrySettings(),
+ createCustomerRepricingConfigRetry);
+ clientSettingsBuilder
+ .createCustomerRepricingConfigSettings()
+ .setRetrySettings(createCustomerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createCustomerRepricingConfig from properties.");
+ }
+ }
+ Retry updateCustomerRepricingConfigRetry =
+ clientProperties.getUpdateCustomerRepricingConfigRetry();
+ if (updateCustomerRepricingConfigRetry != null) {
+ RetrySettings updateCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCustomerRepricingConfigSettings().getRetrySettings(),
+ updateCustomerRepricingConfigRetry);
+ clientSettingsBuilder
+ .updateCustomerRepricingConfigSettings()
+ .setRetrySettings(updateCustomerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateCustomerRepricingConfig from properties.");
+ }
+ }
+ Retry deleteCustomerRepricingConfigRetry =
+ clientProperties.getDeleteCustomerRepricingConfigRetry();
+ if (deleteCustomerRepricingConfigRetry != null) {
+ RetrySettings deleteCustomerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteCustomerRepricingConfigSettings().getRetrySettings(),
+ deleteCustomerRepricingConfigRetry);
+ clientSettingsBuilder
+ .deleteCustomerRepricingConfigSettings()
+ .setRetrySettings(deleteCustomerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteCustomerRepricingConfig from properties.");
+ }
+ }
+ Retry getChannelPartnerRepricingConfigRetry =
+ clientProperties.getGetChannelPartnerRepricingConfigRetry();
+ if (getChannelPartnerRepricingConfigRetry != null) {
+ RetrySettings getChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelPartnerRepricingConfigSettings().getRetrySettings(),
+ getChannelPartnerRepricingConfigRetry);
+ clientSettingsBuilder
+ .getChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(getChannelPartnerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getChannelPartnerRepricingConfig from properties.");
+ }
+ }
+ Retry listChannelPartnerRepricingConfigsRetry =
+ clientProperties.getListChannelPartnerRepricingConfigsRetry();
+ if (listChannelPartnerRepricingConfigsRetry != null) {
+ RetrySettings listChannelPartnerRepricingConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelPartnerRepricingConfigsSettings().getRetrySettings(),
+ listChannelPartnerRepricingConfigsRetry);
+ clientSettingsBuilder
+ .listChannelPartnerRepricingConfigsSettings()
+ .setRetrySettings(listChannelPartnerRepricingConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listChannelPartnerRepricingConfigs from properties.");
+ }
+ }
+ Retry createChannelPartnerRepricingConfigRetry =
+ clientProperties.getCreateChannelPartnerRepricingConfigRetry();
+ if (createChannelPartnerRepricingConfigRetry != null) {
+ RetrySettings createChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .createChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ createChannelPartnerRepricingConfigRetry);
+ clientSettingsBuilder
+ .createChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(createChannelPartnerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createChannelPartnerRepricingConfig from properties.");
+ }
+ }
+ Retry updateChannelPartnerRepricingConfigRetry =
+ clientProperties.getUpdateChannelPartnerRepricingConfigRetry();
+ if (updateChannelPartnerRepricingConfigRetry != null) {
+ RetrySettings updateChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .updateChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ updateChannelPartnerRepricingConfigRetry);
+ clientSettingsBuilder
+ .updateChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(updateChannelPartnerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateChannelPartnerRepricingConfig from properties.");
+ }
+ }
+ Retry deleteChannelPartnerRepricingConfigRetry =
+ clientProperties.getDeleteChannelPartnerRepricingConfigRetry();
+ if (deleteChannelPartnerRepricingConfigRetry != null) {
+ RetrySettings deleteChannelPartnerRepricingConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .deleteChannelPartnerRepricingConfigSettings()
+ .getRetrySettings(),
+ deleteChannelPartnerRepricingConfigRetry);
+ clientSettingsBuilder
+ .deleteChannelPartnerRepricingConfigSettings()
+ .setRetrySettings(deleteChannelPartnerRepricingConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteChannelPartnerRepricingConfig from properties.");
+ }
+ }
+ Retry lookupOfferRetry = clientProperties.getLookupOfferRetry();
+ if (lookupOfferRetry != null) {
+ RetrySettings lookupOfferRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupOfferSettings().getRetrySettings(), lookupOfferRetry);
+ clientSettingsBuilder.lookupOfferSettings().setRetrySettings(lookupOfferRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for lookupOffer from properties.");
+ }
+ }
+ Retry listProductsRetry = clientProperties.getListProductsRetry();
+ if (listProductsRetry != null) {
+ RetrySettings listProductsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProductsSettings().getRetrySettings(), listProductsRetry);
+ clientSettingsBuilder.listProductsSettings().setRetrySettings(listProductsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listProducts from properties.");
+ }
+ }
+ Retry listSkusRetry = clientProperties.getListSkusRetry();
+ if (listSkusRetry != null) {
+ RetrySettings listSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSkusSettings().getRetrySettings(), listSkusRetry);
+ clientSettingsBuilder.listSkusSettings().setRetrySettings(listSkusRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSkus from properties.");
+ }
+ }
+ Retry listOffersRetry = clientProperties.getListOffersRetry();
+ if (listOffersRetry != null) {
+ RetrySettings listOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOffersSettings().getRetrySettings(), listOffersRetry);
+ clientSettingsBuilder.listOffersSettings().setRetrySettings(listOffersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listOffers from properties.");
+ }
+ }
+ Retry listPurchasableSkusRetry = clientProperties.getListPurchasableSkusRetry();
+ if (listPurchasableSkusRetry != null) {
+ RetrySettings listPurchasableSkusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPurchasableSkusSettings().getRetrySettings(),
+ listPurchasableSkusRetry);
+ clientSettingsBuilder
+ .listPurchasableSkusSettings()
+ .setRetrySettings(listPurchasableSkusRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listPurchasableSkus from properties.");
+ }
+ }
+ Retry listPurchasableOffersRetry = clientProperties.getListPurchasableOffersRetry();
+ if (listPurchasableOffersRetry != null) {
+ RetrySettings listPurchasableOffersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPurchasableOffersSettings().getRetrySettings(),
+ listPurchasableOffersRetry);
+ clientSettingsBuilder
+ .listPurchasableOffersSettings()
+ .setRetrySettings(listPurchasableOffersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listPurchasableOffers from properties.");
+ }
+ }
+ Retry registerSubscriberRetry = clientProperties.getRegisterSubscriberRetry();
+ if (registerSubscriberRetry != null) {
+ RetrySettings registerSubscriberRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.registerSubscriberSettings().getRetrySettings(),
+ registerSubscriberRetry);
+ clientSettingsBuilder
+ .registerSubscriberSettings()
+ .setRetrySettings(registerSubscriberRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for registerSubscriber from properties.");
+ }
+ }
+ Retry unregisterSubscriberRetry = clientProperties.getUnregisterSubscriberRetry();
+ if (unregisterSubscriberRetry != null) {
+ RetrySettings unregisterSubscriberRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.unregisterSubscriberSettings().getRetrySettings(),
+ unregisterSubscriberRetry);
+ clientSettingsBuilder
+ .unregisterSubscriberSettings()
+ .setRetrySettings(unregisterSubscriberRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for unregisterSubscriber from properties.");
+ }
+ }
+ Retry listSubscribersRetry = clientProperties.getListSubscribersRetry();
+ if (listSubscribersRetry != null) {
+ RetrySettings listSubscribersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSubscribersSettings().getRetrySettings(),
+ listSubscribersRetry);
+ clientSettingsBuilder
+ .listSubscribersSettings()
+ .setRetrySettings(listSubscribersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSubscribers from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudChannelServiceClient bean configured with CloudChannelServiceSettings.
+ *
+ * @param cloudChannelServiceSettings settings to configure an instance of client bean.
+ * @return a {@link CloudChannelServiceClient} bean configured with {@link
+ * CloudChannelServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudChannelServiceClient cloudChannelServiceClient(
+ CloudChannelServiceSettings cloudChannelServiceSettings) throws IOException {
+ return CloudChannelServiceClient.create(cloudChannelServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-channel-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringProperties.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringProperties.java
new file mode 100644
index 0000000000..0ccf77f4a6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/CloudChannelServiceSpringProperties.java
@@ -0,0 +1,529 @@
+/*
+ * Copyright 2022 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.channel.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 CloudChannelService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.channel.v1.cloud-channel-service")
+public class CloudChannelServiceSpringProperties 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/apps.order");
+ /** 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 listCustomers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCustomersRetry;
+ /**
+ * Allow override of retry settings at method-level for getCustomer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCustomerRetry;
+ /**
+ * Allow override of retry settings at method-level for checkCloudIdentityAccountsExist. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry checkCloudIdentityAccountsExistRetry;
+ /**
+ * Allow override of retry settings at method-level for createCustomer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createCustomerRetry;
+ /**
+ * Allow override of retry settings at method-level for updateCustomer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateCustomerRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteCustomer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteCustomerRetry;
+ /**
+ * Allow override of retry settings at method-level for importCustomer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry importCustomerRetry;
+ /**
+ * Allow override of retry settings at method-level for listEntitlements. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listEntitlementsRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferableSkus. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferableSkusRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferableOffers. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferableOffersRetry;
+ /**
+ * Allow override of retry settings at method-level for getEntitlement. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEntitlementRetry;
+ /**
+ * Allow override of retry settings at method-level for listChannelPartnerLinks. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listChannelPartnerLinksRetry;
+ /**
+ * Allow override of retry settings at method-level for getChannelPartnerLink. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getChannelPartnerLinkRetry;
+ /**
+ * Allow override of retry settings at method-level for createChannelPartnerLink. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createChannelPartnerLinkRetry;
+ /**
+ * Allow override of retry settings at method-level for updateChannelPartnerLink. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateChannelPartnerLinkRetry;
+ /**
+ * Allow override of retry settings at method-level for getCustomerRepricingConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCustomerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listCustomerRepricingConfigs. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCustomerRepricingConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for createCustomerRepricingConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createCustomerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateCustomerRepricingConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateCustomerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteCustomerRepricingConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteCustomerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getChannelPartnerRepricingConfig. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getChannelPartnerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listChannelPartnerRepricingConfigs. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listChannelPartnerRepricingConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for createChannelPartnerRepricingConfig. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createChannelPartnerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateChannelPartnerRepricingConfig. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateChannelPartnerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteChannelPartnerRepricingConfig. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteChannelPartnerRepricingConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for lookupOffer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry lookupOfferRetry;
+ /**
+ * Allow override of retry settings at method-level for listProducts. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listProductsRetry;
+ /**
+ * Allow override of retry settings at method-level for listSkus. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSkusRetry;
+ /**
+ * Allow override of retry settings at method-level for listOffers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOffersRetry;
+ /**
+ * Allow override of retry settings at method-level for listPurchasableSkus. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPurchasableSkusRetry;
+ /**
+ * Allow override of retry settings at method-level for listPurchasableOffers. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPurchasableOffersRetry;
+ /**
+ * Allow override of retry settings at method-level for registerSubscriber. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry registerSubscriberRetry;
+ /**
+ * Allow override of retry settings at method-level for unregisterSubscriber. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry unregisterSubscriberRetry;
+ /**
+ * Allow override of retry settings at method-level for listSubscribers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSubscribersRetry;
+
+ @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 getListCustomersRetry() {
+ return this.listCustomersRetry;
+ }
+
+ public void setListCustomersRetry(Retry listCustomersRetry) {
+ this.listCustomersRetry = listCustomersRetry;
+ }
+
+ public Retry getGetCustomerRetry() {
+ return this.getCustomerRetry;
+ }
+
+ public void setGetCustomerRetry(Retry getCustomerRetry) {
+ this.getCustomerRetry = getCustomerRetry;
+ }
+
+ public Retry getCheckCloudIdentityAccountsExistRetry() {
+ return this.checkCloudIdentityAccountsExistRetry;
+ }
+
+ public void setCheckCloudIdentityAccountsExistRetry(Retry checkCloudIdentityAccountsExistRetry) {
+ this.checkCloudIdentityAccountsExistRetry = checkCloudIdentityAccountsExistRetry;
+ }
+
+ public Retry getCreateCustomerRetry() {
+ return this.createCustomerRetry;
+ }
+
+ public void setCreateCustomerRetry(Retry createCustomerRetry) {
+ this.createCustomerRetry = createCustomerRetry;
+ }
+
+ public Retry getUpdateCustomerRetry() {
+ return this.updateCustomerRetry;
+ }
+
+ public void setUpdateCustomerRetry(Retry updateCustomerRetry) {
+ this.updateCustomerRetry = updateCustomerRetry;
+ }
+
+ public Retry getDeleteCustomerRetry() {
+ return this.deleteCustomerRetry;
+ }
+
+ public void setDeleteCustomerRetry(Retry deleteCustomerRetry) {
+ this.deleteCustomerRetry = deleteCustomerRetry;
+ }
+
+ public Retry getImportCustomerRetry() {
+ return this.importCustomerRetry;
+ }
+
+ public void setImportCustomerRetry(Retry importCustomerRetry) {
+ this.importCustomerRetry = importCustomerRetry;
+ }
+
+ public Retry getListEntitlementsRetry() {
+ return this.listEntitlementsRetry;
+ }
+
+ public void setListEntitlementsRetry(Retry listEntitlementsRetry) {
+ this.listEntitlementsRetry = listEntitlementsRetry;
+ }
+
+ public Retry getListTransferableSkusRetry() {
+ return this.listTransferableSkusRetry;
+ }
+
+ public void setListTransferableSkusRetry(Retry listTransferableSkusRetry) {
+ this.listTransferableSkusRetry = listTransferableSkusRetry;
+ }
+
+ public Retry getListTransferableOffersRetry() {
+ return this.listTransferableOffersRetry;
+ }
+
+ public void setListTransferableOffersRetry(Retry listTransferableOffersRetry) {
+ this.listTransferableOffersRetry = listTransferableOffersRetry;
+ }
+
+ public Retry getGetEntitlementRetry() {
+ return this.getEntitlementRetry;
+ }
+
+ public void setGetEntitlementRetry(Retry getEntitlementRetry) {
+ this.getEntitlementRetry = getEntitlementRetry;
+ }
+
+ public Retry getListChannelPartnerLinksRetry() {
+ return this.listChannelPartnerLinksRetry;
+ }
+
+ public void setListChannelPartnerLinksRetry(Retry listChannelPartnerLinksRetry) {
+ this.listChannelPartnerLinksRetry = listChannelPartnerLinksRetry;
+ }
+
+ public Retry getGetChannelPartnerLinkRetry() {
+ return this.getChannelPartnerLinkRetry;
+ }
+
+ public void setGetChannelPartnerLinkRetry(Retry getChannelPartnerLinkRetry) {
+ this.getChannelPartnerLinkRetry = getChannelPartnerLinkRetry;
+ }
+
+ public Retry getCreateChannelPartnerLinkRetry() {
+ return this.createChannelPartnerLinkRetry;
+ }
+
+ public void setCreateChannelPartnerLinkRetry(Retry createChannelPartnerLinkRetry) {
+ this.createChannelPartnerLinkRetry = createChannelPartnerLinkRetry;
+ }
+
+ public Retry getUpdateChannelPartnerLinkRetry() {
+ return this.updateChannelPartnerLinkRetry;
+ }
+
+ public void setUpdateChannelPartnerLinkRetry(Retry updateChannelPartnerLinkRetry) {
+ this.updateChannelPartnerLinkRetry = updateChannelPartnerLinkRetry;
+ }
+
+ public Retry getGetCustomerRepricingConfigRetry() {
+ return this.getCustomerRepricingConfigRetry;
+ }
+
+ public void setGetCustomerRepricingConfigRetry(Retry getCustomerRepricingConfigRetry) {
+ this.getCustomerRepricingConfigRetry = getCustomerRepricingConfigRetry;
+ }
+
+ public Retry getListCustomerRepricingConfigsRetry() {
+ return this.listCustomerRepricingConfigsRetry;
+ }
+
+ public void setListCustomerRepricingConfigsRetry(Retry listCustomerRepricingConfigsRetry) {
+ this.listCustomerRepricingConfigsRetry = listCustomerRepricingConfigsRetry;
+ }
+
+ public Retry getCreateCustomerRepricingConfigRetry() {
+ return this.createCustomerRepricingConfigRetry;
+ }
+
+ public void setCreateCustomerRepricingConfigRetry(Retry createCustomerRepricingConfigRetry) {
+ this.createCustomerRepricingConfigRetry = createCustomerRepricingConfigRetry;
+ }
+
+ public Retry getUpdateCustomerRepricingConfigRetry() {
+ return this.updateCustomerRepricingConfigRetry;
+ }
+
+ public void setUpdateCustomerRepricingConfigRetry(Retry updateCustomerRepricingConfigRetry) {
+ this.updateCustomerRepricingConfigRetry = updateCustomerRepricingConfigRetry;
+ }
+
+ public Retry getDeleteCustomerRepricingConfigRetry() {
+ return this.deleteCustomerRepricingConfigRetry;
+ }
+
+ public void setDeleteCustomerRepricingConfigRetry(Retry deleteCustomerRepricingConfigRetry) {
+ this.deleteCustomerRepricingConfigRetry = deleteCustomerRepricingConfigRetry;
+ }
+
+ public Retry getGetChannelPartnerRepricingConfigRetry() {
+ return this.getChannelPartnerRepricingConfigRetry;
+ }
+
+ public void setGetChannelPartnerRepricingConfigRetry(
+ Retry getChannelPartnerRepricingConfigRetry) {
+ this.getChannelPartnerRepricingConfigRetry = getChannelPartnerRepricingConfigRetry;
+ }
+
+ public Retry getListChannelPartnerRepricingConfigsRetry() {
+ return this.listChannelPartnerRepricingConfigsRetry;
+ }
+
+ public void setListChannelPartnerRepricingConfigsRetry(
+ Retry listChannelPartnerRepricingConfigsRetry) {
+ this.listChannelPartnerRepricingConfigsRetry = listChannelPartnerRepricingConfigsRetry;
+ }
+
+ public Retry getCreateChannelPartnerRepricingConfigRetry() {
+ return this.createChannelPartnerRepricingConfigRetry;
+ }
+
+ public void setCreateChannelPartnerRepricingConfigRetry(
+ Retry createChannelPartnerRepricingConfigRetry) {
+ this.createChannelPartnerRepricingConfigRetry = createChannelPartnerRepricingConfigRetry;
+ }
+
+ public Retry getUpdateChannelPartnerRepricingConfigRetry() {
+ return this.updateChannelPartnerRepricingConfigRetry;
+ }
+
+ public void setUpdateChannelPartnerRepricingConfigRetry(
+ Retry updateChannelPartnerRepricingConfigRetry) {
+ this.updateChannelPartnerRepricingConfigRetry = updateChannelPartnerRepricingConfigRetry;
+ }
+
+ public Retry getDeleteChannelPartnerRepricingConfigRetry() {
+ return this.deleteChannelPartnerRepricingConfigRetry;
+ }
+
+ public void setDeleteChannelPartnerRepricingConfigRetry(
+ Retry deleteChannelPartnerRepricingConfigRetry) {
+ this.deleteChannelPartnerRepricingConfigRetry = deleteChannelPartnerRepricingConfigRetry;
+ }
+
+ public Retry getLookupOfferRetry() {
+ return this.lookupOfferRetry;
+ }
+
+ public void setLookupOfferRetry(Retry lookupOfferRetry) {
+ this.lookupOfferRetry = lookupOfferRetry;
+ }
+
+ public Retry getListProductsRetry() {
+ return this.listProductsRetry;
+ }
+
+ public void setListProductsRetry(Retry listProductsRetry) {
+ this.listProductsRetry = listProductsRetry;
+ }
+
+ public Retry getListSkusRetry() {
+ return this.listSkusRetry;
+ }
+
+ public void setListSkusRetry(Retry listSkusRetry) {
+ this.listSkusRetry = listSkusRetry;
+ }
+
+ public Retry getListOffersRetry() {
+ return this.listOffersRetry;
+ }
+
+ public void setListOffersRetry(Retry listOffersRetry) {
+ this.listOffersRetry = listOffersRetry;
+ }
+
+ public Retry getListPurchasableSkusRetry() {
+ return this.listPurchasableSkusRetry;
+ }
+
+ public void setListPurchasableSkusRetry(Retry listPurchasableSkusRetry) {
+ this.listPurchasableSkusRetry = listPurchasableSkusRetry;
+ }
+
+ public Retry getListPurchasableOffersRetry() {
+ return this.listPurchasableOffersRetry;
+ }
+
+ public void setListPurchasableOffersRetry(Retry listPurchasableOffersRetry) {
+ this.listPurchasableOffersRetry = listPurchasableOffersRetry;
+ }
+
+ public Retry getRegisterSubscriberRetry() {
+ return this.registerSubscriberRetry;
+ }
+
+ public void setRegisterSubscriberRetry(Retry registerSubscriberRetry) {
+ this.registerSubscriberRetry = registerSubscriberRetry;
+ }
+
+ public Retry getUnregisterSubscriberRetry() {
+ return this.unregisterSubscriberRetry;
+ }
+
+ public void setUnregisterSubscriberRetry(Retry unregisterSubscriberRetry) {
+ this.unregisterSubscriberRetry = unregisterSubscriberRetry;
+ }
+
+ public Retry getListSubscribersRetry() {
+ return this.listSubscribersRetry;
+ }
+
+ public void setListSubscribersRetry(Retry listSubscribersRetry) {
+ this.listSubscribersRetry = listSubscribersRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/package-info.java
new file mode 100644
index 0000000000..8885f42071
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/java/com/google/cloud/channel/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudchannel. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.channel.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..034424ec4d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.channel.v1.cloud-channel-reports-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudchannel/CloudChannelReportsService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.channel.v1.cloud-channel-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudchannel/CloudChannelService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..cda2d2cd74
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-channel-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.channel.v1.spring.CloudChannelReportsServiceSpringAutoConfiguration
+com.google.cloud.channel.v1.spring.CloudChannelServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/pom.xml
new file mode 100644
index 0000000000..ee10115302
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ContactCenterInsightsSpringProperties. 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 ContactCenterInsightsSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ContactCenterInsightsSettings contactCenterInsightsSettings(
+ @Qualifier("defaultContactCenterInsightsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ContactCenterInsightsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ContactCenterInsightsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ContactCenterInsightsSettings.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 =
+ ContactCenterInsightsSettings.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 createConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createConversationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createConversationSettings()
+ .setRetrySettings(createConversationRetrySettings);
+
+ RetrySettings updateConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConversationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateConversationSettings()
+ .setRetrySettings(updateConversationRetrySettings);
+
+ RetrySettings getConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConversationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getConversationSettings()
+ .setRetrySettings(getConversationRetrySettings);
+
+ RetrySettings listConversationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConversationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listConversationsSettings()
+ .setRetrySettings(listConversationsRetrySettings);
+
+ RetrySettings deleteConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteConversationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteConversationSettings()
+ .setRetrySettings(deleteConversationRetrySettings);
+
+ RetrySettings getAnalysisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAnalysisSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getAnalysisSettings().setRetrySettings(getAnalysisRetrySettings);
+
+ RetrySettings listAnalysesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAnalysesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listAnalysesSettings().setRetrySettings(listAnalysesRetrySettings);
+
+ RetrySettings deleteAnalysisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAnalysisSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteAnalysisSettings().setRetrySettings(deleteAnalysisRetrySettings);
+
+ RetrySettings updateIssueModelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateIssueModelSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateIssueModelSettings()
+ .setRetrySettings(updateIssueModelRetrySettings);
+
+ RetrySettings getIssueModelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIssueModelSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIssueModelSettings().setRetrySettings(getIssueModelRetrySettings);
+
+ RetrySettings listIssueModelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listIssueModelsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listIssueModelsSettings()
+ .setRetrySettings(listIssueModelsRetrySettings);
+
+ RetrySettings getIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIssueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIssueSettings().setRetrySettings(getIssueRetrySettings);
+
+ RetrySettings listIssuesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listIssuesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listIssuesSettings().setRetrySettings(listIssuesRetrySettings);
+
+ RetrySettings updateIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateIssueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateIssueSettings().setRetrySettings(updateIssueRetrySettings);
+
+ RetrySettings deleteIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteIssueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteIssueSettings().setRetrySettings(deleteIssueRetrySettings);
+
+ RetrySettings calculateIssueModelStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.calculateIssueModelStatsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .calculateIssueModelStatsSettings()
+ .setRetrySettings(calculateIssueModelStatsRetrySettings);
+
+ RetrySettings createPhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPhraseMatcherSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createPhraseMatcherSettings()
+ .setRetrySettings(createPhraseMatcherRetrySettings);
+
+ RetrySettings getPhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPhraseMatcherSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getPhraseMatcherSettings()
+ .setRetrySettings(getPhraseMatcherRetrySettings);
+
+ RetrySettings listPhraseMatchersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPhraseMatchersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listPhraseMatchersSettings()
+ .setRetrySettings(listPhraseMatchersRetrySettings);
+
+ RetrySettings deletePhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePhraseMatcherSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deletePhraseMatcherSettings()
+ .setRetrySettings(deletePhraseMatcherRetrySettings);
+
+ RetrySettings updatePhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePhraseMatcherSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updatePhraseMatcherSettings()
+ .setRetrySettings(updatePhraseMatcherRetrySettings);
+
+ RetrySettings calculateStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.calculateStatsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.calculateStatsSettings().setRetrySettings(calculateStatsRetrySettings);
+
+ RetrySettings getSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSettingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getSettingsSettings().setRetrySettings(getSettingsRetrySettings);
+
+ RetrySettings updateSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSettingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateSettingsSettings().setRetrySettings(updateSettingsRetrySettings);
+
+ RetrySettings createViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createViewSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createViewSettings().setRetrySettings(createViewRetrySettings);
+
+ RetrySettings getViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getViewSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getViewSettings().setRetrySettings(getViewRetrySettings);
+
+ RetrySettings listViewsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listViewsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listViewsSettings().setRetrySettings(listViewsRetrySettings);
+
+ RetrySettings updateViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateViewSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateViewSettings().setRetrySettings(updateViewRetrySettings);
+
+ RetrySettings deleteViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteViewSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteViewSettings().setRetrySettings(deleteViewRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createConversationRetry = clientProperties.getCreateConversationRetry();
+ if (createConversationRetry != null) {
+ RetrySettings createConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createConversationSettings().getRetrySettings(),
+ createConversationRetry);
+ clientSettingsBuilder
+ .createConversationSettings()
+ .setRetrySettings(createConversationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createConversation from properties.");
+ }
+ }
+ Retry updateConversationRetry = clientProperties.getUpdateConversationRetry();
+ if (updateConversationRetry != null) {
+ RetrySettings updateConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConversationSettings().getRetrySettings(),
+ updateConversationRetry);
+ clientSettingsBuilder
+ .updateConversationSettings()
+ .setRetrySettings(updateConversationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateConversation from properties.");
+ }
+ }
+ Retry getConversationRetry = clientProperties.getGetConversationRetry();
+ if (getConversationRetry != null) {
+ RetrySettings getConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConversationSettings().getRetrySettings(),
+ getConversationRetry);
+ clientSettingsBuilder
+ .getConversationSettings()
+ .setRetrySettings(getConversationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getConversation from properties.");
+ }
+ }
+ Retry listConversationsRetry = clientProperties.getListConversationsRetry();
+ if (listConversationsRetry != null) {
+ RetrySettings listConversationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConversationsSettings().getRetrySettings(),
+ listConversationsRetry);
+ clientSettingsBuilder
+ .listConversationsSettings()
+ .setRetrySettings(listConversationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listConversations from properties.");
+ }
+ }
+ Retry deleteConversationRetry = clientProperties.getDeleteConversationRetry();
+ if (deleteConversationRetry != null) {
+ RetrySettings deleteConversationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteConversationSettings().getRetrySettings(),
+ deleteConversationRetry);
+ clientSettingsBuilder
+ .deleteConversationSettings()
+ .setRetrySettings(deleteConversationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteConversation from properties.");
+ }
+ }
+ Retry getAnalysisRetry = clientProperties.getGetAnalysisRetry();
+ if (getAnalysisRetry != null) {
+ RetrySettings getAnalysisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAnalysisSettings().getRetrySettings(), getAnalysisRetry);
+ clientSettingsBuilder.getAnalysisSettings().setRetrySettings(getAnalysisRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getAnalysis from properties.");
+ }
+ }
+ Retry listAnalysesRetry = clientProperties.getListAnalysesRetry();
+ if (listAnalysesRetry != null) {
+ RetrySettings listAnalysesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAnalysesSettings().getRetrySettings(), listAnalysesRetry);
+ clientSettingsBuilder.listAnalysesSettings().setRetrySettings(listAnalysesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listAnalyses from properties.");
+ }
+ }
+ Retry deleteAnalysisRetry = clientProperties.getDeleteAnalysisRetry();
+ if (deleteAnalysisRetry != null) {
+ RetrySettings deleteAnalysisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAnalysisSettings().getRetrySettings(),
+ deleteAnalysisRetry);
+ clientSettingsBuilder.deleteAnalysisSettings().setRetrySettings(deleteAnalysisRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteAnalysis from properties.");
+ }
+ }
+ Retry updateIssueModelRetry = clientProperties.getUpdateIssueModelRetry();
+ if (updateIssueModelRetry != null) {
+ RetrySettings updateIssueModelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateIssueModelSettings().getRetrySettings(),
+ updateIssueModelRetry);
+ clientSettingsBuilder
+ .updateIssueModelSettings()
+ .setRetrySettings(updateIssueModelRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateIssueModel from properties.");
+ }
+ }
+ Retry getIssueModelRetry = clientProperties.getGetIssueModelRetry();
+ if (getIssueModelRetry != null) {
+ RetrySettings getIssueModelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIssueModelSettings().getRetrySettings(), getIssueModelRetry);
+ clientSettingsBuilder.getIssueModelSettings().setRetrySettings(getIssueModelRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIssueModel from properties.");
+ }
+ }
+ Retry listIssueModelsRetry = clientProperties.getListIssueModelsRetry();
+ if (listIssueModelsRetry != null) {
+ RetrySettings listIssueModelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listIssueModelsSettings().getRetrySettings(),
+ listIssueModelsRetry);
+ clientSettingsBuilder
+ .listIssueModelsSettings()
+ .setRetrySettings(listIssueModelsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listIssueModels from properties.");
+ }
+ }
+ Retry getIssueRetry = clientProperties.getGetIssueRetry();
+ if (getIssueRetry != null) {
+ RetrySettings getIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIssueSettings().getRetrySettings(), getIssueRetry);
+ clientSettingsBuilder.getIssueSettings().setRetrySettings(getIssueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIssue from properties.");
+ }
+ }
+ Retry listIssuesRetry = clientProperties.getListIssuesRetry();
+ if (listIssuesRetry != null) {
+ RetrySettings listIssuesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listIssuesSettings().getRetrySettings(), listIssuesRetry);
+ clientSettingsBuilder.listIssuesSettings().setRetrySettings(listIssuesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listIssues from properties.");
+ }
+ }
+ Retry updateIssueRetry = clientProperties.getUpdateIssueRetry();
+ if (updateIssueRetry != null) {
+ RetrySettings updateIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateIssueSettings().getRetrySettings(), updateIssueRetry);
+ clientSettingsBuilder.updateIssueSettings().setRetrySettings(updateIssueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateIssue from properties.");
+ }
+ }
+ Retry deleteIssueRetry = clientProperties.getDeleteIssueRetry();
+ if (deleteIssueRetry != null) {
+ RetrySettings deleteIssueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteIssueSettings().getRetrySettings(), deleteIssueRetry);
+ clientSettingsBuilder.deleteIssueSettings().setRetrySettings(deleteIssueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteIssue from properties.");
+ }
+ }
+ Retry calculateIssueModelStatsRetry = clientProperties.getCalculateIssueModelStatsRetry();
+ if (calculateIssueModelStatsRetry != null) {
+ RetrySettings calculateIssueModelStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.calculateIssueModelStatsSettings().getRetrySettings(),
+ calculateIssueModelStatsRetry);
+ clientSettingsBuilder
+ .calculateIssueModelStatsSettings()
+ .setRetrySettings(calculateIssueModelStatsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for calculateIssueModelStats from properties.");
+ }
+ }
+ Retry createPhraseMatcherRetry = clientProperties.getCreatePhraseMatcherRetry();
+ if (createPhraseMatcherRetry != null) {
+ RetrySettings createPhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPhraseMatcherSettings().getRetrySettings(),
+ createPhraseMatcherRetry);
+ clientSettingsBuilder
+ .createPhraseMatcherSettings()
+ .setRetrySettings(createPhraseMatcherRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createPhraseMatcher from properties.");
+ }
+ }
+ Retry getPhraseMatcherRetry = clientProperties.getGetPhraseMatcherRetry();
+ if (getPhraseMatcherRetry != null) {
+ RetrySettings getPhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPhraseMatcherSettings().getRetrySettings(),
+ getPhraseMatcherRetry);
+ clientSettingsBuilder
+ .getPhraseMatcherSettings()
+ .setRetrySettings(getPhraseMatcherRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getPhraseMatcher from properties.");
+ }
+ }
+ Retry listPhraseMatchersRetry = clientProperties.getListPhraseMatchersRetry();
+ if (listPhraseMatchersRetry != null) {
+ RetrySettings listPhraseMatchersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPhraseMatchersSettings().getRetrySettings(),
+ listPhraseMatchersRetry);
+ clientSettingsBuilder
+ .listPhraseMatchersSettings()
+ .setRetrySettings(listPhraseMatchersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listPhraseMatchers from properties.");
+ }
+ }
+ Retry deletePhraseMatcherRetry = clientProperties.getDeletePhraseMatcherRetry();
+ if (deletePhraseMatcherRetry != null) {
+ RetrySettings deletePhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePhraseMatcherSettings().getRetrySettings(),
+ deletePhraseMatcherRetry);
+ clientSettingsBuilder
+ .deletePhraseMatcherSettings()
+ .setRetrySettings(deletePhraseMatcherRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deletePhraseMatcher from properties.");
+ }
+ }
+ Retry updatePhraseMatcherRetry = clientProperties.getUpdatePhraseMatcherRetry();
+ if (updatePhraseMatcherRetry != null) {
+ RetrySettings updatePhraseMatcherRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePhraseMatcherSettings().getRetrySettings(),
+ updatePhraseMatcherRetry);
+ clientSettingsBuilder
+ .updatePhraseMatcherSettings()
+ .setRetrySettings(updatePhraseMatcherRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updatePhraseMatcher from properties.");
+ }
+ }
+ Retry calculateStatsRetry = clientProperties.getCalculateStatsRetry();
+ if (calculateStatsRetry != null) {
+ RetrySettings calculateStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.calculateStatsSettings().getRetrySettings(),
+ calculateStatsRetry);
+ clientSettingsBuilder.calculateStatsSettings().setRetrySettings(calculateStatsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for calculateStats from properties.");
+ }
+ }
+ Retry getSettingsRetry = clientProperties.getGetSettingsRetry();
+ if (getSettingsRetry != null) {
+ RetrySettings getSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSettingsSettings().getRetrySettings(), getSettingsRetry);
+ clientSettingsBuilder.getSettingsSettings().setRetrySettings(getSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSettings from properties.");
+ }
+ }
+ Retry updateSettingsRetry = clientProperties.getUpdateSettingsRetry();
+ if (updateSettingsRetry != null) {
+ RetrySettings updateSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSettingsSettings().getRetrySettings(),
+ updateSettingsRetry);
+ clientSettingsBuilder.updateSettingsSettings().setRetrySettings(updateSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateSettings from properties.");
+ }
+ }
+ Retry createViewRetry = clientProperties.getCreateViewRetry();
+ if (createViewRetry != null) {
+ RetrySettings createViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createViewSettings().getRetrySettings(), createViewRetry);
+ clientSettingsBuilder.createViewSettings().setRetrySettings(createViewRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createView from properties.");
+ }
+ }
+ Retry getViewRetry = clientProperties.getGetViewRetry();
+ if (getViewRetry != null) {
+ RetrySettings getViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getViewSettings().getRetrySettings(), getViewRetry);
+ clientSettingsBuilder.getViewSettings().setRetrySettings(getViewRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getView from properties.");
+ }
+ }
+ Retry listViewsRetry = clientProperties.getListViewsRetry();
+ if (listViewsRetry != null) {
+ RetrySettings listViewsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listViewsSettings().getRetrySettings(), listViewsRetry);
+ clientSettingsBuilder.listViewsSettings().setRetrySettings(listViewsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listViews from properties.");
+ }
+ }
+ Retry updateViewRetry = clientProperties.getUpdateViewRetry();
+ if (updateViewRetry != null) {
+ RetrySettings updateViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateViewSettings().getRetrySettings(), updateViewRetry);
+ clientSettingsBuilder.updateViewSettings().setRetrySettings(updateViewRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateView from properties.");
+ }
+ }
+ Retry deleteViewRetry = clientProperties.getDeleteViewRetry();
+ if (deleteViewRetry != null) {
+ RetrySettings deleteViewRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteViewSettings().getRetrySettings(), deleteViewRetry);
+ clientSettingsBuilder.deleteViewSettings().setRetrySettings(deleteViewRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteView from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ContactCenterInsightsClient bean configured with ContactCenterInsightsSettings.
+ *
+ * @param contactCenterInsightsSettings settings to configure an instance of client bean.
+ * @return a {@link ContactCenterInsightsClient} bean configured with {@link
+ * ContactCenterInsightsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ContactCenterInsightsClient contactCenterInsightsClient(
+ ContactCenterInsightsSettings contactCenterInsightsSettings) throws IOException {
+ return ContactCenterInsightsClient.create(contactCenterInsightsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-contact-center-insights";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java
new file mode 100644
index 0000000000..ec92f68f97
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright 2022 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.contactcenterinsights.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 ContactCenterInsights client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.contactcenterinsights.v1.contact-center-insights")
+public class ContactCenterInsightsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createConversation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createConversationRetry;
+ /**
+ * Allow override of retry settings at method-level for updateConversation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateConversationRetry;
+ /**
+ * Allow override of retry settings at method-level for getConversation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConversationRetry;
+ /**
+ * Allow override of retry settings at method-level for listConversations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConversationsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteConversation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteConversationRetry;
+ /**
+ * Allow override of retry settings at method-level for getAnalysis. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAnalysisRetry;
+ /**
+ * Allow override of retry settings at method-level for listAnalyses. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAnalysesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteAnalysis. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteAnalysisRetry;
+ /**
+ * Allow override of retry settings at method-level for updateIssueModel. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateIssueModelRetry;
+ /**
+ * Allow override of retry settings at method-level for getIssueModel. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIssueModelRetry;
+ /**
+ * Allow override of retry settings at method-level for listIssueModels. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listIssueModelsRetry;
+ /**
+ * Allow override of retry settings at method-level for getIssue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIssueRetry;
+ /**
+ * Allow override of retry settings at method-level for listIssues. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listIssuesRetry;
+ /**
+ * Allow override of retry settings at method-level for updateIssue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateIssueRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteIssue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteIssueRetry;
+ /**
+ * Allow override of retry settings at method-level for calculateIssueModelStats. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry calculateIssueModelStatsRetry;
+ /**
+ * Allow override of retry settings at method-level for createPhraseMatcher. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createPhraseMatcherRetry;
+ /**
+ * Allow override of retry settings at method-level for getPhraseMatcher. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPhraseMatcherRetry;
+ /**
+ * Allow override of retry settings at method-level for listPhraseMatchers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPhraseMatchersRetry;
+ /**
+ * Allow override of retry settings at method-level for deletePhraseMatcher. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deletePhraseMatcherRetry;
+ /**
+ * Allow override of retry settings at method-level for updatePhraseMatcher. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updatePhraseMatcherRetry;
+ /**
+ * Allow override of retry settings at method-level for calculateStats. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry calculateStatsRetry;
+ /**
+ * Allow override of retry settings at method-level for getSettings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSettings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for createView. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createViewRetry;
+ /**
+ * Allow override of retry settings at method-level for getView. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getViewRetry;
+ /**
+ * Allow override of retry settings at method-level for listViews. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listViewsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateView. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateViewRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteView. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteViewRetry;
+
+ @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 getCreateConversationRetry() {
+ return this.createConversationRetry;
+ }
+
+ public void setCreateConversationRetry(Retry createConversationRetry) {
+ this.createConversationRetry = createConversationRetry;
+ }
+
+ public Retry getUpdateConversationRetry() {
+ return this.updateConversationRetry;
+ }
+
+ public void setUpdateConversationRetry(Retry updateConversationRetry) {
+ this.updateConversationRetry = updateConversationRetry;
+ }
+
+ public Retry getGetConversationRetry() {
+ return this.getConversationRetry;
+ }
+
+ public void setGetConversationRetry(Retry getConversationRetry) {
+ this.getConversationRetry = getConversationRetry;
+ }
+
+ public Retry getListConversationsRetry() {
+ return this.listConversationsRetry;
+ }
+
+ public void setListConversationsRetry(Retry listConversationsRetry) {
+ this.listConversationsRetry = listConversationsRetry;
+ }
+
+ public Retry getDeleteConversationRetry() {
+ return this.deleteConversationRetry;
+ }
+
+ public void setDeleteConversationRetry(Retry deleteConversationRetry) {
+ this.deleteConversationRetry = deleteConversationRetry;
+ }
+
+ public Retry getGetAnalysisRetry() {
+ return this.getAnalysisRetry;
+ }
+
+ public void setGetAnalysisRetry(Retry getAnalysisRetry) {
+ this.getAnalysisRetry = getAnalysisRetry;
+ }
+
+ public Retry getListAnalysesRetry() {
+ return this.listAnalysesRetry;
+ }
+
+ public void setListAnalysesRetry(Retry listAnalysesRetry) {
+ this.listAnalysesRetry = listAnalysesRetry;
+ }
+
+ public Retry getDeleteAnalysisRetry() {
+ return this.deleteAnalysisRetry;
+ }
+
+ public void setDeleteAnalysisRetry(Retry deleteAnalysisRetry) {
+ this.deleteAnalysisRetry = deleteAnalysisRetry;
+ }
+
+ public Retry getUpdateIssueModelRetry() {
+ return this.updateIssueModelRetry;
+ }
+
+ public void setUpdateIssueModelRetry(Retry updateIssueModelRetry) {
+ this.updateIssueModelRetry = updateIssueModelRetry;
+ }
+
+ public Retry getGetIssueModelRetry() {
+ return this.getIssueModelRetry;
+ }
+
+ public void setGetIssueModelRetry(Retry getIssueModelRetry) {
+ this.getIssueModelRetry = getIssueModelRetry;
+ }
+
+ public Retry getListIssueModelsRetry() {
+ return this.listIssueModelsRetry;
+ }
+
+ public void setListIssueModelsRetry(Retry listIssueModelsRetry) {
+ this.listIssueModelsRetry = listIssueModelsRetry;
+ }
+
+ public Retry getGetIssueRetry() {
+ return this.getIssueRetry;
+ }
+
+ public void setGetIssueRetry(Retry getIssueRetry) {
+ this.getIssueRetry = getIssueRetry;
+ }
+
+ public Retry getListIssuesRetry() {
+ return this.listIssuesRetry;
+ }
+
+ public void setListIssuesRetry(Retry listIssuesRetry) {
+ this.listIssuesRetry = listIssuesRetry;
+ }
+
+ public Retry getUpdateIssueRetry() {
+ return this.updateIssueRetry;
+ }
+
+ public void setUpdateIssueRetry(Retry updateIssueRetry) {
+ this.updateIssueRetry = updateIssueRetry;
+ }
+
+ public Retry getDeleteIssueRetry() {
+ return this.deleteIssueRetry;
+ }
+
+ public void setDeleteIssueRetry(Retry deleteIssueRetry) {
+ this.deleteIssueRetry = deleteIssueRetry;
+ }
+
+ public Retry getCalculateIssueModelStatsRetry() {
+ return this.calculateIssueModelStatsRetry;
+ }
+
+ public void setCalculateIssueModelStatsRetry(Retry calculateIssueModelStatsRetry) {
+ this.calculateIssueModelStatsRetry = calculateIssueModelStatsRetry;
+ }
+
+ public Retry getCreatePhraseMatcherRetry() {
+ return this.createPhraseMatcherRetry;
+ }
+
+ public void setCreatePhraseMatcherRetry(Retry createPhraseMatcherRetry) {
+ this.createPhraseMatcherRetry = createPhraseMatcherRetry;
+ }
+
+ public Retry getGetPhraseMatcherRetry() {
+ return this.getPhraseMatcherRetry;
+ }
+
+ public void setGetPhraseMatcherRetry(Retry getPhraseMatcherRetry) {
+ this.getPhraseMatcherRetry = getPhraseMatcherRetry;
+ }
+
+ public Retry getListPhraseMatchersRetry() {
+ return this.listPhraseMatchersRetry;
+ }
+
+ public void setListPhraseMatchersRetry(Retry listPhraseMatchersRetry) {
+ this.listPhraseMatchersRetry = listPhraseMatchersRetry;
+ }
+
+ public Retry getDeletePhraseMatcherRetry() {
+ return this.deletePhraseMatcherRetry;
+ }
+
+ public void setDeletePhraseMatcherRetry(Retry deletePhraseMatcherRetry) {
+ this.deletePhraseMatcherRetry = deletePhraseMatcherRetry;
+ }
+
+ public Retry getUpdatePhraseMatcherRetry() {
+ return this.updatePhraseMatcherRetry;
+ }
+
+ public void setUpdatePhraseMatcherRetry(Retry updatePhraseMatcherRetry) {
+ this.updatePhraseMatcherRetry = updatePhraseMatcherRetry;
+ }
+
+ public Retry getCalculateStatsRetry() {
+ return this.calculateStatsRetry;
+ }
+
+ public void setCalculateStatsRetry(Retry calculateStatsRetry) {
+ this.calculateStatsRetry = calculateStatsRetry;
+ }
+
+ public Retry getGetSettingsRetry() {
+ return this.getSettingsRetry;
+ }
+
+ public void setGetSettingsRetry(Retry getSettingsRetry) {
+ this.getSettingsRetry = getSettingsRetry;
+ }
+
+ public Retry getUpdateSettingsRetry() {
+ return this.updateSettingsRetry;
+ }
+
+ public void setUpdateSettingsRetry(Retry updateSettingsRetry) {
+ this.updateSettingsRetry = updateSettingsRetry;
+ }
+
+ public Retry getCreateViewRetry() {
+ return this.createViewRetry;
+ }
+
+ public void setCreateViewRetry(Retry createViewRetry) {
+ this.createViewRetry = createViewRetry;
+ }
+
+ public Retry getGetViewRetry() {
+ return this.getViewRetry;
+ }
+
+ public void setGetViewRetry(Retry getViewRetry) {
+ this.getViewRetry = getViewRetry;
+ }
+
+ public Retry getListViewsRetry() {
+ return this.listViewsRetry;
+ }
+
+ public void setListViewsRetry(Retry listViewsRetry) {
+ this.listViewsRetry = listViewsRetry;
+ }
+
+ public Retry getUpdateViewRetry() {
+ return this.updateViewRetry;
+ }
+
+ public void setUpdateViewRetry(Retry updateViewRetry) {
+ this.updateViewRetry = updateViewRetry;
+ }
+
+ public Retry getDeleteViewRetry() {
+ return this.deleteViewRetry;
+ }
+
+ public void setDeleteViewRetry(Retry deleteViewRetry) {
+ this.deleteViewRetry = deleteViewRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/package-info.java
new file mode 100644
index 0000000000..f1f52b83b1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for contactcenterinsights. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.contactcenterinsights.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..904dc41760
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.contactcenterinsights.v1.contact-center-insights.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud contactcenterinsights/ContactCenterInsights components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..44db933e60
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.contactcenterinsights.v1.spring.ContactCenterInsightsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-container-spring-starter/pom.xml
new file mode 100644
index 0000000000..e4cd371f92
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-container-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ClusterManagerSpringProperties. 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 ClusterManagerSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ClusterManagerSettings clusterManagerSettings(
+ @Qualifier("defaultClusterManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ClusterManagerSettings.Builder clientSettingsBuilder = ClusterManagerSettings.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 =
+ ClusterManagerSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings listClustersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listClustersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings);
+
+ RetrySettings getClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getClusterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings);
+
+ RetrySettings createClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createClusterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createClusterSettings().setRetrySettings(createClusterRetrySettings);
+
+ RetrySettings updateClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateClusterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateClusterSettings().setRetrySettings(updateClusterRetrySettings);
+
+ RetrySettings updateNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNodePoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateNodePoolSettings().setRetrySettings(updateNodePoolRetrySettings);
+
+ RetrySettings setNodePoolAutoscalingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolAutoscalingSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .setNodePoolAutoscalingSettings()
+ .setRetrySettings(setNodePoolAutoscalingRetrySettings);
+
+ RetrySettings setLoggingServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLoggingServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .setLoggingServiceSettings()
+ .setRetrySettings(setLoggingServiceRetrySettings);
+
+ RetrySettings setMonitoringServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMonitoringServiceSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .setMonitoringServiceSettings()
+ .setRetrySettings(setMonitoringServiceRetrySettings);
+
+ RetrySettings setAddonsConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setAddonsConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .setAddonsConfigSettings()
+ .setRetrySettings(setAddonsConfigRetrySettings);
+
+ RetrySettings setLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setLocationsSettings().setRetrySettings(setLocationsRetrySettings);
+
+ RetrySettings updateMasterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateMasterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateMasterSettings().setRetrySettings(updateMasterRetrySettings);
+
+ RetrySettings setMasterAuthRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMasterAuthSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setMasterAuthSettings().setRetrySettings(setMasterAuthRetrySettings);
+
+ RetrySettings deleteClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteClusterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteClusterSettings().setRetrySettings(deleteClusterRetrySettings);
+
+ RetrySettings listOperationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOperationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listOperationsSettings().setRetrySettings(listOperationsRetrySettings);
+
+ RetrySettings getOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOperationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getOperationSettings().setRetrySettings(getOperationRetrySettings);
+
+ RetrySettings cancelOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelOperationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .cancelOperationSettings()
+ .setRetrySettings(cancelOperationRetrySettings);
+
+ RetrySettings getServerConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServerConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getServerConfigSettings()
+ .setRetrySettings(getServerConfigRetrySettings);
+
+ RetrySettings getJSONWebKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJSONWebKeysSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJSONWebKeysSettings().setRetrySettings(getJSONWebKeysRetrySettings);
+
+ RetrySettings listNodePoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNodePoolsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listNodePoolsSettings().setRetrySettings(listNodePoolsRetrySettings);
+
+ RetrySettings getNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNodePoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getNodePoolSettings().setRetrySettings(getNodePoolRetrySettings);
+
+ RetrySettings createNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNodePoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createNodePoolSettings().setRetrySettings(createNodePoolRetrySettings);
+
+ RetrySettings deleteNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNodePoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteNodePoolSettings().setRetrySettings(deleteNodePoolRetrySettings);
+
+ RetrySettings completeNodePoolUpgradeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeNodePoolUpgradeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .completeNodePoolUpgradeSettings()
+ .setRetrySettings(completeNodePoolUpgradeRetrySettings);
+
+ RetrySettings rollbackNodePoolUpgradeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.rollbackNodePoolUpgradeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .rollbackNodePoolUpgradeSettings()
+ .setRetrySettings(rollbackNodePoolUpgradeRetrySettings);
+
+ RetrySettings setNodePoolManagementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolManagementSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .setNodePoolManagementSettings()
+ .setRetrySettings(setNodePoolManagementRetrySettings);
+
+ RetrySettings setLabelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLabelsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setLabelsSettings().setRetrySettings(setLabelsRetrySettings);
+
+ RetrySettings setLegacyAbacRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLegacyAbacSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setLegacyAbacSettings().setRetrySettings(setLegacyAbacRetrySettings);
+
+ RetrySettings startIPRotationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startIPRotationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .startIPRotationSettings()
+ .setRetrySettings(startIPRotationRetrySettings);
+
+ RetrySettings completeIPRotationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeIPRotationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .completeIPRotationSettings()
+ .setRetrySettings(completeIPRotationRetrySettings);
+
+ RetrySettings setNodePoolSizeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolSizeSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .setNodePoolSizeSettings()
+ .setRetrySettings(setNodePoolSizeRetrySettings);
+
+ RetrySettings setNetworkPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNetworkPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .setNetworkPolicySettings()
+ .setRetrySettings(setNetworkPolicyRetrySettings);
+
+ RetrySettings setMaintenancePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMaintenancePolicySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .setMaintenancePolicySettings()
+ .setRetrySettings(setMaintenancePolicyRetrySettings);
+
+ RetrySettings listUsableSubnetworksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listUsableSubnetworksSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listUsableSubnetworksSettings()
+ .setRetrySettings(listUsableSubnetworksRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listClustersRetry = clientProperties.getListClustersRetry();
+ if (listClustersRetry != null) {
+ RetrySettings listClustersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listClustersSettings().getRetrySettings(), listClustersRetry);
+ clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listClusters from properties.");
+ }
+ }
+ Retry getClusterRetry = clientProperties.getGetClusterRetry();
+ if (getClusterRetry != null) {
+ RetrySettings getClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getClusterSettings().getRetrySettings(), getClusterRetry);
+ clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCluster from properties.");
+ }
+ }
+ Retry createClusterRetry = clientProperties.getCreateClusterRetry();
+ if (createClusterRetry != null) {
+ RetrySettings createClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createClusterSettings().getRetrySettings(), createClusterRetry);
+ clientSettingsBuilder.createClusterSettings().setRetrySettings(createClusterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createCluster from properties.");
+ }
+ }
+ Retry updateClusterRetry = clientProperties.getUpdateClusterRetry();
+ if (updateClusterRetry != null) {
+ RetrySettings updateClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateClusterSettings().getRetrySettings(), updateClusterRetry);
+ clientSettingsBuilder.updateClusterSettings().setRetrySettings(updateClusterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateCluster from properties.");
+ }
+ }
+ Retry updateNodePoolRetry = clientProperties.getUpdateNodePoolRetry();
+ if (updateNodePoolRetry != null) {
+ RetrySettings updateNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNodePoolSettings().getRetrySettings(),
+ updateNodePoolRetry);
+ clientSettingsBuilder.updateNodePoolSettings().setRetrySettings(updateNodePoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateNodePool from properties.");
+ }
+ }
+ Retry setNodePoolAutoscalingRetry = clientProperties.getSetNodePoolAutoscalingRetry();
+ if (setNodePoolAutoscalingRetry != null) {
+ RetrySettings setNodePoolAutoscalingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolAutoscalingSettings().getRetrySettings(),
+ setNodePoolAutoscalingRetry);
+ clientSettingsBuilder
+ .setNodePoolAutoscalingSettings()
+ .setRetrySettings(setNodePoolAutoscalingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setNodePoolAutoscaling from properties.");
+ }
+ }
+ Retry setLoggingServiceRetry = clientProperties.getSetLoggingServiceRetry();
+ if (setLoggingServiceRetry != null) {
+ RetrySettings setLoggingServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLoggingServiceSettings().getRetrySettings(),
+ setLoggingServiceRetry);
+ clientSettingsBuilder
+ .setLoggingServiceSettings()
+ .setRetrySettings(setLoggingServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setLoggingService from properties.");
+ }
+ }
+ Retry setMonitoringServiceRetry = clientProperties.getSetMonitoringServiceRetry();
+ if (setMonitoringServiceRetry != null) {
+ RetrySettings setMonitoringServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMonitoringServiceSettings().getRetrySettings(),
+ setMonitoringServiceRetry);
+ clientSettingsBuilder
+ .setMonitoringServiceSettings()
+ .setRetrySettings(setMonitoringServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setMonitoringService from properties.");
+ }
+ }
+ Retry setAddonsConfigRetry = clientProperties.getSetAddonsConfigRetry();
+ if (setAddonsConfigRetry != null) {
+ RetrySettings setAddonsConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setAddonsConfigSettings().getRetrySettings(),
+ setAddonsConfigRetry);
+ clientSettingsBuilder
+ .setAddonsConfigSettings()
+ .setRetrySettings(setAddonsConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setAddonsConfig from properties.");
+ }
+ }
+ Retry setLocationsRetry = clientProperties.getSetLocationsRetry();
+ if (setLocationsRetry != null) {
+ RetrySettings setLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLocationsSettings().getRetrySettings(), setLocationsRetry);
+ clientSettingsBuilder.setLocationsSettings().setRetrySettings(setLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setLocations from properties.");
+ }
+ }
+ Retry updateMasterRetry = clientProperties.getUpdateMasterRetry();
+ if (updateMasterRetry != null) {
+ RetrySettings updateMasterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateMasterSettings().getRetrySettings(), updateMasterRetry);
+ clientSettingsBuilder.updateMasterSettings().setRetrySettings(updateMasterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateMaster from properties.");
+ }
+ }
+ Retry setMasterAuthRetry = clientProperties.getSetMasterAuthRetry();
+ if (setMasterAuthRetry != null) {
+ RetrySettings setMasterAuthRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMasterAuthSettings().getRetrySettings(), setMasterAuthRetry);
+ clientSettingsBuilder.setMasterAuthSettings().setRetrySettings(setMasterAuthRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setMasterAuth from properties.");
+ }
+ }
+ Retry deleteClusterRetry = clientProperties.getDeleteClusterRetry();
+ if (deleteClusterRetry != null) {
+ RetrySettings deleteClusterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteClusterSettings().getRetrySettings(), deleteClusterRetry);
+ clientSettingsBuilder.deleteClusterSettings().setRetrySettings(deleteClusterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteCluster from properties.");
+ }
+ }
+ Retry listOperationsRetry = clientProperties.getListOperationsRetry();
+ if (listOperationsRetry != null) {
+ RetrySettings listOperationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOperationsSettings().getRetrySettings(),
+ listOperationsRetry);
+ clientSettingsBuilder.listOperationsSettings().setRetrySettings(listOperationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listOperations from properties.");
+ }
+ }
+ Retry getOperationRetry = clientProperties.getGetOperationRetry();
+ if (getOperationRetry != null) {
+ RetrySettings getOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOperationSettings().getRetrySettings(), getOperationRetry);
+ clientSettingsBuilder.getOperationSettings().setRetrySettings(getOperationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getOperation from properties.");
+ }
+ }
+ Retry cancelOperationRetry = clientProperties.getCancelOperationRetry();
+ if (cancelOperationRetry != null) {
+ RetrySettings cancelOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelOperationSettings().getRetrySettings(),
+ cancelOperationRetry);
+ clientSettingsBuilder
+ .cancelOperationSettings()
+ .setRetrySettings(cancelOperationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for cancelOperation from properties.");
+ }
+ }
+ Retry getServerConfigRetry = clientProperties.getGetServerConfigRetry();
+ if (getServerConfigRetry != null) {
+ RetrySettings getServerConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServerConfigSettings().getRetrySettings(),
+ getServerConfigRetry);
+ clientSettingsBuilder
+ .getServerConfigSettings()
+ .setRetrySettings(getServerConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getServerConfig from properties.");
+ }
+ }
+ Retry getJSONWebKeysRetry = clientProperties.getGetJSONWebKeysRetry();
+ if (getJSONWebKeysRetry != null) {
+ RetrySettings getJSONWebKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJSONWebKeysSettings().getRetrySettings(),
+ getJSONWebKeysRetry);
+ clientSettingsBuilder.getJSONWebKeysSettings().setRetrySettings(getJSONWebKeysRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJSONWebKeys from properties.");
+ }
+ }
+ Retry listNodePoolsRetry = clientProperties.getListNodePoolsRetry();
+ if (listNodePoolsRetry != null) {
+ RetrySettings listNodePoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNodePoolsSettings().getRetrySettings(), listNodePoolsRetry);
+ clientSettingsBuilder.listNodePoolsSettings().setRetrySettings(listNodePoolsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listNodePools from properties.");
+ }
+ }
+ Retry getNodePoolRetry = clientProperties.getGetNodePoolRetry();
+ if (getNodePoolRetry != null) {
+ RetrySettings getNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNodePoolSettings().getRetrySettings(), getNodePoolRetry);
+ clientSettingsBuilder.getNodePoolSettings().setRetrySettings(getNodePoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getNodePool from properties.");
+ }
+ }
+ Retry createNodePoolRetry = clientProperties.getCreateNodePoolRetry();
+ if (createNodePoolRetry != null) {
+ RetrySettings createNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNodePoolSettings().getRetrySettings(),
+ createNodePoolRetry);
+ clientSettingsBuilder.createNodePoolSettings().setRetrySettings(createNodePoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createNodePool from properties.");
+ }
+ }
+ Retry deleteNodePoolRetry = clientProperties.getDeleteNodePoolRetry();
+ if (deleteNodePoolRetry != null) {
+ RetrySettings deleteNodePoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNodePoolSettings().getRetrySettings(),
+ deleteNodePoolRetry);
+ clientSettingsBuilder.deleteNodePoolSettings().setRetrySettings(deleteNodePoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteNodePool from properties.");
+ }
+ }
+ Retry completeNodePoolUpgradeRetry = clientProperties.getCompleteNodePoolUpgradeRetry();
+ if (completeNodePoolUpgradeRetry != null) {
+ RetrySettings completeNodePoolUpgradeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeNodePoolUpgradeSettings().getRetrySettings(),
+ completeNodePoolUpgradeRetry);
+ clientSettingsBuilder
+ .completeNodePoolUpgradeSettings()
+ .setRetrySettings(completeNodePoolUpgradeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for completeNodePoolUpgrade from properties.");
+ }
+ }
+ Retry rollbackNodePoolUpgradeRetry = clientProperties.getRollbackNodePoolUpgradeRetry();
+ if (rollbackNodePoolUpgradeRetry != null) {
+ RetrySettings rollbackNodePoolUpgradeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.rollbackNodePoolUpgradeSettings().getRetrySettings(),
+ rollbackNodePoolUpgradeRetry);
+ clientSettingsBuilder
+ .rollbackNodePoolUpgradeSettings()
+ .setRetrySettings(rollbackNodePoolUpgradeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for rollbackNodePoolUpgrade from properties.");
+ }
+ }
+ Retry setNodePoolManagementRetry = clientProperties.getSetNodePoolManagementRetry();
+ if (setNodePoolManagementRetry != null) {
+ RetrySettings setNodePoolManagementRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolManagementSettings().getRetrySettings(),
+ setNodePoolManagementRetry);
+ clientSettingsBuilder
+ .setNodePoolManagementSettings()
+ .setRetrySettings(setNodePoolManagementRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setNodePoolManagement from properties.");
+ }
+ }
+ Retry setLabelsRetry = clientProperties.getSetLabelsRetry();
+ if (setLabelsRetry != null) {
+ RetrySettings setLabelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLabelsSettings().getRetrySettings(), setLabelsRetry);
+ clientSettingsBuilder.setLabelsSettings().setRetrySettings(setLabelsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setLabels from properties.");
+ }
+ }
+ Retry setLegacyAbacRetry = clientProperties.getSetLegacyAbacRetry();
+ if (setLegacyAbacRetry != null) {
+ RetrySettings setLegacyAbacRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setLegacyAbacSettings().getRetrySettings(), setLegacyAbacRetry);
+ clientSettingsBuilder.setLegacyAbacSettings().setRetrySettings(setLegacyAbacRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setLegacyAbac from properties.");
+ }
+ }
+ Retry startIPRotationRetry = clientProperties.getStartIPRotationRetry();
+ if (startIPRotationRetry != null) {
+ RetrySettings startIPRotationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startIPRotationSettings().getRetrySettings(),
+ startIPRotationRetry);
+ clientSettingsBuilder
+ .startIPRotationSettings()
+ .setRetrySettings(startIPRotationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for startIPRotation from properties.");
+ }
+ }
+ Retry completeIPRotationRetry = clientProperties.getCompleteIPRotationRetry();
+ if (completeIPRotationRetry != null) {
+ RetrySettings completeIPRotationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.completeIPRotationSettings().getRetrySettings(),
+ completeIPRotationRetry);
+ clientSettingsBuilder
+ .completeIPRotationSettings()
+ .setRetrySettings(completeIPRotationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for completeIPRotation from properties.");
+ }
+ }
+ Retry setNodePoolSizeRetry = clientProperties.getSetNodePoolSizeRetry();
+ if (setNodePoolSizeRetry != null) {
+ RetrySettings setNodePoolSizeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNodePoolSizeSettings().getRetrySettings(),
+ setNodePoolSizeRetry);
+ clientSettingsBuilder
+ .setNodePoolSizeSettings()
+ .setRetrySettings(setNodePoolSizeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setNodePoolSize from properties.");
+ }
+ }
+ Retry setNetworkPolicyRetry = clientProperties.getSetNetworkPolicyRetry();
+ if (setNetworkPolicyRetry != null) {
+ RetrySettings setNetworkPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setNetworkPolicySettings().getRetrySettings(),
+ setNetworkPolicyRetry);
+ clientSettingsBuilder
+ .setNetworkPolicySettings()
+ .setRetrySettings(setNetworkPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setNetworkPolicy from properties.");
+ }
+ }
+ Retry setMaintenancePolicyRetry = clientProperties.getSetMaintenancePolicyRetry();
+ if (setMaintenancePolicyRetry != null) {
+ RetrySettings setMaintenancePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMaintenancePolicySettings().getRetrySettings(),
+ setMaintenancePolicyRetry);
+ clientSettingsBuilder
+ .setMaintenancePolicySettings()
+ .setRetrySettings(setMaintenancePolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for setMaintenancePolicy from properties.");
+ }
+ }
+ Retry listUsableSubnetworksRetry = clientProperties.getListUsableSubnetworksRetry();
+ if (listUsableSubnetworksRetry != null) {
+ RetrySettings listUsableSubnetworksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listUsableSubnetworksSettings().getRetrySettings(),
+ listUsableSubnetworksRetry);
+ clientSettingsBuilder
+ .listUsableSubnetworksSettings()
+ .setRetrySettings(listUsableSubnetworksRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listUsableSubnetworks from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ClusterManagerClient bean configured with ClusterManagerSettings.
+ *
+ * @param clusterManagerSettings settings to configure an instance of client bean.
+ * @return a {@link ClusterManagerClient} bean configured with {@link ClusterManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ClusterManagerClient clusterManagerClient(ClusterManagerSettings clusterManagerSettings)
+ throws IOException {
+ return ClusterManagerClient.create(clusterManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cluster-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java
new file mode 100644
index 0000000000..aa3d23bcf1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/ClusterManagerSpringProperties.java
@@ -0,0 +1,501 @@
+/*
+ * Copyright 2022 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.container.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 ClusterManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.container.v1.cluster-manager")
+public class ClusterManagerSpringProperties 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 listClusters. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listClustersRetry;
+ /**
+ * Allow override of retry settings at method-level for getCluster. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getClusterRetry;
+ /**
+ * Allow override of retry settings at method-level for createCluster. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createClusterRetry;
+ /**
+ * Allow override of retry settings at method-level for updateCluster. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateClusterRetry;
+ /**
+ * Allow override of retry settings at method-level for updateNodePool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateNodePoolRetry;
+ /**
+ * Allow override of retry settings at method-level for setNodePoolAutoscaling. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setNodePoolAutoscalingRetry;
+ /**
+ * Allow override of retry settings at method-level for setLoggingService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setLoggingServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for setMonitoringService. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setMonitoringServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for setAddonsConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setAddonsConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for setLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateMaster. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateMasterRetry;
+ /**
+ * Allow override of retry settings at method-level for setMasterAuth. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setMasterAuthRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteCluster. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteClusterRetry;
+ /**
+ * Allow override of retry settings at method-level for listOperations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOperationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getOperation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getOperationRetry;
+ /**
+ * Allow override of retry settings at method-level for cancelOperation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry cancelOperationRetry;
+ /**
+ * Allow override of retry settings at method-level for getServerConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServerConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getJSONWebKeys. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJSONWebKeysRetry;
+ /**
+ * Allow override of retry settings at method-level for listNodePools. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listNodePoolsRetry;
+ /**
+ * Allow override of retry settings at method-level for getNodePool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getNodePoolRetry;
+ /**
+ * Allow override of retry settings at method-level for createNodePool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createNodePoolRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteNodePool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteNodePoolRetry;
+ /**
+ * Allow override of retry settings at method-level for completeNodePoolUpgrade. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry completeNodePoolUpgradeRetry;
+ /**
+ * Allow override of retry settings at method-level for rollbackNodePoolUpgrade. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry rollbackNodePoolUpgradeRetry;
+ /**
+ * Allow override of retry settings at method-level for setNodePoolManagement. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setNodePoolManagementRetry;
+ /**
+ * Allow override of retry settings at method-level for setLabels. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setLabelsRetry;
+ /**
+ * Allow override of retry settings at method-level for setLegacyAbac. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setLegacyAbacRetry;
+ /**
+ * Allow override of retry settings at method-level for startIPRotation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry startIPRotationRetry;
+ /**
+ * Allow override of retry settings at method-level for completeIPRotation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry completeIPRotationRetry;
+ /**
+ * Allow override of retry settings at method-level for setNodePoolSize. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setNodePoolSizeRetry;
+ /**
+ * Allow override of retry settings at method-level for setNetworkPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setNetworkPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setMaintenancePolicy. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setMaintenancePolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for listUsableSubnetworks. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listUsableSubnetworksRetry;
+
+ @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 getListClustersRetry() {
+ return this.listClustersRetry;
+ }
+
+ public void setListClustersRetry(Retry listClustersRetry) {
+ this.listClustersRetry = listClustersRetry;
+ }
+
+ public Retry getGetClusterRetry() {
+ return this.getClusterRetry;
+ }
+
+ public void setGetClusterRetry(Retry getClusterRetry) {
+ this.getClusterRetry = getClusterRetry;
+ }
+
+ public Retry getCreateClusterRetry() {
+ return this.createClusterRetry;
+ }
+
+ public void setCreateClusterRetry(Retry createClusterRetry) {
+ this.createClusterRetry = createClusterRetry;
+ }
+
+ public Retry getUpdateClusterRetry() {
+ return this.updateClusterRetry;
+ }
+
+ public void setUpdateClusterRetry(Retry updateClusterRetry) {
+ this.updateClusterRetry = updateClusterRetry;
+ }
+
+ public Retry getUpdateNodePoolRetry() {
+ return this.updateNodePoolRetry;
+ }
+
+ public void setUpdateNodePoolRetry(Retry updateNodePoolRetry) {
+ this.updateNodePoolRetry = updateNodePoolRetry;
+ }
+
+ public Retry getSetNodePoolAutoscalingRetry() {
+ return this.setNodePoolAutoscalingRetry;
+ }
+
+ public void setSetNodePoolAutoscalingRetry(Retry setNodePoolAutoscalingRetry) {
+ this.setNodePoolAutoscalingRetry = setNodePoolAutoscalingRetry;
+ }
+
+ public Retry getSetLoggingServiceRetry() {
+ return this.setLoggingServiceRetry;
+ }
+
+ public void setSetLoggingServiceRetry(Retry setLoggingServiceRetry) {
+ this.setLoggingServiceRetry = setLoggingServiceRetry;
+ }
+
+ public Retry getSetMonitoringServiceRetry() {
+ return this.setMonitoringServiceRetry;
+ }
+
+ public void setSetMonitoringServiceRetry(Retry setMonitoringServiceRetry) {
+ this.setMonitoringServiceRetry = setMonitoringServiceRetry;
+ }
+
+ public Retry getSetAddonsConfigRetry() {
+ return this.setAddonsConfigRetry;
+ }
+
+ public void setSetAddonsConfigRetry(Retry setAddonsConfigRetry) {
+ this.setAddonsConfigRetry = setAddonsConfigRetry;
+ }
+
+ public Retry getSetLocationsRetry() {
+ return this.setLocationsRetry;
+ }
+
+ public void setSetLocationsRetry(Retry setLocationsRetry) {
+ this.setLocationsRetry = setLocationsRetry;
+ }
+
+ public Retry getUpdateMasterRetry() {
+ return this.updateMasterRetry;
+ }
+
+ public void setUpdateMasterRetry(Retry updateMasterRetry) {
+ this.updateMasterRetry = updateMasterRetry;
+ }
+
+ public Retry getSetMasterAuthRetry() {
+ return this.setMasterAuthRetry;
+ }
+
+ public void setSetMasterAuthRetry(Retry setMasterAuthRetry) {
+ this.setMasterAuthRetry = setMasterAuthRetry;
+ }
+
+ public Retry getDeleteClusterRetry() {
+ return this.deleteClusterRetry;
+ }
+
+ public void setDeleteClusterRetry(Retry deleteClusterRetry) {
+ this.deleteClusterRetry = deleteClusterRetry;
+ }
+
+ public Retry getListOperationsRetry() {
+ return this.listOperationsRetry;
+ }
+
+ public void setListOperationsRetry(Retry listOperationsRetry) {
+ this.listOperationsRetry = listOperationsRetry;
+ }
+
+ public Retry getGetOperationRetry() {
+ return this.getOperationRetry;
+ }
+
+ public void setGetOperationRetry(Retry getOperationRetry) {
+ this.getOperationRetry = getOperationRetry;
+ }
+
+ public Retry getCancelOperationRetry() {
+ return this.cancelOperationRetry;
+ }
+
+ public void setCancelOperationRetry(Retry cancelOperationRetry) {
+ this.cancelOperationRetry = cancelOperationRetry;
+ }
+
+ public Retry getGetServerConfigRetry() {
+ return this.getServerConfigRetry;
+ }
+
+ public void setGetServerConfigRetry(Retry getServerConfigRetry) {
+ this.getServerConfigRetry = getServerConfigRetry;
+ }
+
+ public Retry getGetJSONWebKeysRetry() {
+ return this.getJSONWebKeysRetry;
+ }
+
+ public void setGetJSONWebKeysRetry(Retry getJSONWebKeysRetry) {
+ this.getJSONWebKeysRetry = getJSONWebKeysRetry;
+ }
+
+ public Retry getListNodePoolsRetry() {
+ return this.listNodePoolsRetry;
+ }
+
+ public void setListNodePoolsRetry(Retry listNodePoolsRetry) {
+ this.listNodePoolsRetry = listNodePoolsRetry;
+ }
+
+ public Retry getGetNodePoolRetry() {
+ return this.getNodePoolRetry;
+ }
+
+ public void setGetNodePoolRetry(Retry getNodePoolRetry) {
+ this.getNodePoolRetry = getNodePoolRetry;
+ }
+
+ public Retry getCreateNodePoolRetry() {
+ return this.createNodePoolRetry;
+ }
+
+ public void setCreateNodePoolRetry(Retry createNodePoolRetry) {
+ this.createNodePoolRetry = createNodePoolRetry;
+ }
+
+ public Retry getDeleteNodePoolRetry() {
+ return this.deleteNodePoolRetry;
+ }
+
+ public void setDeleteNodePoolRetry(Retry deleteNodePoolRetry) {
+ this.deleteNodePoolRetry = deleteNodePoolRetry;
+ }
+
+ public Retry getCompleteNodePoolUpgradeRetry() {
+ return this.completeNodePoolUpgradeRetry;
+ }
+
+ public void setCompleteNodePoolUpgradeRetry(Retry completeNodePoolUpgradeRetry) {
+ this.completeNodePoolUpgradeRetry = completeNodePoolUpgradeRetry;
+ }
+
+ public Retry getRollbackNodePoolUpgradeRetry() {
+ return this.rollbackNodePoolUpgradeRetry;
+ }
+
+ public void setRollbackNodePoolUpgradeRetry(Retry rollbackNodePoolUpgradeRetry) {
+ this.rollbackNodePoolUpgradeRetry = rollbackNodePoolUpgradeRetry;
+ }
+
+ public Retry getSetNodePoolManagementRetry() {
+ return this.setNodePoolManagementRetry;
+ }
+
+ public void setSetNodePoolManagementRetry(Retry setNodePoolManagementRetry) {
+ this.setNodePoolManagementRetry = setNodePoolManagementRetry;
+ }
+
+ public Retry getSetLabelsRetry() {
+ return this.setLabelsRetry;
+ }
+
+ public void setSetLabelsRetry(Retry setLabelsRetry) {
+ this.setLabelsRetry = setLabelsRetry;
+ }
+
+ public Retry getSetLegacyAbacRetry() {
+ return this.setLegacyAbacRetry;
+ }
+
+ public void setSetLegacyAbacRetry(Retry setLegacyAbacRetry) {
+ this.setLegacyAbacRetry = setLegacyAbacRetry;
+ }
+
+ public Retry getStartIPRotationRetry() {
+ return this.startIPRotationRetry;
+ }
+
+ public void setStartIPRotationRetry(Retry startIPRotationRetry) {
+ this.startIPRotationRetry = startIPRotationRetry;
+ }
+
+ public Retry getCompleteIPRotationRetry() {
+ return this.completeIPRotationRetry;
+ }
+
+ public void setCompleteIPRotationRetry(Retry completeIPRotationRetry) {
+ this.completeIPRotationRetry = completeIPRotationRetry;
+ }
+
+ public Retry getSetNodePoolSizeRetry() {
+ return this.setNodePoolSizeRetry;
+ }
+
+ public void setSetNodePoolSizeRetry(Retry setNodePoolSizeRetry) {
+ this.setNodePoolSizeRetry = setNodePoolSizeRetry;
+ }
+
+ public Retry getSetNetworkPolicyRetry() {
+ return this.setNetworkPolicyRetry;
+ }
+
+ public void setSetNetworkPolicyRetry(Retry setNetworkPolicyRetry) {
+ this.setNetworkPolicyRetry = setNetworkPolicyRetry;
+ }
+
+ public Retry getSetMaintenancePolicyRetry() {
+ return this.setMaintenancePolicyRetry;
+ }
+
+ public void setSetMaintenancePolicyRetry(Retry setMaintenancePolicyRetry) {
+ this.setMaintenancePolicyRetry = setMaintenancePolicyRetry;
+ }
+
+ public Retry getListUsableSubnetworksRetry() {
+ return this.listUsableSubnetworksRetry;
+ }
+
+ public void setListUsableSubnetworksRetry(Retry listUsableSubnetworksRetry) {
+ this.listUsableSubnetworksRetry = listUsableSubnetworksRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/package-info.java
new file mode 100644
index 0000000000..160038dd20
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/java/com/google/cloud/container/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for container. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.container.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..61f34f24b6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.container.v1.cluster-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud container/ClusterManager components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..48ea5a1459
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-container-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.container.v1.spring.ClusterManagerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/pom.xml
new file mode 100644
index 0000000000..58323f1f9f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ContainerAnalysisSpringProperties. 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 ContainerAnalysisSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ContainerAnalysisSettings containerAnalysisSettings(
+ @Qualifier("defaultContainerAnalysisTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ContainerAnalysisSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ContainerAnalysisSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ContainerAnalysisSettings.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 =
+ ContainerAnalysisSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings getVulnerabilityOccurrencesSummaryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVulnerabilityOccurrencesSummarySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getVulnerabilityOccurrencesSummarySettings()
+ .setRetrySettings(getVulnerabilityOccurrencesSummaryRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ Retry getVulnerabilityOccurrencesSummaryRetry =
+ clientProperties.getGetVulnerabilityOccurrencesSummaryRetry();
+ if (getVulnerabilityOccurrencesSummaryRetry != null) {
+ RetrySettings getVulnerabilityOccurrencesSummaryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVulnerabilityOccurrencesSummarySettings().getRetrySettings(),
+ getVulnerabilityOccurrencesSummaryRetry);
+ clientSettingsBuilder
+ .getVulnerabilityOccurrencesSummarySettings()
+ .setRetrySettings(getVulnerabilityOccurrencesSummaryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getVulnerabilityOccurrencesSummary from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ContainerAnalysisClient bean configured with ContainerAnalysisSettings.
+ *
+ * @param containerAnalysisSettings settings to configure an instance of client bean.
+ * @return a {@link ContainerAnalysisClient} bean configured with {@link
+ * ContainerAnalysisSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ContainerAnalysisClient containerAnalysisClient(
+ ContainerAnalysisSettings containerAnalysisSettings) throws IOException {
+ return ContainerAnalysisClient.create(containerAnalysisSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-container-analysis";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringProperties.java b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringProperties.java
new file mode 100644
index 0000000000..716608052a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/ContainerAnalysisSpringProperties.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2022 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.devtools.containeranalysis.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 ContainerAnalysis client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.devtools.containeranalysis.v1.container-analysis")
+public class ContainerAnalysisSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getVulnerabilityOccurrencesSummary. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getVulnerabilityOccurrencesSummaryRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+
+ public Retry getGetVulnerabilityOccurrencesSummaryRetry() {
+ return this.getVulnerabilityOccurrencesSummaryRetry;
+ }
+
+ public void setGetVulnerabilityOccurrencesSummaryRetry(
+ Retry getVulnerabilityOccurrencesSummaryRetry) {
+ this.getVulnerabilityOccurrencesSummaryRetry = getVulnerabilityOccurrencesSummaryRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/package-info.java
new file mode 100644
index 0000000000..28b49d7845
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/java/com/google/cloud/devtools/containeranalysis/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for containeranalysis. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.devtools.containeranalysis.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..c6813ed6e9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.devtools.containeranalysis.v1.container-analysis.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud containeranalysis/ContainerAnalysis components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..e08e94b84e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-containeranalysis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.devtools.containeranalysis.v1.spring.ContainerAnalysisSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/pom.xml
new file mode 100644
index 0000000000..62109193ba
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DataFusionSpringProperties. 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 DataFusionSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataFusionSettings dataFusionSettings(
+ @Qualifier("defaultDataFusionTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DataFusionSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DataFusionSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DataFusionSettings.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 =
+ DataFusionSettings.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 listAvailableVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAvailableVersionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listAvailableVersionsSettings()
+ .setRetrySettings(listAvailableVersionsRetrySettings);
+
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listAvailableVersionsRetry = clientProperties.getListAvailableVersionsRetry();
+ if (listAvailableVersionsRetry != null) {
+ RetrySettings listAvailableVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAvailableVersionsSettings().getRetrySettings(),
+ listAvailableVersionsRetry);
+ clientSettingsBuilder
+ .listAvailableVersionsSettings()
+ .setRetrySettings(listAvailableVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listAvailableVersions from properties.");
+ }
+ }
+ Retry listInstancesRetry = clientProperties.getListInstancesRetry();
+ if (listInstancesRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInstances from properties.");
+ }
+ }
+ Retry getInstanceRetry = clientProperties.getGetInstanceRetry();
+ if (getInstanceRetry != null) {
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInstance from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DataFusionClient bean configured with DataFusionSettings.
+ *
+ * @param dataFusionSettings settings to configure an instance of client bean.
+ * @return a {@link DataFusionClient} bean configured with {@link DataFusionSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataFusionClient dataFusionClient(DataFusionSettings dataFusionSettings)
+ throws IOException {
+ return DataFusionClient.create(dataFusionSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-data-fusion";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringProperties.java b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringProperties.java
new file mode 100644
index 0000000000..49018fc49a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/DataFusionSpringProperties.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2022 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.datafusion.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 DataFusion client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.datafusion.v1.data-fusion")
+public class DataFusionSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listAvailableVersions. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAvailableVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for listInstances. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInstancesRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstance. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceRetry;
+
+ @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 getListAvailableVersionsRetry() {
+ return this.listAvailableVersionsRetry;
+ }
+
+ public void setListAvailableVersionsRetry(Retry listAvailableVersionsRetry) {
+ this.listAvailableVersionsRetry = listAvailableVersionsRetry;
+ }
+
+ public Retry getListInstancesRetry() {
+ return this.listInstancesRetry;
+ }
+
+ public void setListInstancesRetry(Retry listInstancesRetry) {
+ this.listInstancesRetry = listInstancesRetry;
+ }
+
+ public Retry getGetInstanceRetry() {
+ return this.getInstanceRetry;
+ }
+
+ public void setGetInstanceRetry(Retry getInstanceRetry) {
+ this.getInstanceRetry = getInstanceRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/package-info.java
new file mode 100644
index 0000000000..44074c0ef6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/java/com/google/cloud/datafusion/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for datafusion. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.datafusion.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..13b4940184
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.datafusion.v1.data-fusion.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datafusion/DataFusion components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..5fd728c529
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-data-fusion-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.datafusion.v1.spring.DataFusionSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/pom.xml
new file mode 100644
index 0000000000..61c5acef8c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DataCatalogSpringProperties. 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 DataCatalogSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DataCatalogSettings dataCatalogSettings( + @Qualifier("defaultDataCatalogTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DataCatalogSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DataCatalogSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DataCatalogSettings.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 = + DataCatalogSettings.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 searchCatalogRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchCatalogSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchCatalogSettings().setRetrySettings(searchCatalogRetrySettings); + + RetrySettings createEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntryGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createEntryGroupSettings() + .setRetrySettings(createEntryGroupRetrySettings); + + RetrySettings getEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntryGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEntryGroupSettings().setRetrySettings(getEntryGroupRetrySettings); + + RetrySettings updateEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntryGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateEntryGroupSettings() + .setRetrySettings(updateEntryGroupRetrySettings); + + RetrySettings deleteEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntryGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteEntryGroupSettings() + .setRetrySettings(deleteEntryGroupRetrySettings); + + RetrySettings listEntryGroupsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntryGroupsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEntryGroupsSettings() + .setRetrySettings(listEntryGroupsRetrySettings); + + RetrySettings createEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createEntrySettings().setRetrySettings(createEntryRetrySettings); + + RetrySettings updateEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateEntrySettings().setRetrySettings(updateEntryRetrySettings); + + RetrySettings deleteEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteEntrySettings().setRetrySettings(deleteEntryRetrySettings); + + RetrySettings getEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEntrySettings().setRetrySettings(getEntryRetrySettings); + + RetrySettings lookupEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.lookupEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.lookupEntrySettings().setRetrySettings(lookupEntryRetrySettings); + + RetrySettings listEntriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntriesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listEntriesSettings().setRetrySettings(listEntriesRetrySettings); + + RetrySettings modifyEntryOverviewRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.modifyEntryOverviewSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .modifyEntryOverviewSettings() + .setRetrySettings(modifyEntryOverviewRetrySettings); + + RetrySettings modifyEntryContactsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.modifyEntryContactsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .modifyEntryContactsSettings() + .setRetrySettings(modifyEntryContactsRetrySettings); + + RetrySettings createTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagTemplateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createTagTemplateSettings() + .setRetrySettings(createTagTemplateRetrySettings); + + RetrySettings getTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTagTemplateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getTagTemplateSettings().setRetrySettings(getTagTemplateRetrySettings); + + RetrySettings updateTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagTemplateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateTagTemplateSettings() + .setRetrySettings(updateTagTemplateRetrySettings); + + RetrySettings deleteTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagTemplateSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteTagTemplateSettings() + .setRetrySettings(deleteTagTemplateRetrySettings); + + RetrySettings createTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagTemplateFieldSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createTagTemplateFieldSettings() + .setRetrySettings(createTagTemplateFieldRetrySettings); + + RetrySettings updateTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagTemplateFieldSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateTagTemplateFieldSettings() + .setRetrySettings(updateTagTemplateFieldRetrySettings); + + RetrySettings renameTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.renameTagTemplateFieldSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .renameTagTemplateFieldSettings() + .setRetrySettings(renameTagTemplateFieldRetrySettings); + + RetrySettings renameTagTemplateFieldEnumValueRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.renameTagTemplateFieldEnumValueSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .renameTagTemplateFieldEnumValueSettings() + .setRetrySettings(renameTagTemplateFieldEnumValueRetrySettings); + + RetrySettings deleteTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagTemplateFieldSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteTagTemplateFieldSettings() + .setRetrySettings(deleteTagTemplateFieldRetrySettings); + + RetrySettings createTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createTagSettings().setRetrySettings(createTagRetrySettings); + + RetrySettings updateTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateTagSettings().setRetrySettings(updateTagRetrySettings); + + RetrySettings deleteTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteTagSettings().setRetrySettings(deleteTagRetrySettings); + + RetrySettings listTagsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTagsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listTagsSettings().setRetrySettings(listTagsRetrySettings); + + RetrySettings starEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.starEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.starEntrySettings().setRetrySettings(starEntryRetrySettings); + + RetrySettings unstarEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.unstarEntrySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.unstarEntrySettings().setRetrySettings(unstarEntryRetrySettings); + + 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 searchCatalogRetry = clientProperties.getSearchCatalogRetry(); + if (searchCatalogRetry != null) { + RetrySettings searchCatalogRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchCatalogSettings().getRetrySettings(), searchCatalogRetry); + clientSettingsBuilder.searchCatalogSettings().setRetrySettings(searchCatalogRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchCatalog from properties."); + } + } + Retry createEntryGroupRetry = clientProperties.getCreateEntryGroupRetry(); + if (createEntryGroupRetry != null) { + RetrySettings createEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntryGroupSettings().getRetrySettings(), + createEntryGroupRetry); + clientSettingsBuilder + .createEntryGroupSettings() + .setRetrySettings(createEntryGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createEntryGroup from properties."); + } + } + Retry getEntryGroupRetry = clientProperties.getGetEntryGroupRetry(); + if (getEntryGroupRetry != null) { + RetrySettings getEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntryGroupSettings().getRetrySettings(), getEntryGroupRetry); + clientSettingsBuilder.getEntryGroupSettings().setRetrySettings(getEntryGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEntryGroup from properties."); + } + } + Retry updateEntryGroupRetry = clientProperties.getUpdateEntryGroupRetry(); + if (updateEntryGroupRetry != null) { + RetrySettings updateEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntryGroupSettings().getRetrySettings(), + updateEntryGroupRetry); + clientSettingsBuilder + .updateEntryGroupSettings() + .setRetrySettings(updateEntryGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateEntryGroup from properties."); + } + } + Retry deleteEntryGroupRetry = clientProperties.getDeleteEntryGroupRetry(); + if (deleteEntryGroupRetry != null) { + RetrySettings deleteEntryGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntryGroupSettings().getRetrySettings(), + deleteEntryGroupRetry); + clientSettingsBuilder + .deleteEntryGroupSettings() + .setRetrySettings(deleteEntryGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteEntryGroup from properties."); + } + } + Retry listEntryGroupsRetry = clientProperties.getListEntryGroupsRetry(); + if (listEntryGroupsRetry != null) { + RetrySettings listEntryGroupsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntryGroupsSettings().getRetrySettings(), + listEntryGroupsRetry); + clientSettingsBuilder + .listEntryGroupsSettings() + .setRetrySettings(listEntryGroupsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEntryGroups from properties."); + } + } + Retry createEntryRetry = clientProperties.getCreateEntryRetry(); + if (createEntryRetry != null) { + RetrySettings createEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntrySettings().getRetrySettings(), createEntryRetry); + clientSettingsBuilder.createEntrySettings().setRetrySettings(createEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createEntry from properties."); + } + } + Retry updateEntryRetry = clientProperties.getUpdateEntryRetry(); + if (updateEntryRetry != null) { + RetrySettings updateEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntrySettings().getRetrySettings(), updateEntryRetry); + clientSettingsBuilder.updateEntrySettings().setRetrySettings(updateEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateEntry from properties."); + } + } + Retry deleteEntryRetry = clientProperties.getDeleteEntryRetry(); + if (deleteEntryRetry != null) { + RetrySettings deleteEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntrySettings().getRetrySettings(), deleteEntryRetry); + clientSettingsBuilder.deleteEntrySettings().setRetrySettings(deleteEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteEntry from properties."); + } + } + Retry getEntryRetry = clientProperties.getGetEntryRetry(); + if (getEntryRetry != null) { + RetrySettings getEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntrySettings().getRetrySettings(), getEntryRetry); + clientSettingsBuilder.getEntrySettings().setRetrySettings(getEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEntry from properties."); + } + } + Retry lookupEntryRetry = clientProperties.getLookupEntryRetry(); + if (lookupEntryRetry != null) { + RetrySettings lookupEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.lookupEntrySettings().getRetrySettings(), lookupEntryRetry); + clientSettingsBuilder.lookupEntrySettings().setRetrySettings(lookupEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for lookupEntry from properties."); + } + } + Retry listEntriesRetry = clientProperties.getListEntriesRetry(); + if (listEntriesRetry != null) { + RetrySettings listEntriesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntriesSettings().getRetrySettings(), listEntriesRetry); + clientSettingsBuilder.listEntriesSettings().setRetrySettings(listEntriesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEntries from properties."); + } + } + Retry modifyEntryOverviewRetry = clientProperties.getModifyEntryOverviewRetry(); + if (modifyEntryOverviewRetry != null) { + RetrySettings modifyEntryOverviewRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.modifyEntryOverviewSettings().getRetrySettings(), + modifyEntryOverviewRetry); + clientSettingsBuilder + .modifyEntryOverviewSettings() + .setRetrySettings(modifyEntryOverviewRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for modifyEntryOverview from properties."); + } + } + Retry modifyEntryContactsRetry = clientProperties.getModifyEntryContactsRetry(); + if (modifyEntryContactsRetry != null) { + RetrySettings modifyEntryContactsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.modifyEntryContactsSettings().getRetrySettings(), + modifyEntryContactsRetry); + clientSettingsBuilder + .modifyEntryContactsSettings() + .setRetrySettings(modifyEntryContactsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for modifyEntryContacts from properties."); + } + } + Retry createTagTemplateRetry = clientProperties.getCreateTagTemplateRetry(); + if (createTagTemplateRetry != null) { + RetrySettings createTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagTemplateSettings().getRetrySettings(), + createTagTemplateRetry); + clientSettingsBuilder + .createTagTemplateSettings() + .setRetrySettings(createTagTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTagTemplate from properties."); + } + } + Retry getTagTemplateRetry = clientProperties.getGetTagTemplateRetry(); + if (getTagTemplateRetry != null) { + RetrySettings getTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTagTemplateSettings().getRetrySettings(), + getTagTemplateRetry); + clientSettingsBuilder.getTagTemplateSettings().setRetrySettings(getTagTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getTagTemplate from properties."); + } + } + Retry updateTagTemplateRetry = clientProperties.getUpdateTagTemplateRetry(); + if (updateTagTemplateRetry != null) { + RetrySettings updateTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagTemplateSettings().getRetrySettings(), + updateTagTemplateRetry); + clientSettingsBuilder + .updateTagTemplateSettings() + .setRetrySettings(updateTagTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTagTemplate from properties."); + } + } + Retry deleteTagTemplateRetry = clientProperties.getDeleteTagTemplateRetry(); + if (deleteTagTemplateRetry != null) { + RetrySettings deleteTagTemplateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagTemplateSettings().getRetrySettings(), + deleteTagTemplateRetry); + clientSettingsBuilder + .deleteTagTemplateSettings() + .setRetrySettings(deleteTagTemplateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteTagTemplate from properties."); + } + } + Retry createTagTemplateFieldRetry = clientProperties.getCreateTagTemplateFieldRetry(); + if (createTagTemplateFieldRetry != null) { + RetrySettings createTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagTemplateFieldSettings().getRetrySettings(), + createTagTemplateFieldRetry); + clientSettingsBuilder + .createTagTemplateFieldSettings() + .setRetrySettings(createTagTemplateFieldRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createTagTemplateField from properties."); + } + } + Retry updateTagTemplateFieldRetry = clientProperties.getUpdateTagTemplateFieldRetry(); + if (updateTagTemplateFieldRetry != null) { + RetrySettings updateTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagTemplateFieldSettings().getRetrySettings(), + updateTagTemplateFieldRetry); + clientSettingsBuilder + .updateTagTemplateFieldSettings() + .setRetrySettings(updateTagTemplateFieldRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateTagTemplateField from properties."); + } + } + Retry renameTagTemplateFieldRetry = clientProperties.getRenameTagTemplateFieldRetry(); + if (renameTagTemplateFieldRetry != null) { + RetrySettings renameTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.renameTagTemplateFieldSettings().getRetrySettings(), + renameTagTemplateFieldRetry); + clientSettingsBuilder + .renameTagTemplateFieldSettings() + .setRetrySettings(renameTagTemplateFieldRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for renameTagTemplateField from properties."); + } + } + Retry renameTagTemplateFieldEnumValueRetry = + clientProperties.getRenameTagTemplateFieldEnumValueRetry(); + if (renameTagTemplateFieldEnumValueRetry != null) { + RetrySettings renameTagTemplateFieldEnumValueRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.renameTagTemplateFieldEnumValueSettings().getRetrySettings(), + renameTagTemplateFieldEnumValueRetry); + clientSettingsBuilder + .renameTagTemplateFieldEnumValueSettings() + .setRetrySettings(renameTagTemplateFieldEnumValueRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for renameTagTemplateFieldEnumValue from properties."); + } + } + Retry deleteTagTemplateFieldRetry = clientProperties.getDeleteTagTemplateFieldRetry(); + if (deleteTagTemplateFieldRetry != null) { + RetrySettings deleteTagTemplateFieldRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagTemplateFieldSettings().getRetrySettings(), + deleteTagTemplateFieldRetry); + clientSettingsBuilder + .deleteTagTemplateFieldSettings() + .setRetrySettings(deleteTagTemplateFieldRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteTagTemplateField from properties."); + } + } + Retry createTagRetry = clientProperties.getCreateTagRetry(); + if (createTagRetry != null) { + RetrySettings createTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createTagSettings().getRetrySettings(), createTagRetry); + clientSettingsBuilder.createTagSettings().setRetrySettings(createTagRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createTag from properties."); + } + } + Retry updateTagRetry = clientProperties.getUpdateTagRetry(); + if (updateTagRetry != null) { + RetrySettings updateTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateTagSettings().getRetrySettings(), updateTagRetry); + clientSettingsBuilder.updateTagSettings().setRetrySettings(updateTagRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateTag from properties."); + } + } + Retry deleteTagRetry = clientProperties.getDeleteTagRetry(); + if (deleteTagRetry != null) { + RetrySettings deleteTagRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteTagSettings().getRetrySettings(), deleteTagRetry); + clientSettingsBuilder.deleteTagSettings().setRetrySettings(deleteTagRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteTag from properties."); + } + } + Retry listTagsRetry = clientProperties.getListTagsRetry(); + if (listTagsRetry != null) { + RetrySettings listTagsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTagsSettings().getRetrySettings(), listTagsRetry); + clientSettingsBuilder.listTagsSettings().setRetrySettings(listTagsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listTags from properties."); + } + } + Retry starEntryRetry = clientProperties.getStarEntryRetry(); + if (starEntryRetry != null) { + RetrySettings starEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.starEntrySettings().getRetrySettings(), starEntryRetry); + clientSettingsBuilder.starEntrySettings().setRetrySettings(starEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for starEntry from properties."); + } + } + Retry unstarEntryRetry = clientProperties.getUnstarEntryRetry(); + if (unstarEntryRetry != null) { + RetrySettings unstarEntryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.unstarEntrySettings().getRetrySettings(), unstarEntryRetry); + clientSettingsBuilder.unstarEntrySettings().setRetrySettings(unstarEntryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for unstarEntry 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 DataCatalogClient bean configured with DataCatalogSettings. + * + * @param dataCatalogSettings settings to configure an instance of client bean. + * @return a {@link DataCatalogClient} bean configured with {@link DataCatalogSettings} + */ + @Bean + @ConditionalOnMissingBean + public DataCatalogClient dataCatalogClient(DataCatalogSettings dataCatalogSettings) + throws IOException { + return DataCatalogClient.create(dataCatalogSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-data-catalog"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java new file mode 100644 index 0000000000..94f4fad6d0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/DataCatalogSpringProperties.java @@ -0,0 +1,498 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datacatalog.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 DataCatalog client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.datacatalog.v1.data-catalog") +public class DataCatalogSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for searchCatalog. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchCatalogRetry; + /** + * Allow override of retry settings at method-level for createEntryGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createEntryGroupRetry; + /** + * Allow override of retry settings at method-level for getEntryGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEntryGroupRetry; + /** + * Allow override of retry settings at method-level for updateEntryGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEntryGroupRetry; + /** + * Allow override of retry settings at method-level for deleteEntryGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteEntryGroupRetry; + /** + * Allow override of retry settings at method-level for listEntryGroups. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEntryGroupsRetry; + /** + * Allow override of retry settings at method-level for createEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createEntryRetry; + /** + * Allow override of retry settings at method-level for updateEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEntryRetry; + /** + * Allow override of retry settings at method-level for deleteEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteEntryRetry; + /** + * Allow override of retry settings at method-level for getEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEntryRetry; + /** + * Allow override of retry settings at method-level for lookupEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry lookupEntryRetry; + /** + * Allow override of retry settings at method-level for listEntries. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEntriesRetry; + /** + * Allow override of retry settings at method-level for modifyEntryOverview. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry modifyEntryOverviewRetry; + /** + * Allow override of retry settings at method-level for modifyEntryContacts. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry modifyEntryContactsRetry; + /** + * Allow override of retry settings at method-level for createTagTemplate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTagTemplateRetry; + /** + * Allow override of retry settings at method-level for getTagTemplate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTagTemplateRetry; + /** + * Allow override of retry settings at method-level for updateTagTemplate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTagTemplateRetry; + /** + * Allow override of retry settings at method-level for deleteTagTemplate. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteTagTemplateRetry; + /** + * Allow override of retry settings at method-level for createTagTemplateField. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTagTemplateFieldRetry; + /** + * Allow override of retry settings at method-level for updateTagTemplateField. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTagTemplateFieldRetry; + /** + * Allow override of retry settings at method-level for renameTagTemplateField. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry renameTagTemplateFieldRetry; + /** + * Allow override of retry settings at method-level for renameTagTemplateFieldEnumValue. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry renameTagTemplateFieldEnumValueRetry; + /** + * Allow override of retry settings at method-level for deleteTagTemplateField. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteTagTemplateFieldRetry; + /** + * Allow override of retry settings at method-level for createTag. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createTagRetry; + /** + * Allow override of retry settings at method-level for updateTag. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateTagRetry; + /** + * Allow override of retry settings at method-level for deleteTag. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteTagRetry; + /** + * Allow override of retry settings at method-level for listTags. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTagsRetry; + /** + * Allow override of retry settings at method-level for starEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry starEntryRetry; + /** + * Allow override of retry settings at method-level for unstarEntry. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry unstarEntryRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getSearchCatalogRetry() { + return this.searchCatalogRetry; + } + + public void setSearchCatalogRetry(Retry searchCatalogRetry) { + this.searchCatalogRetry = searchCatalogRetry; + } + + public Retry getCreateEntryGroupRetry() { + return this.createEntryGroupRetry; + } + + public void setCreateEntryGroupRetry(Retry createEntryGroupRetry) { + this.createEntryGroupRetry = createEntryGroupRetry; + } + + public Retry getGetEntryGroupRetry() { + return this.getEntryGroupRetry; + } + + public void setGetEntryGroupRetry(Retry getEntryGroupRetry) { + this.getEntryGroupRetry = getEntryGroupRetry; + } + + public Retry getUpdateEntryGroupRetry() { + return this.updateEntryGroupRetry; + } + + public void setUpdateEntryGroupRetry(Retry updateEntryGroupRetry) { + this.updateEntryGroupRetry = updateEntryGroupRetry; + } + + public Retry getDeleteEntryGroupRetry() { + return this.deleteEntryGroupRetry; + } + + public void setDeleteEntryGroupRetry(Retry deleteEntryGroupRetry) { + this.deleteEntryGroupRetry = deleteEntryGroupRetry; + } + + public Retry getListEntryGroupsRetry() { + return this.listEntryGroupsRetry; + } + + public void setListEntryGroupsRetry(Retry listEntryGroupsRetry) { + this.listEntryGroupsRetry = listEntryGroupsRetry; + } + + public Retry getCreateEntryRetry() { + return this.createEntryRetry; + } + + public void setCreateEntryRetry(Retry createEntryRetry) { + this.createEntryRetry = createEntryRetry; + } + + public Retry getUpdateEntryRetry() { + return this.updateEntryRetry; + } + + public void setUpdateEntryRetry(Retry updateEntryRetry) { + this.updateEntryRetry = updateEntryRetry; + } + + public Retry getDeleteEntryRetry() { + return this.deleteEntryRetry; + } + + public void setDeleteEntryRetry(Retry deleteEntryRetry) { + this.deleteEntryRetry = deleteEntryRetry; + } + + public Retry getGetEntryRetry() { + return this.getEntryRetry; + } + + public void setGetEntryRetry(Retry getEntryRetry) { + this.getEntryRetry = getEntryRetry; + } + + public Retry getLookupEntryRetry() { + return this.lookupEntryRetry; + } + + public void setLookupEntryRetry(Retry lookupEntryRetry) { + this.lookupEntryRetry = lookupEntryRetry; + } + + public Retry getListEntriesRetry() { + return this.listEntriesRetry; + } + + public void setListEntriesRetry(Retry listEntriesRetry) { + this.listEntriesRetry = listEntriesRetry; + } + + public Retry getModifyEntryOverviewRetry() { + return this.modifyEntryOverviewRetry; + } + + public void setModifyEntryOverviewRetry(Retry modifyEntryOverviewRetry) { + this.modifyEntryOverviewRetry = modifyEntryOverviewRetry; + } + + public Retry getModifyEntryContactsRetry() { + return this.modifyEntryContactsRetry; + } + + public void setModifyEntryContactsRetry(Retry modifyEntryContactsRetry) { + this.modifyEntryContactsRetry = modifyEntryContactsRetry; + } + + public Retry getCreateTagTemplateRetry() { + return this.createTagTemplateRetry; + } + + public void setCreateTagTemplateRetry(Retry createTagTemplateRetry) { + this.createTagTemplateRetry = createTagTemplateRetry; + } + + public Retry getGetTagTemplateRetry() { + return this.getTagTemplateRetry; + } + + public void setGetTagTemplateRetry(Retry getTagTemplateRetry) { + this.getTagTemplateRetry = getTagTemplateRetry; + } + + public Retry getUpdateTagTemplateRetry() { + return this.updateTagTemplateRetry; + } + + public void setUpdateTagTemplateRetry(Retry updateTagTemplateRetry) { + this.updateTagTemplateRetry = updateTagTemplateRetry; + } + + public Retry getDeleteTagTemplateRetry() { + return this.deleteTagTemplateRetry; + } + + public void setDeleteTagTemplateRetry(Retry deleteTagTemplateRetry) { + this.deleteTagTemplateRetry = deleteTagTemplateRetry; + } + + public Retry getCreateTagTemplateFieldRetry() { + return this.createTagTemplateFieldRetry; + } + + public void setCreateTagTemplateFieldRetry(Retry createTagTemplateFieldRetry) { + this.createTagTemplateFieldRetry = createTagTemplateFieldRetry; + } + + public Retry getUpdateTagTemplateFieldRetry() { + return this.updateTagTemplateFieldRetry; + } + + public void setUpdateTagTemplateFieldRetry(Retry updateTagTemplateFieldRetry) { + this.updateTagTemplateFieldRetry = updateTagTemplateFieldRetry; + } + + public Retry getRenameTagTemplateFieldRetry() { + return this.renameTagTemplateFieldRetry; + } + + public void setRenameTagTemplateFieldRetry(Retry renameTagTemplateFieldRetry) { + this.renameTagTemplateFieldRetry = renameTagTemplateFieldRetry; + } + + public Retry getRenameTagTemplateFieldEnumValueRetry() { + return this.renameTagTemplateFieldEnumValueRetry; + } + + public void setRenameTagTemplateFieldEnumValueRetry(Retry renameTagTemplateFieldEnumValueRetry) { + this.renameTagTemplateFieldEnumValueRetry = renameTagTemplateFieldEnumValueRetry; + } + + public Retry getDeleteTagTemplateFieldRetry() { + return this.deleteTagTemplateFieldRetry; + } + + public void setDeleteTagTemplateFieldRetry(Retry deleteTagTemplateFieldRetry) { + this.deleteTagTemplateFieldRetry = deleteTagTemplateFieldRetry; + } + + public Retry getCreateTagRetry() { + return this.createTagRetry; + } + + public void setCreateTagRetry(Retry createTagRetry) { + this.createTagRetry = createTagRetry; + } + + public Retry getUpdateTagRetry() { + return this.updateTagRetry; + } + + public void setUpdateTagRetry(Retry updateTagRetry) { + this.updateTagRetry = updateTagRetry; + } + + public Retry getDeleteTagRetry() { + return this.deleteTagRetry; + } + + public void setDeleteTagRetry(Retry deleteTagRetry) { + this.deleteTagRetry = deleteTagRetry; + } + + public Retry getListTagsRetry() { + return this.listTagsRetry; + } + + public void setListTagsRetry(Retry listTagsRetry) { + this.listTagsRetry = listTagsRetry; + } + + public Retry getStarEntryRetry() { + return this.starEntryRetry; + } + + public void setStarEntryRetry(Retry starEntryRetry) { + this.starEntryRetry = starEntryRetry; + } + + public Retry getUnstarEntryRetry() { + return this.unstarEntryRetry; + } + + public void setUnstarEntryRetry(Retry unstarEntryRetry) { + this.unstarEntryRetry = unstarEntryRetry; + } + + 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-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java new file mode 100644 index 0000000000..c98c9ceeff --- /dev/null +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringAutoConfiguration.java @@ -0,0 +1,254 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datacatalog.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.datacatalog.v1.PolicyTagManagerSerializationClient; +import com.google.cloud.datacatalog.v1.PolicyTagManagerSerializationSettings; +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 PolicyTagManagerSerializationClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in PolicyTagManagerSerializationSpringProperties. 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 PolicyTagManagerSerializationSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public PolicyTagManagerSerializationSettings policyTagManagerSerializationSettings( + @Qualifier("defaultPolicyTagManagerSerializationTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PolicyTagManagerSerializationSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = PolicyTagManagerSerializationSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = PolicyTagManagerSerializationSettings.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 = + PolicyTagManagerSerializationSettings.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 replaceTaxonomyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.replaceTaxonomySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .replaceTaxonomySettings() + .setRetrySettings(replaceTaxonomyRetrySettings); + + RetrySettings importTaxonomiesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importTaxonomiesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .importTaxonomiesSettings() + .setRetrySettings(importTaxonomiesRetrySettings); + + RetrySettings exportTaxonomiesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportTaxonomiesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .exportTaxonomiesSettings() + .setRetrySettings(exportTaxonomiesRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry replaceTaxonomyRetry = clientProperties.getReplaceTaxonomyRetry(); + if (replaceTaxonomyRetry != null) { + RetrySettings replaceTaxonomyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.replaceTaxonomySettings().getRetrySettings(), + replaceTaxonomyRetry); + clientSettingsBuilder + .replaceTaxonomySettings() + .setRetrySettings(replaceTaxonomyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for replaceTaxonomy from properties."); + } + } + Retry importTaxonomiesRetry = clientProperties.getImportTaxonomiesRetry(); + if (importTaxonomiesRetry != null) { + RetrySettings importTaxonomiesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.importTaxonomiesSettings().getRetrySettings(), + importTaxonomiesRetry); + clientSettingsBuilder + .importTaxonomiesSettings() + .setRetrySettings(importTaxonomiesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for importTaxonomies from properties."); + } + } + Retry exportTaxonomiesRetry = clientProperties.getExportTaxonomiesRetry(); + if (exportTaxonomiesRetry != null) { + RetrySettings exportTaxonomiesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.exportTaxonomiesSettings().getRetrySettings(), + exportTaxonomiesRetry); + clientSettingsBuilder + .exportTaxonomiesSettings() + .setRetrySettings(exportTaxonomiesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for exportTaxonomies from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a PolicyTagManagerSerializationClient bean configured with + * PolicyTagManagerSerializationSettings. + * + * @param policyTagManagerSerializationSettings settings to configure an instance of client bean. + * @return a {@link PolicyTagManagerSerializationClient} bean configured with {@link + * PolicyTagManagerSerializationSettings} + */ + @Bean + @ConditionalOnMissingBean + public PolicyTagManagerSerializationClient policyTagManagerSerializationClient( + PolicyTagManagerSerializationSettings policyTagManagerSerializationSettings) + throws IOException { + return PolicyTagManagerSerializationClient.create(policyTagManagerSerializationSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-policy-tag-manager-serialization"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringProperties.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringProperties.java new file mode 100644 index 0000000000..1f82bcbc11 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSerializationSpringProperties.java @@ -0,0 +1,121 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datacatalog.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 PolicyTagManagerSerialization client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.datacatalog.v1.policy-tag-manager-serialization") +public class PolicyTagManagerSerializationSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for replaceTaxonomy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry replaceTaxonomyRetry; + /** + * Allow override of retry settings at method-level for importTaxonomies. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry importTaxonomiesRetry; + /** + * Allow override of retry settings at method-level for exportTaxonomies. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry exportTaxonomiesRetry; + + @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 getReplaceTaxonomyRetry() { + return this.replaceTaxonomyRetry; + } + + public void setReplaceTaxonomyRetry(Retry replaceTaxonomyRetry) { + this.replaceTaxonomyRetry = replaceTaxonomyRetry; + } + + public Retry getImportTaxonomiesRetry() { + return this.importTaxonomiesRetry; + } + + public void setImportTaxonomiesRetry(Retry importTaxonomiesRetry) { + this.importTaxonomiesRetry = importTaxonomiesRetry; + } + + public Retry getExportTaxonomiesRetry() { + return this.exportTaxonomiesRetry; + } + + public void setExportTaxonomiesRetry(Retry exportTaxonomiesRetry) { + this.exportTaxonomiesRetry = exportTaxonomiesRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java new file mode 100644 index 0000000000..9e5e544b80 --- /dev/null +++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringAutoConfiguration.java @@ -0,0 +1,408 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datacatalog.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.datacatalog.v1.PolicyTagManagerClient; +import com.google.cloud.datacatalog.v1.PolicyTagManagerSettings; +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 PolicyTagManagerClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in PolicyTagManagerSpringProperties. 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 PolicyTagManagerSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PolicyTagManagerSettings policyTagManagerSettings(
+ @Qualifier("defaultPolicyTagManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ PolicyTagManagerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = PolicyTagManagerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = PolicyTagManagerSettings.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 =
+ PolicyTagManagerSettings.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 createTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTaxonomySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createTaxonomySettings().setRetrySettings(createTaxonomyRetrySettings);
+
+ RetrySettings deleteTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTaxonomySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteTaxonomySettings().setRetrySettings(deleteTaxonomyRetrySettings);
+
+ RetrySettings updateTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTaxonomySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateTaxonomySettings().setRetrySettings(updateTaxonomyRetrySettings);
+
+ RetrySettings listTaxonomiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTaxonomiesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTaxonomiesSettings().setRetrySettings(listTaxonomiesRetrySettings);
+
+ RetrySettings getTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTaxonomySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTaxonomySettings().setRetrySettings(getTaxonomyRetrySettings);
+
+ RetrySettings createPolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPolicyTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createPolicyTagSettings()
+ .setRetrySettings(createPolicyTagRetrySettings);
+
+ RetrySettings deletePolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePolicyTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deletePolicyTagSettings()
+ .setRetrySettings(deletePolicyTagRetrySettings);
+
+ RetrySettings updatePolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePolicyTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updatePolicyTagSettings()
+ .setRetrySettings(updatePolicyTagRetrySettings);
+
+ RetrySettings listPolicyTagsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPolicyTagsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listPolicyTagsSettings().setRetrySettings(listPolicyTagsRetrySettings);
+
+ RetrySettings getPolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicyTagSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getPolicyTagSettings().setRetrySettings(getPolicyTagRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createTaxonomyRetry = clientProperties.getCreateTaxonomyRetry();
+ if (createTaxonomyRetry != null) {
+ RetrySettings createTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTaxonomySettings().getRetrySettings(),
+ createTaxonomyRetry);
+ clientSettingsBuilder.createTaxonomySettings().setRetrySettings(createTaxonomyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createTaxonomy from properties.");
+ }
+ }
+ Retry deleteTaxonomyRetry = clientProperties.getDeleteTaxonomyRetry();
+ if (deleteTaxonomyRetry != null) {
+ RetrySettings deleteTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTaxonomySettings().getRetrySettings(),
+ deleteTaxonomyRetry);
+ clientSettingsBuilder.deleteTaxonomySettings().setRetrySettings(deleteTaxonomyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteTaxonomy from properties.");
+ }
+ }
+ Retry updateTaxonomyRetry = clientProperties.getUpdateTaxonomyRetry();
+ if (updateTaxonomyRetry != null) {
+ RetrySettings updateTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTaxonomySettings().getRetrySettings(),
+ updateTaxonomyRetry);
+ clientSettingsBuilder.updateTaxonomySettings().setRetrySettings(updateTaxonomyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateTaxonomy from properties.");
+ }
+ }
+ Retry listTaxonomiesRetry = clientProperties.getListTaxonomiesRetry();
+ if (listTaxonomiesRetry != null) {
+ RetrySettings listTaxonomiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTaxonomiesSettings().getRetrySettings(),
+ listTaxonomiesRetry);
+ clientSettingsBuilder.listTaxonomiesSettings().setRetrySettings(listTaxonomiesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTaxonomies from properties.");
+ }
+ }
+ Retry getTaxonomyRetry = clientProperties.getGetTaxonomyRetry();
+ if (getTaxonomyRetry != null) {
+ RetrySettings getTaxonomyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTaxonomySettings().getRetrySettings(), getTaxonomyRetry);
+ clientSettingsBuilder.getTaxonomySettings().setRetrySettings(getTaxonomyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTaxonomy from properties.");
+ }
+ }
+ Retry createPolicyTagRetry = clientProperties.getCreatePolicyTagRetry();
+ if (createPolicyTagRetry != null) {
+ RetrySettings createPolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPolicyTagSettings().getRetrySettings(),
+ createPolicyTagRetry);
+ clientSettingsBuilder
+ .createPolicyTagSettings()
+ .setRetrySettings(createPolicyTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createPolicyTag from properties.");
+ }
+ }
+ Retry deletePolicyTagRetry = clientProperties.getDeletePolicyTagRetry();
+ if (deletePolicyTagRetry != null) {
+ RetrySettings deletePolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePolicyTagSettings().getRetrySettings(),
+ deletePolicyTagRetry);
+ clientSettingsBuilder
+ .deletePolicyTagSettings()
+ .setRetrySettings(deletePolicyTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deletePolicyTag from properties.");
+ }
+ }
+ Retry updatePolicyTagRetry = clientProperties.getUpdatePolicyTagRetry();
+ if (updatePolicyTagRetry != null) {
+ RetrySettings updatePolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePolicyTagSettings().getRetrySettings(),
+ updatePolicyTagRetry);
+ clientSettingsBuilder
+ .updatePolicyTagSettings()
+ .setRetrySettings(updatePolicyTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updatePolicyTag from properties.");
+ }
+ }
+ Retry listPolicyTagsRetry = clientProperties.getListPolicyTagsRetry();
+ if (listPolicyTagsRetry != null) {
+ RetrySettings listPolicyTagsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPolicyTagsSettings().getRetrySettings(),
+ listPolicyTagsRetry);
+ clientSettingsBuilder.listPolicyTagsSettings().setRetrySettings(listPolicyTagsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listPolicyTags from properties.");
+ }
+ }
+ Retry getPolicyTagRetry = clientProperties.getGetPolicyTagRetry();
+ if (getPolicyTagRetry != null) {
+ RetrySettings getPolicyTagRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicyTagSettings().getRetrySettings(), getPolicyTagRetry);
+ clientSettingsBuilder.getPolicyTagSettings().setRetrySettings(getPolicyTagRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getPolicyTag from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a PolicyTagManagerClient bean configured with PolicyTagManagerSettings.
+ *
+ * @param policyTagManagerSettings settings to configure an instance of client bean.
+ * @return a {@link PolicyTagManagerClient} bean configured with {@link PolicyTagManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PolicyTagManagerClient policyTagManagerClient(
+ PolicyTagManagerSettings policyTagManagerSettings) throws IOException {
+ return PolicyTagManagerClient.create(policyTagManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-policy-tag-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringProperties.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringProperties.java
new file mode 100644
index 0000000000..937f5f25fa
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/PolicyTagManagerSpringProperties.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.datacatalog.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 PolicyTagManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.datacatalog.v1.policy-tag-manager")
+public class PolicyTagManagerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createTaxonomy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTaxonomyRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTaxonomy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTaxonomyRetry;
+ /**
+ * Allow override of retry settings at method-level for updateTaxonomy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateTaxonomyRetry;
+ /**
+ * Allow override of retry settings at method-level for listTaxonomies. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTaxonomiesRetry;
+ /**
+ * Allow override of retry settings at method-level for getTaxonomy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTaxonomyRetry;
+ /**
+ * Allow override of retry settings at method-level for createPolicyTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createPolicyTagRetry;
+ /**
+ * Allow override of retry settings at method-level for deletePolicyTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deletePolicyTagRetry;
+ /**
+ * Allow override of retry settings at method-level for updatePolicyTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updatePolicyTagRetry;
+ /**
+ * Allow override of retry settings at method-level for listPolicyTags. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPolicyTagsRetry;
+ /**
+ * Allow override of retry settings at method-level for getPolicyTag. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPolicyTagRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getCreateTaxonomyRetry() {
+ return this.createTaxonomyRetry;
+ }
+
+ public void setCreateTaxonomyRetry(Retry createTaxonomyRetry) {
+ this.createTaxonomyRetry = createTaxonomyRetry;
+ }
+
+ public Retry getDeleteTaxonomyRetry() {
+ return this.deleteTaxonomyRetry;
+ }
+
+ public void setDeleteTaxonomyRetry(Retry deleteTaxonomyRetry) {
+ this.deleteTaxonomyRetry = deleteTaxonomyRetry;
+ }
+
+ public Retry getUpdateTaxonomyRetry() {
+ return this.updateTaxonomyRetry;
+ }
+
+ public void setUpdateTaxonomyRetry(Retry updateTaxonomyRetry) {
+ this.updateTaxonomyRetry = updateTaxonomyRetry;
+ }
+
+ public Retry getListTaxonomiesRetry() {
+ return this.listTaxonomiesRetry;
+ }
+
+ public void setListTaxonomiesRetry(Retry listTaxonomiesRetry) {
+ this.listTaxonomiesRetry = listTaxonomiesRetry;
+ }
+
+ public Retry getGetTaxonomyRetry() {
+ return this.getTaxonomyRetry;
+ }
+
+ public void setGetTaxonomyRetry(Retry getTaxonomyRetry) {
+ this.getTaxonomyRetry = getTaxonomyRetry;
+ }
+
+ public Retry getCreatePolicyTagRetry() {
+ return this.createPolicyTagRetry;
+ }
+
+ public void setCreatePolicyTagRetry(Retry createPolicyTagRetry) {
+ this.createPolicyTagRetry = createPolicyTagRetry;
+ }
+
+ public Retry getDeletePolicyTagRetry() {
+ return this.deletePolicyTagRetry;
+ }
+
+ public void setDeletePolicyTagRetry(Retry deletePolicyTagRetry) {
+ this.deletePolicyTagRetry = deletePolicyTagRetry;
+ }
+
+ public Retry getUpdatePolicyTagRetry() {
+ return this.updatePolicyTagRetry;
+ }
+
+ public void setUpdatePolicyTagRetry(Retry updatePolicyTagRetry) {
+ this.updatePolicyTagRetry = updatePolicyTagRetry;
+ }
+
+ public Retry getListPolicyTagsRetry() {
+ return this.listPolicyTagsRetry;
+ }
+
+ public void setListPolicyTagsRetry(Retry listPolicyTagsRetry) {
+ this.listPolicyTagsRetry = listPolicyTagsRetry;
+ }
+
+ public Retry getGetPolicyTagRetry() {
+ return this.getPolicyTagRetry;
+ }
+
+ public void setGetPolicyTagRetry(Retry getPolicyTagRetry) {
+ this.getPolicyTagRetry = getPolicyTagRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/package-info.java
new file mode 100644
index 0000000000..9a48b7a1d2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/java/com/google/cloud/datacatalog/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for datacatalog. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.datacatalog.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..45a9152cd5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,22 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.datacatalog.v1.data-catalog.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datacatalog/DataCatalog components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.datacatalog.v1.policy-tag-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datacatalog/PolicyTagManager components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.datacatalog.v1.policy-tag-manager-serialization.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datacatalog/PolicyTagManagerSerialization components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..aa2aa31406
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datacatalog-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,3 @@
+com.google.cloud.datacatalog.v1.spring.DataCatalogSpringAutoConfiguration
+com.google.cloud.datacatalog.v1.spring.PolicyTagManagerSpringAutoConfiguration
+com.google.cloud.datacatalog.v1.spring.PolicyTagManagerSerializationSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dataplex-spring-starter/pom.xml
new file mode 100644
index 0000000000..d24e6cdd46
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ContentServiceSpringProperties. 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 ContentServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ContentServiceSettings contentServiceSettings( + @Qualifier("defaultContentServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ContentServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ContentServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ContentServiceSettings.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 = + ContentServiceSettings.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 createContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createContentSettings().setRetrySettings(createContentRetrySettings); + + RetrySettings updateContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateContentSettings().setRetrySettings(updateContentRetrySettings); + + RetrySettings deleteContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteContentSettings().setRetrySettings(deleteContentRetrySettings); + + RetrySettings getContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getContentSettings().setRetrySettings(getContentRetrySettings); + + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + + RetrySettings listContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listContentSettings().setRetrySettings(listContentRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createContentRetry = clientProperties.getCreateContentRetry(); + if (createContentRetry != null) { + RetrySettings createContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContentSettings().getRetrySettings(), createContentRetry); + clientSettingsBuilder.createContentSettings().setRetrySettings(createContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createContent from properties."); + } + } + Retry updateContentRetry = clientProperties.getUpdateContentRetry(); + if (updateContentRetry != null) { + RetrySettings updateContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContentSettings().getRetrySettings(), updateContentRetry); + clientSettingsBuilder.updateContentSettings().setRetrySettings(updateContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateContent from properties."); + } + } + Retry deleteContentRetry = clientProperties.getDeleteContentRetry(); + if (deleteContentRetry != null) { + RetrySettings deleteContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteContentSettings().getRetrySettings(), deleteContentRetry); + clientSettingsBuilder.deleteContentSettings().setRetrySettings(deleteContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteContent from properties."); + } + } + Retry getContentRetry = clientProperties.getGetContentRetry(); + if (getContentRetry != null) { + RetrySettings getContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContentSettings().getRetrySettings(), getContentRetry); + clientSettingsBuilder.getContentSettings().setRetrySettings(getContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getContent from properties."); + } + } + Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry(); + if (getIamPolicyRetry != null) { + RetrySettings getIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry); + clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); + } + } + Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry(); + if (setIamPolicyRetry != null) { + RetrySettings setIamPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry); + clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties."); + } + } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } + Retry listContentRetry = clientProperties.getListContentRetry(); + if (listContentRetry != null) { + RetrySettings listContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContentSettings().getRetrySettings(), listContentRetry); + clientSettingsBuilder.listContentSettings().setRetrySettings(listContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listContent from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ContentServiceClient bean configured with ContentServiceSettings. + * + * @param contentServiceSettings settings to configure an instance of client bean. + * @return a {@link ContentServiceClient} bean configured with {@link ContentServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ContentServiceClient contentServiceClient(ContentServiceSettings contentServiceSettings) + throws IOException { + return ContentServiceClient.create(contentServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-content-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringProperties.java new file mode 100644 index 0000000000..77cac89797 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/ContentServiceSpringProperties.java @@ -0,0 +1,212 @@ +/* + * Copyright 2022 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.dataplex.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 ContentService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataplex.v1.content-service") +public class ContentServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createContentRetry; + /** + * Allow override of retry settings at method-level for updateContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateContentRetry; + /** + * Allow override of retry settings at method-level for deleteContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteContentRetry; + /** + * Allow override of retry settings at method-level for getContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getContentRetry; + /** + * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; + /** + * Allow override of retry settings at method-level for listContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listContentRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCreateContentRetry() { + return this.createContentRetry; + } + + public void setCreateContentRetry(Retry createContentRetry) { + this.createContentRetry = createContentRetry; + } + + public Retry getUpdateContentRetry() { + return this.updateContentRetry; + } + + public void setUpdateContentRetry(Retry updateContentRetry) { + this.updateContentRetry = updateContentRetry; + } + + public Retry getDeleteContentRetry() { + return this.deleteContentRetry; + } + + public void setDeleteContentRetry(Retry deleteContentRetry) { + this.deleteContentRetry = deleteContentRetry; + } + + public Retry getGetContentRetry() { + return this.getContentRetry; + } + + public void setGetContentRetry(Retry getContentRetry) { + this.getContentRetry = getContentRetry; + } + + public Retry getGetIamPolicyRetry() { + return this.getIamPolicyRetry; + } + + public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { + this.getIamPolicyRetry = getIamPolicyRetry; + } + + public Retry getSetIamPolicyRetry() { + return this.setIamPolicyRetry; + } + + public void setSetIamPolicyRetry(Retry setIamPolicyRetry) { + this.setIamPolicyRetry = setIamPolicyRetry; + } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } + + public Retry getListContentRetry() { + return this.listContentRetry; + } + + public void setListContentRetry(Retry listContentRetry) { + this.listContentRetry = listContentRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..1aee264626 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringAutoConfiguration.java @@ -0,0 +1,298 @@ +/* + * Copyright 2022 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.dataplex.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.dataplex.v1.DataScanServiceClient; +import com.google.cloud.dataplex.v1.DataScanServiceSettings; +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 DataScanServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DataScanServiceSpringProperties. 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 DataScanServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DataScanServiceSettings dataScanServiceSettings( + @Qualifier("defaultDataScanServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DataScanServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DataScanServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DataScanServiceSettings.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 = + DataScanServiceSettings.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 getDataScanRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataScanSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDataScanSettings().setRetrySettings(getDataScanRetrySettings); + + RetrySettings listDataScansRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataScansSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDataScansSettings().setRetrySettings(listDataScansRetrySettings); + + RetrySettings runDataScanRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.runDataScanSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.runDataScanSettings().setRetrySettings(runDataScanRetrySettings); + + RetrySettings getDataScanJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataScanJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDataScanJobSettings().setRetrySettings(getDataScanJobRetrySettings); + + RetrySettings listDataScanJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataScanJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDataScanJobsSettings() + .setRetrySettings(listDataScanJobsRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getDataScanRetry = clientProperties.getGetDataScanRetry(); + if (getDataScanRetry != null) { + RetrySettings getDataScanRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataScanSettings().getRetrySettings(), getDataScanRetry); + clientSettingsBuilder.getDataScanSettings().setRetrySettings(getDataScanRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataScan from properties."); + } + } + Retry listDataScansRetry = clientProperties.getListDataScansRetry(); + if (listDataScansRetry != null) { + RetrySettings listDataScansRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataScansSettings().getRetrySettings(), listDataScansRetry); + clientSettingsBuilder.listDataScansSettings().setRetrySettings(listDataScansRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDataScans from properties."); + } + } + Retry runDataScanRetry = clientProperties.getRunDataScanRetry(); + if (runDataScanRetry != null) { + RetrySettings runDataScanRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.runDataScanSettings().getRetrySettings(), runDataScanRetry); + clientSettingsBuilder.runDataScanSettings().setRetrySettings(runDataScanRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for runDataScan from properties."); + } + } + Retry getDataScanJobRetry = clientProperties.getGetDataScanJobRetry(); + if (getDataScanJobRetry != null) { + RetrySettings getDataScanJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDataScanJobSettings().getRetrySettings(), + getDataScanJobRetry); + clientSettingsBuilder.getDataScanJobSettings().setRetrySettings(getDataScanJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDataScanJob from properties."); + } + } + Retry listDataScanJobsRetry = clientProperties.getListDataScanJobsRetry(); + if (listDataScanJobsRetry != null) { + RetrySettings listDataScanJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDataScanJobsSettings().getRetrySettings(), + listDataScanJobsRetry); + clientSettingsBuilder + .listDataScanJobsSettings() + .setRetrySettings(listDataScanJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDataScanJobs from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DataScanServiceClient bean configured with DataScanServiceSettings. + * + * @param dataScanServiceSettings settings to configure an instance of client bean. + * @return a {@link DataScanServiceClient} bean configured with {@link DataScanServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DataScanServiceClient dataScanServiceClient( + DataScanServiceSettings dataScanServiceSettings) throws IOException { + return DataScanServiceClient.create(dataScanServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-data-scan-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringProperties.java new file mode 100644 index 0000000000..a677f0aa53 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataScanServiceSpringProperties.java @@ -0,0 +1,173 @@ +/* + * Copyright 2022 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.dataplex.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 DataScanService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataplex.v1.data-scan-service") +public class DataScanServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getDataScan. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDataScanRetry; + /** + * Allow override of retry settings at method-level for listDataScans. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataScansRetry; + /** + * Allow override of retry settings at method-level for runDataScan. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry runDataScanRetry; + /** + * Allow override of retry settings at method-level for getDataScanJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDataScanJobRetry; + /** + * Allow override of retry settings at method-level for listDataScanJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDataScanJobsRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetDataScanRetry() { + return this.getDataScanRetry; + } + + public void setGetDataScanRetry(Retry getDataScanRetry) { + this.getDataScanRetry = getDataScanRetry; + } + + public Retry getListDataScansRetry() { + return this.listDataScansRetry; + } + + public void setListDataScansRetry(Retry listDataScansRetry) { + this.listDataScansRetry = listDataScansRetry; + } + + public Retry getRunDataScanRetry() { + return this.runDataScanRetry; + } + + public void setRunDataScanRetry(Retry runDataScanRetry) { + this.runDataScanRetry = runDataScanRetry; + } + + public Retry getGetDataScanJobRetry() { + return this.getDataScanJobRetry; + } + + public void setGetDataScanJobRetry(Retry getDataScanJobRetry) { + this.getDataScanJobRetry = getDataScanJobRetry; + } + + public Retry getListDataScanJobsRetry() { + return this.listDataScanJobsRetry; + } + + public void setListDataScanJobsRetry(Retry listDataScanJobsRetry) { + this.listDataScanJobsRetry = listDataScanJobsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..296eb15285 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringAutoConfiguration.java @@ -0,0 +1,494 @@ +/* + * Copyright 2022 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.dataplex.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.dataplex.v1.DataplexServiceClient; +import com.google.cloud.dataplex.v1.DataplexServiceSettings; +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 DataplexServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DataplexServiceSpringProperties. 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 DataplexServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public DataplexServiceSettings dataplexServiceSettings( + @Qualifier("defaultDataplexServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DataplexServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DataplexServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DataplexServiceSettings.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 = + DataplexServiceSettings.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 listLakesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLakesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLakesSettings().setRetrySettings(listLakesRetrySettings); + + RetrySettings getLakeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLakeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLakeSettings().setRetrySettings(getLakeRetrySettings); + + RetrySettings listLakeActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLakeActionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listLakeActionsSettings() + .setRetrySettings(listLakeActionsRetrySettings); + + RetrySettings listZonesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZonesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listZonesSettings().setRetrySettings(listZonesRetrySettings); + + RetrySettings getZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getZoneSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getZoneSettings().setRetrySettings(getZoneRetrySettings); + + RetrySettings listZoneActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZoneActionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listZoneActionsSettings() + .setRetrySettings(listZoneActionsRetrySettings); + + RetrySettings listAssetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAssetsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings); + + RetrySettings getAssetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAssetSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getAssetSettings().setRetrySettings(getAssetRetrySettings); + + RetrySettings listAssetActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAssetActionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listAssetActionsSettings() + .setRetrySettings(listAssetActionsRetrySettings); + + RetrySettings listTasksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTasksSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listTasksSettings().setRetrySettings(listTasksRetrySettings); + + RetrySettings getTaskRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTaskSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getTaskSettings().setRetrySettings(getTaskRetrySettings); + + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + + RetrySettings cancelJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.cancelJobSettings().setRetrySettings(cancelJobRetrySettings); + + RetrySettings listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + + RetrySettings getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + + RetrySettings listSessionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSessionsSettings().setRetrySettings(listSessionsRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listLakesRetry = clientProperties.getListLakesRetry(); + if (listLakesRetry != null) { + RetrySettings listLakesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLakesSettings().getRetrySettings(), listLakesRetry); + clientSettingsBuilder.listLakesSettings().setRetrySettings(listLakesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLakes from properties."); + } + } + Retry getLakeRetry = clientProperties.getGetLakeRetry(); + if (getLakeRetry != null) { + RetrySettings getLakeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLakeSettings().getRetrySettings(), getLakeRetry); + clientSettingsBuilder.getLakeSettings().setRetrySettings(getLakeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLake from properties."); + } + } + Retry listLakeActionsRetry = clientProperties.getListLakeActionsRetry(); + if (listLakeActionsRetry != null) { + RetrySettings listLakeActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLakeActionsSettings().getRetrySettings(), + listLakeActionsRetry); + clientSettingsBuilder + .listLakeActionsSettings() + .setRetrySettings(listLakeActionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLakeActions from properties."); + } + } + Retry listZonesRetry = clientProperties.getListZonesRetry(); + if (listZonesRetry != null) { + RetrySettings listZonesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZonesSettings().getRetrySettings(), listZonesRetry); + clientSettingsBuilder.listZonesSettings().setRetrySettings(listZonesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listZones from properties."); + } + } + Retry getZoneRetry = clientProperties.getGetZoneRetry(); + if (getZoneRetry != null) { + RetrySettings getZoneRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getZoneSettings().getRetrySettings(), getZoneRetry); + clientSettingsBuilder.getZoneSettings().setRetrySettings(getZoneRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getZone from properties."); + } + } + Retry listZoneActionsRetry = clientProperties.getListZoneActionsRetry(); + if (listZoneActionsRetry != null) { + RetrySettings listZoneActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listZoneActionsSettings().getRetrySettings(), + listZoneActionsRetry); + clientSettingsBuilder + .listZoneActionsSettings() + .setRetrySettings(listZoneActionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listZoneActions from properties."); + } + } + Retry listAssetsRetry = clientProperties.getListAssetsRetry(); + if (listAssetsRetry != null) { + RetrySettings listAssetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAssetsSettings().getRetrySettings(), listAssetsRetry); + clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listAssets from properties."); + } + } + Retry getAssetRetry = clientProperties.getGetAssetRetry(); + if (getAssetRetry != null) { + RetrySettings getAssetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAssetSettings().getRetrySettings(), getAssetRetry); + clientSettingsBuilder.getAssetSettings().setRetrySettings(getAssetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getAsset from properties."); + } + } + Retry listAssetActionsRetry = clientProperties.getListAssetActionsRetry(); + if (listAssetActionsRetry != null) { + RetrySettings listAssetActionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAssetActionsSettings().getRetrySettings(), + listAssetActionsRetry); + clientSettingsBuilder + .listAssetActionsSettings() + .setRetrySettings(listAssetActionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAssetActions from properties."); + } + } + Retry listTasksRetry = clientProperties.getListTasksRetry(); + if (listTasksRetry != null) { + RetrySettings listTasksRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listTasksSettings().getRetrySettings(), listTasksRetry); + clientSettingsBuilder.listTasksSettings().setRetrySettings(listTasksRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listTasks from properties."); + } + } + Retry getTaskRetry = clientProperties.getGetTaskRetry(); + if (getTaskRetry != null) { + RetrySettings getTaskRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getTaskSettings().getRetrySettings(), getTaskRetry); + clientSettingsBuilder.getTaskSettings().setRetrySettings(getTaskRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getTask from properties."); + } + } + Retry listJobsRetry = clientProperties.getListJobsRetry(); + if (listJobsRetry != null) { + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), listJobsRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listJobs from properties."); + } + } + Retry getJobRetry = clientProperties.getGetJobRetry(); + if (getJobRetry != null) { + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), getJobRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getJob from properties."); + } + } + Retry cancelJobRetry = clientProperties.getCancelJobRetry(); + if (cancelJobRetry != null) { + RetrySettings cancelJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelJobSettings().getRetrySettings(), cancelJobRetry); + clientSettingsBuilder.cancelJobSettings().setRetrySettings(cancelJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for cancelJob from properties."); + } + } + Retry listEnvironmentsRetry = clientProperties.getListEnvironmentsRetry(); + if (listEnvironmentsRetry != null) { + RetrySettings listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), + listEnvironmentsRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEnvironments from properties."); + } + } + Retry getEnvironmentRetry = clientProperties.getGetEnvironmentRetry(); + if (getEnvironmentRetry != null) { + RetrySettings getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), + getEnvironmentRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEnvironment from properties."); + } + } + Retry listSessionsRetry = clientProperties.getListSessionsRetry(); + if (listSessionsRetry != null) { + RetrySettings listSessionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionsSettings().getRetrySettings(), listSessionsRetry); + clientSettingsBuilder.listSessionsSettings().setRetrySettings(listSessionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSessions from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DataplexServiceClient bean configured with DataplexServiceSettings. + * + * @param dataplexServiceSettings settings to configure an instance of client bean. + * @return a {@link DataplexServiceClient} bean configured with {@link DataplexServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public DataplexServiceClient dataplexServiceClient( + DataplexServiceSettings dataplexServiceSettings) throws IOException { + return DataplexServiceClient.create(dataplexServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-dataplex-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringProperties.java new file mode 100644 index 0000000000..730048f705 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/DataplexServiceSpringProperties.java @@ -0,0 +1,329 @@ +/* + * Copyright 2022 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.dataplex.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 DataplexService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataplex.v1.dataplex-service") +public class DataplexServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listLakes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLakesRetry; + /** + * Allow override of retry settings at method-level for getLake. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLakeRetry; + /** + * Allow override of retry settings at method-level for listLakeActions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLakeActionsRetry; + /** + * Allow override of retry settings at method-level for listZones. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listZonesRetry; + /** + * Allow override of retry settings at method-level for getZone. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getZoneRetry; + /** + * Allow override of retry settings at method-level for listZoneActions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listZoneActionsRetry; + /** + * Allow override of retry settings at method-level for listAssets. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAssetsRetry; + /** + * Allow override of retry settings at method-level for getAsset. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAssetRetry; + /** + * Allow override of retry settings at method-level for listAssetActions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAssetActionsRetry; + /** + * Allow override of retry settings at method-level for listTasks. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listTasksRetry; + /** + * Allow override of retry settings at method-level for getTask. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getTaskRetry; + /** + * Allow override of retry settings at method-level for listJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listJobsRetry; + /** + * Allow override of retry settings at method-level for getJob. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getJobRetry; + /** + * Allow override of retry settings at method-level for cancelJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelJobRetry; + /** + * Allow override of retry settings at method-level for listEnvironments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEnvironmentsRetry; + /** + * Allow override of retry settings at method-level for getEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEnvironmentRetry; + /** + * Allow override of retry settings at method-level for listSessions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSessionsRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListLakesRetry() { + return this.listLakesRetry; + } + + public void setListLakesRetry(Retry listLakesRetry) { + this.listLakesRetry = listLakesRetry; + } + + public Retry getGetLakeRetry() { + return this.getLakeRetry; + } + + public void setGetLakeRetry(Retry getLakeRetry) { + this.getLakeRetry = getLakeRetry; + } + + public Retry getListLakeActionsRetry() { + return this.listLakeActionsRetry; + } + + public void setListLakeActionsRetry(Retry listLakeActionsRetry) { + this.listLakeActionsRetry = listLakeActionsRetry; + } + + public Retry getListZonesRetry() { + return this.listZonesRetry; + } + + public void setListZonesRetry(Retry listZonesRetry) { + this.listZonesRetry = listZonesRetry; + } + + public Retry getGetZoneRetry() { + return this.getZoneRetry; + } + + public void setGetZoneRetry(Retry getZoneRetry) { + this.getZoneRetry = getZoneRetry; + } + + public Retry getListZoneActionsRetry() { + return this.listZoneActionsRetry; + } + + public void setListZoneActionsRetry(Retry listZoneActionsRetry) { + this.listZoneActionsRetry = listZoneActionsRetry; + } + + public Retry getListAssetsRetry() { + return this.listAssetsRetry; + } + + public void setListAssetsRetry(Retry listAssetsRetry) { + this.listAssetsRetry = listAssetsRetry; + } + + public Retry getGetAssetRetry() { + return this.getAssetRetry; + } + + public void setGetAssetRetry(Retry getAssetRetry) { + this.getAssetRetry = getAssetRetry; + } + + public Retry getListAssetActionsRetry() { + return this.listAssetActionsRetry; + } + + public void setListAssetActionsRetry(Retry listAssetActionsRetry) { + this.listAssetActionsRetry = listAssetActionsRetry; + } + + public Retry getListTasksRetry() { + return this.listTasksRetry; + } + + public void setListTasksRetry(Retry listTasksRetry) { + this.listTasksRetry = listTasksRetry; + } + + public Retry getGetTaskRetry() { + return this.getTaskRetry; + } + + public void setGetTaskRetry(Retry getTaskRetry) { + this.getTaskRetry = getTaskRetry; + } + + public Retry getListJobsRetry() { + return this.listJobsRetry; + } + + public void setListJobsRetry(Retry listJobsRetry) { + this.listJobsRetry = listJobsRetry; + } + + public Retry getGetJobRetry() { + return this.getJobRetry; + } + + public void setGetJobRetry(Retry getJobRetry) { + this.getJobRetry = getJobRetry; + } + + public Retry getCancelJobRetry() { + return this.cancelJobRetry; + } + + public void setCancelJobRetry(Retry cancelJobRetry) { + this.cancelJobRetry = cancelJobRetry; + } + + public Retry getListEnvironmentsRetry() { + return this.listEnvironmentsRetry; + } + + public void setListEnvironmentsRetry(Retry listEnvironmentsRetry) { + this.listEnvironmentsRetry = listEnvironmentsRetry; + } + + public Retry getGetEnvironmentRetry() { + return this.getEnvironmentRetry; + } + + public void setGetEnvironmentRetry(Retry getEnvironmentRetry) { + this.getEnvironmentRetry = getEnvironmentRetry; + } + + public Retry getListSessionsRetry() { + return this.listSessionsRetry; + } + + public void setListSessionsRetry(Retry listSessionsRetry) { + this.listSessionsRetry = listSessionsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..605d08356c --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringAutoConfiguration.java @@ -0,0 +1,362 @@ +/* + * Copyright 2022 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.dataplex.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.dataplex.v1.MetadataServiceClient; +import com.google.cloud.dataplex.v1.MetadataServiceSettings; +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 MetadataServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in MetadataServiceSpringProperties. 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 MetadataServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public MetadataServiceSettings metadataServiceSettings(
+ @Qualifier("defaultMetadataServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ MetadataServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = MetadataServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = MetadataServiceSettings.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 =
+ MetadataServiceSettings.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 createEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createEntitySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createEntitySettings().setRetrySettings(createEntityRetrySettings);
+
+ RetrySettings updateEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateEntitySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateEntitySettings().setRetrySettings(updateEntityRetrySettings);
+
+ RetrySettings deleteEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteEntitySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteEntitySettings().setRetrySettings(deleteEntityRetrySettings);
+
+ RetrySettings getEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEntitySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEntitySettings().setRetrySettings(getEntityRetrySettings);
+
+ RetrySettings listEntitiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEntitiesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listEntitiesSettings().setRetrySettings(listEntitiesRetrySettings);
+
+ RetrySettings createPartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPartitionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createPartitionSettings()
+ .setRetrySettings(createPartitionRetrySettings);
+
+ RetrySettings deletePartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePartitionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deletePartitionSettings()
+ .setRetrySettings(deletePartitionRetrySettings);
+
+ RetrySettings getPartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPartitionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getPartitionSettings().setRetrySettings(getPartitionRetrySettings);
+
+ RetrySettings listPartitionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPartitionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listPartitionsSettings().setRetrySettings(listPartitionsRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createEntityRetry = clientProperties.getCreateEntityRetry();
+ if (createEntityRetry != null) {
+ RetrySettings createEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createEntitySettings().getRetrySettings(), createEntityRetry);
+ clientSettingsBuilder.createEntitySettings().setRetrySettings(createEntityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createEntity from properties.");
+ }
+ }
+ Retry updateEntityRetry = clientProperties.getUpdateEntityRetry();
+ if (updateEntityRetry != null) {
+ RetrySettings updateEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateEntitySettings().getRetrySettings(), updateEntityRetry);
+ clientSettingsBuilder.updateEntitySettings().setRetrySettings(updateEntityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateEntity from properties.");
+ }
+ }
+ Retry deleteEntityRetry = clientProperties.getDeleteEntityRetry();
+ if (deleteEntityRetry != null) {
+ RetrySettings deleteEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteEntitySettings().getRetrySettings(), deleteEntityRetry);
+ clientSettingsBuilder.deleteEntitySettings().setRetrySettings(deleteEntityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteEntity from properties.");
+ }
+ }
+ Retry getEntityRetry = clientProperties.getGetEntityRetry();
+ if (getEntityRetry != null) {
+ RetrySettings getEntityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEntitySettings().getRetrySettings(), getEntityRetry);
+ clientSettingsBuilder.getEntitySettings().setRetrySettings(getEntityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEntity from properties.");
+ }
+ }
+ Retry listEntitiesRetry = clientProperties.getListEntitiesRetry();
+ if (listEntitiesRetry != null) {
+ RetrySettings listEntitiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEntitiesSettings().getRetrySettings(), listEntitiesRetry);
+ clientSettingsBuilder.listEntitiesSettings().setRetrySettings(listEntitiesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listEntities from properties.");
+ }
+ }
+ Retry createPartitionRetry = clientProperties.getCreatePartitionRetry();
+ if (createPartitionRetry != null) {
+ RetrySettings createPartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPartitionSettings().getRetrySettings(),
+ createPartitionRetry);
+ clientSettingsBuilder
+ .createPartitionSettings()
+ .setRetrySettings(createPartitionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createPartition from properties.");
+ }
+ }
+ Retry deletePartitionRetry = clientProperties.getDeletePartitionRetry();
+ if (deletePartitionRetry != null) {
+ RetrySettings deletePartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePartitionSettings().getRetrySettings(),
+ deletePartitionRetry);
+ clientSettingsBuilder
+ .deletePartitionSettings()
+ .setRetrySettings(deletePartitionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deletePartition from properties.");
+ }
+ }
+ Retry getPartitionRetry = clientProperties.getGetPartitionRetry();
+ if (getPartitionRetry != null) {
+ RetrySettings getPartitionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPartitionSettings().getRetrySettings(), getPartitionRetry);
+ clientSettingsBuilder.getPartitionSettings().setRetrySettings(getPartitionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getPartition from properties.");
+ }
+ }
+ Retry listPartitionsRetry = clientProperties.getListPartitionsRetry();
+ if (listPartitionsRetry != null) {
+ RetrySettings listPartitionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPartitionsSettings().getRetrySettings(),
+ listPartitionsRetry);
+ clientSettingsBuilder.listPartitionsSettings().setRetrySettings(listPartitionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listPartitions from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a MetadataServiceClient bean configured with MetadataServiceSettings.
+ *
+ * @param metadataServiceSettings settings to configure an instance of client bean.
+ * @return a {@link MetadataServiceClient} bean configured with {@link MetadataServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public MetadataServiceClient metadataServiceClient(
+ MetadataServiceSettings metadataServiceSettings) throws IOException {
+ return MetadataServiceClient.create(metadataServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-metadata-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringProperties.java
new file mode 100644
index 0000000000..2f239741f4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/MetadataServiceSpringProperties.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2022 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.dataplex.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 MetadataService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.dataplex.v1.metadata-service")
+public class MetadataServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createEntity. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createEntityRetry;
+ /**
+ * Allow override of retry settings at method-level for updateEntity. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateEntityRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteEntity. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteEntityRetry;
+ /**
+ * Allow override of retry settings at method-level for getEntity. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEntityRetry;
+ /**
+ * Allow override of retry settings at method-level for listEntities. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listEntitiesRetry;
+ /**
+ * Allow override of retry settings at method-level for createPartition. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createPartitionRetry;
+ /**
+ * Allow override of retry settings at method-level for deletePartition. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deletePartitionRetry;
+ /**
+ * Allow override of retry settings at method-level for getPartition. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPartitionRetry;
+ /**
+ * Allow override of retry settings at method-level for listPartitions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPartitionsRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getCreateEntityRetry() {
+ return this.createEntityRetry;
+ }
+
+ public void setCreateEntityRetry(Retry createEntityRetry) {
+ this.createEntityRetry = createEntityRetry;
+ }
+
+ public Retry getUpdateEntityRetry() {
+ return this.updateEntityRetry;
+ }
+
+ public void setUpdateEntityRetry(Retry updateEntityRetry) {
+ this.updateEntityRetry = updateEntityRetry;
+ }
+
+ public Retry getDeleteEntityRetry() {
+ return this.deleteEntityRetry;
+ }
+
+ public void setDeleteEntityRetry(Retry deleteEntityRetry) {
+ this.deleteEntityRetry = deleteEntityRetry;
+ }
+
+ public Retry getGetEntityRetry() {
+ return this.getEntityRetry;
+ }
+
+ public void setGetEntityRetry(Retry getEntityRetry) {
+ this.getEntityRetry = getEntityRetry;
+ }
+
+ public Retry getListEntitiesRetry() {
+ return this.listEntitiesRetry;
+ }
+
+ public void setListEntitiesRetry(Retry listEntitiesRetry) {
+ this.listEntitiesRetry = listEntitiesRetry;
+ }
+
+ public Retry getCreatePartitionRetry() {
+ return this.createPartitionRetry;
+ }
+
+ public void setCreatePartitionRetry(Retry createPartitionRetry) {
+ this.createPartitionRetry = createPartitionRetry;
+ }
+
+ public Retry getDeletePartitionRetry() {
+ return this.deletePartitionRetry;
+ }
+
+ public void setDeletePartitionRetry(Retry deletePartitionRetry) {
+ this.deletePartitionRetry = deletePartitionRetry;
+ }
+
+ public Retry getGetPartitionRetry() {
+ return this.getPartitionRetry;
+ }
+
+ public void setGetPartitionRetry(Retry getPartitionRetry) {
+ this.getPartitionRetry = getPartitionRetry;
+ }
+
+ public Retry getListPartitionsRetry() {
+ return this.listPartitionsRetry;
+ }
+
+ public void setListPartitionsRetry(Retry listPartitionsRetry) {
+ this.listPartitionsRetry = listPartitionsRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/package-info.java
new file mode 100644
index 0000000000..8d86d73948
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/java/com/google/cloud/dataplex/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for dataplex. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.dataplex.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..1b20f0400b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,28 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.dataplex.v1.content-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataplex/ContentService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataplex.v1.data-scan-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataplex/DataScanService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataplex.v1.metadata-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataplex/MetadataService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataplex.v1.dataplex-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataplex/DataplexService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..682ce28ea3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataplex-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,4 @@
+com.google.cloud.dataplex.v1.spring.ContentServiceSpringAutoConfiguration
+com.google.cloud.dataplex.v1.spring.DataScanServiceSpringAutoConfiguration
+com.google.cloud.dataplex.v1.spring.MetadataServiceSpringAutoConfiguration
+com.google.cloud.dataplex.v1.spring.DataplexServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/pom.xml
new file mode 100644
index 0000000000..6f36653cc4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DataprocMetastoreFederationSpringProperties. 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 DataprocMetastoreFederationSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public DataprocMetastoreFederationSettings dataprocMetastoreFederationSettings( + @Qualifier("defaultDataprocMetastoreFederationTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DataprocMetastoreFederationSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DataprocMetastoreFederationSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DataprocMetastoreFederationSettings.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 = + DataprocMetastoreFederationSettings.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 listFederationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFederationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listFederationsSettings() + .setRetrySettings(listFederationsRetrySettings); + + RetrySettings getFederationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFederationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getFederationSettings().setRetrySettings(getFederationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listFederationsRetry = clientProperties.getListFederationsRetry(); + if (listFederationsRetry != null) { + RetrySettings listFederationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listFederationsSettings().getRetrySettings(), + listFederationsRetry); + clientSettingsBuilder + .listFederationsSettings() + .setRetrySettings(listFederationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listFederations from properties."); + } + } + Retry getFederationRetry = clientProperties.getGetFederationRetry(); + if (getFederationRetry != null) { + RetrySettings getFederationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFederationSettings().getRetrySettings(), getFederationRetry); + clientSettingsBuilder.getFederationSettings().setRetrySettings(getFederationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getFederation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DataprocMetastoreFederationClient bean configured with + * DataprocMetastoreFederationSettings. + * + * @param dataprocMetastoreFederationSettings settings to configure an instance of client bean. + * @return a {@link DataprocMetastoreFederationClient} bean configured with {@link + * DataprocMetastoreFederationSettings} + */ + @Bean + @ConditionalOnMissingBean + public DataprocMetastoreFederationClient dataprocMetastoreFederationClient( + DataprocMetastoreFederationSettings dataprocMetastoreFederationSettings) throws IOException { + return DataprocMetastoreFederationClient.create(dataprocMetastoreFederationSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-dataproc-metastore-federation"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringProperties.java new file mode 100644 index 0000000000..7454a9def9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreFederationSpringProperties.java @@ -0,0 +1,108 @@ +/* + * Copyright 2022 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.metastore.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 DataprocMetastoreFederation client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.metastore.v1.dataproc-metastore-federation") +public class DataprocMetastoreFederationSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listFederations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listFederationsRetry; + /** + * Allow override of retry settings at method-level for getFederation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getFederationRetry; + + @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 getListFederationsRetry() { + return this.listFederationsRetry; + } + + public void setListFederationsRetry(Retry listFederationsRetry) { + this.listFederationsRetry = listFederationsRetry; + } + + public Retry getGetFederationRetry() { + return this.getFederationRetry; + } + + public void setGetFederationRetry(Retry getFederationRetry) { + this.getFederationRetry = getFederationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java new file mode 100644 index 0000000000..d06c440acd --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringAutoConfiguration.java @@ -0,0 +1,290 @@ +/* + * Copyright 2022 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.metastore.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.metastore.v1.DataprocMetastoreClient; +import com.google.cloud.metastore.v1.DataprocMetastoreSettings; +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 DataprocMetastoreClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DataprocMetastoreSpringProperties. 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 DataprocMetastoreSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataprocMetastoreSettings dataprocMetastoreSettings(
+ @Qualifier("defaultDataprocMetastoreTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DataprocMetastoreSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DataprocMetastoreSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DataprocMetastoreSettings.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 =
+ DataprocMetastoreSettings.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 listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+
+ RetrySettings listMetadataImportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMetadataImportsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listMetadataImportsSettings()
+ .setRetrySettings(listMetadataImportsRetrySettings);
+
+ RetrySettings getMetadataImportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMetadataImportSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getMetadataImportSettings()
+ .setRetrySettings(getMetadataImportRetrySettings);
+
+ RetrySettings listBackupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBackupsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listBackupsSettings().setRetrySettings(listBackupsRetrySettings);
+
+ RetrySettings getBackupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBackupSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getBackupSettings().setRetrySettings(getBackupRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listServicesRetry = clientProperties.getListServicesRetry();
+ if (listServicesRetry != null) {
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listServices from properties.");
+ }
+ }
+ Retry getServiceRetry = clientProperties.getGetServiceRetry();
+ if (getServiceRetry != null) {
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), getServiceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getService from properties.");
+ }
+ }
+ Retry listMetadataImportsRetry = clientProperties.getListMetadataImportsRetry();
+ if (listMetadataImportsRetry != null) {
+ RetrySettings listMetadataImportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMetadataImportsSettings().getRetrySettings(),
+ listMetadataImportsRetry);
+ clientSettingsBuilder
+ .listMetadataImportsSettings()
+ .setRetrySettings(listMetadataImportsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listMetadataImports from properties.");
+ }
+ }
+ Retry getMetadataImportRetry = clientProperties.getGetMetadataImportRetry();
+ if (getMetadataImportRetry != null) {
+ RetrySettings getMetadataImportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMetadataImportSettings().getRetrySettings(),
+ getMetadataImportRetry);
+ clientSettingsBuilder
+ .getMetadataImportSettings()
+ .setRetrySettings(getMetadataImportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getMetadataImport from properties.");
+ }
+ }
+ Retry listBackupsRetry = clientProperties.getListBackupsRetry();
+ if (listBackupsRetry != null) {
+ RetrySettings listBackupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBackupsSettings().getRetrySettings(), listBackupsRetry);
+ clientSettingsBuilder.listBackupsSettings().setRetrySettings(listBackupsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listBackups from properties.");
+ }
+ }
+ Retry getBackupRetry = clientProperties.getGetBackupRetry();
+ if (getBackupRetry != null) {
+ RetrySettings getBackupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBackupSettings().getRetrySettings(), getBackupRetry);
+ clientSettingsBuilder.getBackupSettings().setRetrySettings(getBackupRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBackup from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DataprocMetastoreClient bean configured with DataprocMetastoreSettings.
+ *
+ * @param dataprocMetastoreSettings settings to configure an instance of client bean.
+ * @return a {@link DataprocMetastoreClient} bean configured with {@link
+ * DataprocMetastoreSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataprocMetastoreClient dataprocMetastoreClient(
+ DataprocMetastoreSettings dataprocMetastoreSettings) throws IOException {
+ return DataprocMetastoreClient.create(dataprocMetastoreSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-dataproc-metastore";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringProperties.java
new file mode 100644
index 0000000000..8f0f1df367
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/DataprocMetastoreSpringProperties.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2022 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.metastore.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 DataprocMetastore client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.metastore.v1.dataproc-metastore")
+public class DataprocMetastoreSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for getService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for listMetadataImports. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listMetadataImportsRetry;
+ /**
+ * Allow override of retry settings at method-level for getMetadataImport. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMetadataImportRetry;
+ /**
+ * Allow override of retry settings at method-level for listBackups. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBackupsRetry;
+ /**
+ * Allow override of retry settings at method-level for getBackup. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBackupRetry;
+
+ @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 getListServicesRetry() {
+ return this.listServicesRetry;
+ }
+
+ public void setListServicesRetry(Retry listServicesRetry) {
+ this.listServicesRetry = listServicesRetry;
+ }
+
+ public Retry getGetServiceRetry() {
+ return this.getServiceRetry;
+ }
+
+ public void setGetServiceRetry(Retry getServiceRetry) {
+ this.getServiceRetry = getServiceRetry;
+ }
+
+ public Retry getListMetadataImportsRetry() {
+ return this.listMetadataImportsRetry;
+ }
+
+ public void setListMetadataImportsRetry(Retry listMetadataImportsRetry) {
+ this.listMetadataImportsRetry = listMetadataImportsRetry;
+ }
+
+ public Retry getGetMetadataImportRetry() {
+ return this.getMetadataImportRetry;
+ }
+
+ public void setGetMetadataImportRetry(Retry getMetadataImportRetry) {
+ this.getMetadataImportRetry = getMetadataImportRetry;
+ }
+
+ public Retry getListBackupsRetry() {
+ return this.listBackupsRetry;
+ }
+
+ public void setListBackupsRetry(Retry listBackupsRetry) {
+ this.listBackupsRetry = listBackupsRetry;
+ }
+
+ public Retry getGetBackupRetry() {
+ return this.getBackupRetry;
+ }
+
+ public void setGetBackupRetry(Retry getBackupRetry) {
+ this.getBackupRetry = getBackupRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/package-info.java
new file mode 100644
index 0000000000..bf873848b9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/java/com/google/cloud/metastore/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for metastore. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.metastore.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..ead7850344
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.metastore.v1.dataproc-metastore.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud metastore/DataprocMetastore components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.metastore.v1.dataproc-metastore-federation.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud metastore/DataprocMetastoreFederation components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..77bfb1b43a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-metastore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.metastore.v1.spring.DataprocMetastoreSpringAutoConfiguration
+com.google.cloud.metastore.v1.spring.DataprocMetastoreFederationSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dataproc-spring-starter/pom.xml
new file mode 100644
index 0000000000..e461b4433c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AutoscalingPolicyServiceSpringProperties. 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 AutoscalingPolicyServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings( + @Qualifier("defaultAutoscalingPolicyServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AutoscalingPolicyServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AutoscalingPolicyServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AutoscalingPolicyServiceSettings.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 = + AutoscalingPolicyServiceSettings.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 createAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAutoscalingPolicySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createAutoscalingPolicySettings() + .setRetrySettings(createAutoscalingPolicyRetrySettings); + + RetrySettings updateAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAutoscalingPolicySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateAutoscalingPolicySettings() + .setRetrySettings(updateAutoscalingPolicyRetrySettings); + + RetrySettings getAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAutoscalingPolicySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getAutoscalingPolicySettings() + .setRetrySettings(getAutoscalingPolicyRetrySettings); + + RetrySettings listAutoscalingPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAutoscalingPoliciesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listAutoscalingPoliciesSettings() + .setRetrySettings(listAutoscalingPoliciesRetrySettings); + + RetrySettings deleteAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAutoscalingPolicySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteAutoscalingPolicySettings() + .setRetrySettings(deleteAutoscalingPolicyRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createAutoscalingPolicyRetry = clientProperties.getCreateAutoscalingPolicyRetry(); + if (createAutoscalingPolicyRetry != null) { + RetrySettings createAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createAutoscalingPolicySettings().getRetrySettings(), + createAutoscalingPolicyRetry); + clientSettingsBuilder + .createAutoscalingPolicySettings() + .setRetrySettings(createAutoscalingPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createAutoscalingPolicy from properties."); + } + } + Retry updateAutoscalingPolicyRetry = clientProperties.getUpdateAutoscalingPolicyRetry(); + if (updateAutoscalingPolicyRetry != null) { + RetrySettings updateAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAutoscalingPolicySettings().getRetrySettings(), + updateAutoscalingPolicyRetry); + clientSettingsBuilder + .updateAutoscalingPolicySettings() + .setRetrySettings(updateAutoscalingPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateAutoscalingPolicy from properties."); + } + } + Retry getAutoscalingPolicyRetry = clientProperties.getGetAutoscalingPolicyRetry(); + if (getAutoscalingPolicyRetry != null) { + RetrySettings getAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAutoscalingPolicySettings().getRetrySettings(), + getAutoscalingPolicyRetry); + clientSettingsBuilder + .getAutoscalingPolicySettings() + .setRetrySettings(getAutoscalingPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAutoscalingPolicy from properties."); + } + } + Retry listAutoscalingPoliciesRetry = clientProperties.getListAutoscalingPoliciesRetry(); + if (listAutoscalingPoliciesRetry != null) { + RetrySettings listAutoscalingPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAutoscalingPoliciesSettings().getRetrySettings(), + listAutoscalingPoliciesRetry); + clientSettingsBuilder + .listAutoscalingPoliciesSettings() + .setRetrySettings(listAutoscalingPoliciesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAutoscalingPolicies from properties."); + } + } + Retry deleteAutoscalingPolicyRetry = clientProperties.getDeleteAutoscalingPolicyRetry(); + if (deleteAutoscalingPolicyRetry != null) { + RetrySettings deleteAutoscalingPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAutoscalingPolicySettings().getRetrySettings(), + deleteAutoscalingPolicyRetry); + clientSettingsBuilder + .deleteAutoscalingPolicySettings() + .setRetrySettings(deleteAutoscalingPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteAutoscalingPolicy from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AutoscalingPolicyServiceClient bean configured with + * AutoscalingPolicyServiceSettings. + * + * @param autoscalingPolicyServiceSettings settings to configure an instance of client bean. + * @return a {@link AutoscalingPolicyServiceClient} bean configured with {@link + * AutoscalingPolicyServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public AutoscalingPolicyServiceClient autoscalingPolicyServiceClient( + AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings) throws IOException { + return AutoscalingPolicyServiceClient.create(autoscalingPolicyServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-autoscaling-policy-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringProperties.java new file mode 100644 index 0000000000..0451f4f2a4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/AutoscalingPolicyServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * Copyright 2022 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.dataproc.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 AutoscalingPolicyService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataproc.v1.autoscaling-policy-service") +public class AutoscalingPolicyServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createAutoscalingPolicy. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createAutoscalingPolicyRetry; + /** + * Allow override of retry settings at method-level for updateAutoscalingPolicy. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateAutoscalingPolicyRetry; + /** + * Allow override of retry settings at method-level for getAutoscalingPolicy. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAutoscalingPolicyRetry; + /** + * Allow override of retry settings at method-level for listAutoscalingPolicies. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAutoscalingPoliciesRetry; + /** + * Allow override of retry settings at method-level for deleteAutoscalingPolicy. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteAutoscalingPolicyRetry; + + @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 getCreateAutoscalingPolicyRetry() { + return this.createAutoscalingPolicyRetry; + } + + public void setCreateAutoscalingPolicyRetry(Retry createAutoscalingPolicyRetry) { + this.createAutoscalingPolicyRetry = createAutoscalingPolicyRetry; + } + + public Retry getUpdateAutoscalingPolicyRetry() { + return this.updateAutoscalingPolicyRetry; + } + + public void setUpdateAutoscalingPolicyRetry(Retry updateAutoscalingPolicyRetry) { + this.updateAutoscalingPolicyRetry = updateAutoscalingPolicyRetry; + } + + public Retry getGetAutoscalingPolicyRetry() { + return this.getAutoscalingPolicyRetry; + } + + public void setGetAutoscalingPolicyRetry(Retry getAutoscalingPolicyRetry) { + this.getAutoscalingPolicyRetry = getAutoscalingPolicyRetry; + } + + public Retry getListAutoscalingPoliciesRetry() { + return this.listAutoscalingPoliciesRetry; + } + + public void setListAutoscalingPoliciesRetry(Retry listAutoscalingPoliciesRetry) { + this.listAutoscalingPoliciesRetry = listAutoscalingPoliciesRetry; + } + + public Retry getDeleteAutoscalingPolicyRetry() { + return this.deleteAutoscalingPolicyRetry; + } + + public void setDeleteAutoscalingPolicyRetry(Retry deleteAutoscalingPolicyRetry) { + this.deleteAutoscalingPolicyRetry = deleteAutoscalingPolicyRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java new file mode 100644 index 0000000000..7b19f9dc49 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringAutoConfiguration.java @@ -0,0 +1,231 @@ +/* + * Copyright 2022 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.dataproc.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.dataproc.v1.BatchControllerClient; +import com.google.cloud.dataproc.v1.BatchControllerSettings; +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 BatchControllerClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in BatchControllerSpringProperties. 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 BatchControllerSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public BatchControllerSettings batchControllerSettings( + @Qualifier("defaultBatchControllerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + BatchControllerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = BatchControllerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = BatchControllerSettings.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 = + BatchControllerSettings.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 getBatchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBatchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getBatchSettings().setRetrySettings(getBatchRetrySettings); + + RetrySettings listBatchesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBatchesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listBatchesSettings().setRetrySettings(listBatchesRetrySettings); + + RetrySettings deleteBatchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteBatchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteBatchSettings().setRetrySettings(deleteBatchRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getBatchRetry = clientProperties.getGetBatchRetry(); + if (getBatchRetry != null) { + RetrySettings getBatchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getBatchSettings().getRetrySettings(), getBatchRetry); + clientSettingsBuilder.getBatchSettings().setRetrySettings(getBatchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getBatch from properties."); + } + } + Retry listBatchesRetry = clientProperties.getListBatchesRetry(); + if (listBatchesRetry != null) { + RetrySettings listBatchesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listBatchesSettings().getRetrySettings(), listBatchesRetry); + clientSettingsBuilder.listBatchesSettings().setRetrySettings(listBatchesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listBatches from properties."); + } + } + Retry deleteBatchRetry = clientProperties.getDeleteBatchRetry(); + if (deleteBatchRetry != null) { + RetrySettings deleteBatchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteBatchSettings().getRetrySettings(), deleteBatchRetry); + clientSettingsBuilder.deleteBatchSettings().setRetrySettings(deleteBatchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteBatch from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a BatchControllerClient bean configured with BatchControllerSettings. + * + * @param batchControllerSettings settings to configure an instance of client bean. + * @return a {@link BatchControllerClient} bean configured with {@link BatchControllerSettings} + */ + @Bean + @ConditionalOnMissingBean + public BatchControllerClient batchControllerClient( + BatchControllerSettings batchControllerSettings) throws IOException { + return BatchControllerClient.create(batchControllerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-batch-controller"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringProperties.java new file mode 100644 index 0000000000..1b1c13f703 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/BatchControllerSpringProperties.java @@ -0,0 +1,121 @@ +/* + * Copyright 2022 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.dataproc.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 BatchController client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataproc.v1.batch-controller") +public class BatchControllerSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getBatch. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getBatchRetry; + /** + * Allow override of retry settings at method-level for listBatches. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listBatchesRetry; + /** + * Allow override of retry settings at method-level for deleteBatch. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteBatchRetry; + + @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 getGetBatchRetry() { + return this.getBatchRetry; + } + + public void setGetBatchRetry(Retry getBatchRetry) { + this.getBatchRetry = getBatchRetry; + } + + public Retry getListBatchesRetry() { + return this.listBatchesRetry; + } + + public void setListBatchesRetry(Retry listBatchesRetry) { + this.listBatchesRetry = listBatchesRetry; + } + + public Retry getDeleteBatchRetry() { + return this.deleteBatchRetry; + } + + public void setDeleteBatchRetry(Retry deleteBatchRetry) { + this.deleteBatchRetry = deleteBatchRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java new file mode 100644 index 0000000000..d47b08e943 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringAutoConfiguration.java @@ -0,0 +1,218 @@ +/* + * Copyright 2022 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.dataproc.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.dataproc.v1.ClusterControllerClient; +import com.google.cloud.dataproc.v1.ClusterControllerSettings; +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 ClusterControllerClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ClusterControllerSpringProperties. 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 ClusterControllerSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ClusterControllerSettings clusterControllerSettings( + @Qualifier("defaultClusterControllerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ClusterControllerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ClusterControllerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ClusterControllerSettings.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 = + ClusterControllerSettings.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 getClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClusterSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings); + + RetrySettings listClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClustersSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getClusterRetry = clientProperties.getGetClusterRetry(); + if (getClusterRetry != null) { + RetrySettings getClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getClusterSettings().getRetrySettings(), getClusterRetry); + clientSettingsBuilder.getClusterSettings().setRetrySettings(getClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCluster from properties."); + } + } + Retry listClustersRetry = clientProperties.getListClustersRetry(); + if (listClustersRetry != null) { + RetrySettings listClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listClustersSettings().getRetrySettings(), listClustersRetry); + clientSettingsBuilder.listClustersSettings().setRetrySettings(listClustersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listClusters from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ClusterControllerClient bean configured with ClusterControllerSettings. + * + * @param clusterControllerSettings settings to configure an instance of client bean. + * @return a {@link ClusterControllerClient} bean configured with {@link + * ClusterControllerSettings} + */ + @Bean + @ConditionalOnMissingBean + public ClusterControllerClient clusterControllerClient( + ClusterControllerSettings clusterControllerSettings) throws IOException { + return ClusterControllerClient.create(clusterControllerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-cluster-controller"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringProperties.java new file mode 100644 index 0000000000..228def96a0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/ClusterControllerSpringProperties.java @@ -0,0 +1,108 @@ +/* + * Copyright 2022 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.dataproc.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 ClusterController client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataproc.v1.cluster-controller") +public class ClusterControllerSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getCluster. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getClusterRetry; + /** + * Allow override of retry settings at method-level for listClusters. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listClustersRetry; + + @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 getGetClusterRetry() { + return this.getClusterRetry; + } + + public void setGetClusterRetry(Retry getClusterRetry) { + this.getClusterRetry = getClusterRetry; + } + + public Retry getListClustersRetry() { + return this.listClustersRetry; + } + + public void setListClustersRetry(Retry listClustersRetry) { + this.listClustersRetry = listClustersRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java new file mode 100644 index 0000000000..9437aaa93a --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringAutoConfiguration.java @@ -0,0 +1,276 @@ +/* + * Copyright 2022 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.dataproc.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.dataproc.v1.JobControllerClient; +import com.google.cloud.dataproc.v1.JobControllerSettings; +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 JobControllerClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in JobControllerSpringProperties. 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 JobControllerSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public JobControllerSettings jobControllerSettings( + @Qualifier("defaultJobControllerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + JobControllerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = JobControllerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = JobControllerSettings.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 = + JobControllerSettings.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 submitJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.submitJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.submitJobSettings().setRetrySettings(submitJobRetrySettings); + + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + + RetrySettings updateJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings); + + RetrySettings cancelJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.cancelJobSettings().setRetrySettings(cancelJobRetrySettings); + + RetrySettings deleteJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry submitJobRetry = clientProperties.getSubmitJobRetry(); + if (submitJobRetry != null) { + RetrySettings submitJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.submitJobSettings().getRetrySettings(), submitJobRetry); + clientSettingsBuilder.submitJobSettings().setRetrySettings(submitJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for submitJob from properties."); + } + } + Retry getJobRetry = clientProperties.getGetJobRetry(); + if (getJobRetry != null) { + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), getJobRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getJob from properties."); + } + } + Retry listJobsRetry = clientProperties.getListJobsRetry(); + if (listJobsRetry != null) { + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), listJobsRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listJobs from properties."); + } + } + Retry updateJobRetry = clientProperties.getUpdateJobRetry(); + if (updateJobRetry != null) { + RetrySettings updateJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateJobSettings().getRetrySettings(), updateJobRetry); + clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateJob from properties."); + } + } + Retry cancelJobRetry = clientProperties.getCancelJobRetry(); + if (cancelJobRetry != null) { + RetrySettings cancelJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelJobSettings().getRetrySettings(), cancelJobRetry); + clientSettingsBuilder.cancelJobSettings().setRetrySettings(cancelJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for cancelJob from properties."); + } + } + Retry deleteJobRetry = clientProperties.getDeleteJobRetry(); + if (deleteJobRetry != null) { + RetrySettings deleteJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteJobSettings().getRetrySettings(), deleteJobRetry); + clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteJob from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a JobControllerClient bean configured with JobControllerSettings. + * + * @param jobControllerSettings settings to configure an instance of client bean. + * @return a {@link JobControllerClient} bean configured with {@link JobControllerSettings} + */ + @Bean + @ConditionalOnMissingBean + public JobControllerClient jobControllerClient(JobControllerSettings jobControllerSettings) + throws IOException { + return JobControllerClient.create(jobControllerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-job-controller"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringProperties.java new file mode 100644 index 0000000000..38650e9cde --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/JobControllerSpringProperties.java @@ -0,0 +1,160 @@ +/* + * Copyright 2022 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.dataproc.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 JobController client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataproc.v1.job-controller") +public class JobControllerSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for submitJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry submitJobRetry; + /** + * Allow override of retry settings at method-level for getJob. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getJobRetry; + /** + * Allow override of retry settings at method-level for listJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listJobsRetry; + /** + * Allow override of retry settings at method-level for updateJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateJobRetry; + /** + * Allow override of retry settings at method-level for cancelJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelJobRetry; + /** + * Allow override of retry settings at method-level for deleteJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteJobRetry; + + @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 getSubmitJobRetry() { + return this.submitJobRetry; + } + + public void setSubmitJobRetry(Retry submitJobRetry) { + this.submitJobRetry = submitJobRetry; + } + + public Retry getGetJobRetry() { + return this.getJobRetry; + } + + public void setGetJobRetry(Retry getJobRetry) { + this.getJobRetry = getJobRetry; + } + + public Retry getListJobsRetry() { + return this.listJobsRetry; + } + + public void setListJobsRetry(Retry listJobsRetry) { + this.listJobsRetry = listJobsRetry; + } + + public Retry getUpdateJobRetry() { + return this.updateJobRetry; + } + + public void setUpdateJobRetry(Retry updateJobRetry) { + this.updateJobRetry = updateJobRetry; + } + + public Retry getCancelJobRetry() { + return this.cancelJobRetry; + } + + public void setCancelJobRetry(Retry cancelJobRetry) { + this.cancelJobRetry = cancelJobRetry; + } + + public Retry getDeleteJobRetry() { + return this.deleteJobRetry; + } + + public void setDeleteJobRetry(Retry deleteJobRetry) { + this.deleteJobRetry = deleteJobRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java new file mode 100644 index 0000000000..6f928f36bb --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * Copyright 2022 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.dataproc.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.dataproc.v1.NodeGroupControllerClient; +import com.google.cloud.dataproc.v1.NodeGroupControllerSettings; +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 NodeGroupControllerClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in NodeGroupControllerSpringProperties. 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 NodeGroupControllerSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public NodeGroupControllerSettings nodeGroupControllerSettings( + @Qualifier("defaultNodeGroupControllerTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + NodeGroupControllerSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = NodeGroupControllerSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = NodeGroupControllerSettings.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 = + NodeGroupControllerSettings.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 getNodeGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNodeGroupSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getNodeGroupSettings().setRetrySettings(getNodeGroupRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getNodeGroupRetry = clientProperties.getGetNodeGroupRetry(); + if (getNodeGroupRetry != null) { + RetrySettings getNodeGroupRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getNodeGroupSettings().getRetrySettings(), getNodeGroupRetry); + clientSettingsBuilder.getNodeGroupSettings().setRetrySettings(getNodeGroupRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getNodeGroup from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a NodeGroupControllerClient bean configured with NodeGroupControllerSettings. + * + * @param nodeGroupControllerSettings settings to configure an instance of client bean. + * @return a {@link NodeGroupControllerClient} bean configured with {@link + * NodeGroupControllerSettings} + */ + @Bean + @ConditionalOnMissingBean + public NodeGroupControllerClient nodeGroupControllerClient( + NodeGroupControllerSettings nodeGroupControllerSettings) throws IOException { + return NodeGroupControllerClient.create(nodeGroupControllerSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-node-group-controller"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringProperties.java new file mode 100644 index 0000000000..671eb9a078 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/NodeGroupControllerSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.dataproc.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 NodeGroupController client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dataproc.v1.node-group-controller") +public class NodeGroupControllerSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getNodeGroup. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getNodeGroupRetry; + + @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 getGetNodeGroupRetry() { + return this.getNodeGroupRetry; + } + + public void setGetNodeGroupRetry(Retry getNodeGroupRetry) { + this.getNodeGroupRetry = getNodeGroupRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4a565e2775 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringAutoConfiguration.java @@ -0,0 +1,298 @@ +/* + * Copyright 2022 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.dataproc.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.dataproc.v1.WorkflowTemplateServiceClient; +import com.google.cloud.dataproc.v1.WorkflowTemplateServiceSettings; +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 WorkflowTemplateServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in WorkflowTemplateServiceSpringProperties. 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 WorkflowTemplateServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WorkflowTemplateServiceSettings workflowTemplateServiceSettings(
+ @Qualifier("defaultWorkflowTemplateServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ WorkflowTemplateServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = WorkflowTemplateServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = WorkflowTemplateServiceSettings.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 =
+ WorkflowTemplateServiceSettings.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 createWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createWorkflowTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createWorkflowTemplateSettings()
+ .setRetrySettings(createWorkflowTemplateRetrySettings);
+
+ RetrySettings getWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkflowTemplateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getWorkflowTemplateSettings()
+ .setRetrySettings(getWorkflowTemplateRetrySettings);
+
+ RetrySettings updateWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateWorkflowTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateWorkflowTemplateSettings()
+ .setRetrySettings(updateWorkflowTemplateRetrySettings);
+
+ RetrySettings listWorkflowTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkflowTemplatesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listWorkflowTemplatesSettings()
+ .setRetrySettings(listWorkflowTemplatesRetrySettings);
+
+ RetrySettings deleteWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteWorkflowTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteWorkflowTemplateSettings()
+ .setRetrySettings(deleteWorkflowTemplateRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createWorkflowTemplateRetry = clientProperties.getCreateWorkflowTemplateRetry();
+ if (createWorkflowTemplateRetry != null) {
+ RetrySettings createWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createWorkflowTemplateSettings().getRetrySettings(),
+ createWorkflowTemplateRetry);
+ clientSettingsBuilder
+ .createWorkflowTemplateSettings()
+ .setRetrySettings(createWorkflowTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createWorkflowTemplate from properties.");
+ }
+ }
+ Retry getWorkflowTemplateRetry = clientProperties.getGetWorkflowTemplateRetry();
+ if (getWorkflowTemplateRetry != null) {
+ RetrySettings getWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkflowTemplateSettings().getRetrySettings(),
+ getWorkflowTemplateRetry);
+ clientSettingsBuilder
+ .getWorkflowTemplateSettings()
+ .setRetrySettings(getWorkflowTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getWorkflowTemplate from properties.");
+ }
+ }
+ Retry updateWorkflowTemplateRetry = clientProperties.getUpdateWorkflowTemplateRetry();
+ if (updateWorkflowTemplateRetry != null) {
+ RetrySettings updateWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateWorkflowTemplateSettings().getRetrySettings(),
+ updateWorkflowTemplateRetry);
+ clientSettingsBuilder
+ .updateWorkflowTemplateSettings()
+ .setRetrySettings(updateWorkflowTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateWorkflowTemplate from properties.");
+ }
+ }
+ Retry listWorkflowTemplatesRetry = clientProperties.getListWorkflowTemplatesRetry();
+ if (listWorkflowTemplatesRetry != null) {
+ RetrySettings listWorkflowTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkflowTemplatesSettings().getRetrySettings(),
+ listWorkflowTemplatesRetry);
+ clientSettingsBuilder
+ .listWorkflowTemplatesSettings()
+ .setRetrySettings(listWorkflowTemplatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listWorkflowTemplates from properties.");
+ }
+ }
+ Retry deleteWorkflowTemplateRetry = clientProperties.getDeleteWorkflowTemplateRetry();
+ if (deleteWorkflowTemplateRetry != null) {
+ RetrySettings deleteWorkflowTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteWorkflowTemplateSettings().getRetrySettings(),
+ deleteWorkflowTemplateRetry);
+ clientSettingsBuilder
+ .deleteWorkflowTemplateSettings()
+ .setRetrySettings(deleteWorkflowTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteWorkflowTemplate from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a WorkflowTemplateServiceClient bean configured with WorkflowTemplateServiceSettings.
+ *
+ * @param workflowTemplateServiceSettings settings to configure an instance of client bean.
+ * @return a {@link WorkflowTemplateServiceClient} bean configured with {@link
+ * WorkflowTemplateServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WorkflowTemplateServiceClient workflowTemplateServiceClient(
+ WorkflowTemplateServiceSettings workflowTemplateServiceSettings) throws IOException {
+ return WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-workflow-template-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringProperties.java
new file mode 100644
index 0000000000..680ac507ee
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/WorkflowTemplateServiceSpringProperties.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2022 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.dataproc.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 WorkflowTemplateService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.dataproc.v1.workflow-template-service")
+public class WorkflowTemplateServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createWorkflowTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createWorkflowTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for getWorkflowTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getWorkflowTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for updateWorkflowTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateWorkflowTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for listWorkflowTemplates. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listWorkflowTemplatesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteWorkflowTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteWorkflowTemplateRetry;
+
+ @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 getCreateWorkflowTemplateRetry() {
+ return this.createWorkflowTemplateRetry;
+ }
+
+ public void setCreateWorkflowTemplateRetry(Retry createWorkflowTemplateRetry) {
+ this.createWorkflowTemplateRetry = createWorkflowTemplateRetry;
+ }
+
+ public Retry getGetWorkflowTemplateRetry() {
+ return this.getWorkflowTemplateRetry;
+ }
+
+ public void setGetWorkflowTemplateRetry(Retry getWorkflowTemplateRetry) {
+ this.getWorkflowTemplateRetry = getWorkflowTemplateRetry;
+ }
+
+ public Retry getUpdateWorkflowTemplateRetry() {
+ return this.updateWorkflowTemplateRetry;
+ }
+
+ public void setUpdateWorkflowTemplateRetry(Retry updateWorkflowTemplateRetry) {
+ this.updateWorkflowTemplateRetry = updateWorkflowTemplateRetry;
+ }
+
+ public Retry getListWorkflowTemplatesRetry() {
+ return this.listWorkflowTemplatesRetry;
+ }
+
+ public void setListWorkflowTemplatesRetry(Retry listWorkflowTemplatesRetry) {
+ this.listWorkflowTemplatesRetry = listWorkflowTemplatesRetry;
+ }
+
+ public Retry getDeleteWorkflowTemplateRetry() {
+ return this.deleteWorkflowTemplateRetry;
+ }
+
+ public void setDeleteWorkflowTemplateRetry(Retry deleteWorkflowTemplateRetry) {
+ this.deleteWorkflowTemplateRetry = deleteWorkflowTemplateRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/package-info.java
new file mode 100644
index 0000000000..5a430d89e3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/java/com/google/cloud/dataproc/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for dataproc. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.dataproc.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..835ca6e727
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,40 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.dataproc.v1.autoscaling-policy-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/AutoscalingPolicyService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataproc.v1.batch-controller.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/BatchController components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataproc.v1.cluster-controller.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/ClusterController components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataproc.v1.job-controller.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/JobController components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataproc.v1.workflow-template-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/WorkflowTemplateService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dataproc.v1.node-group-controller.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dataproc/NodeGroupController components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..22868666dd
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dataproc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,6 @@
+com.google.cloud.dataproc.v1.spring.AutoscalingPolicyServiceSpringAutoConfiguration
+com.google.cloud.dataproc.v1.spring.BatchControllerSpringAutoConfiguration
+com.google.cloud.dataproc.v1.spring.ClusterControllerSpringAutoConfiguration
+com.google.cloud.dataproc.v1.spring.JobControllerSpringAutoConfiguration
+com.google.cloud.dataproc.v1.spring.WorkflowTemplateServiceSpringAutoConfiguration
+com.google.cloud.dataproc.v1.spring.NodeGroupControllerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-datastream-spring-starter/pom.xml
new file mode 100644
index 0000000000..7f377a4de6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DatastreamSpringProperties. 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 DatastreamSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DatastreamSettings datastreamSettings(
+ @Qualifier("defaultDatastreamTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DatastreamSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DatastreamSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DatastreamSettings.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 =
+ DatastreamSettings.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 listConnectionProfilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionProfilesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listConnectionProfilesSettings()
+ .setRetrySettings(listConnectionProfilesRetrySettings);
+
+ RetrySettings getConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionProfileSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getConnectionProfileSettings()
+ .setRetrySettings(getConnectionProfileRetrySettings);
+
+ RetrySettings discoverConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.discoverConnectionProfileSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .discoverConnectionProfileSettings()
+ .setRetrySettings(discoverConnectionProfileRetrySettings);
+
+ RetrySettings listStreamsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStreamsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listStreamsSettings().setRetrySettings(listStreamsRetrySettings);
+
+ RetrySettings getStreamRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStreamSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getStreamSettings().setRetrySettings(getStreamRetrySettings);
+
+ RetrySettings getStreamObjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStreamObjectSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getStreamObjectSettings()
+ .setRetrySettings(getStreamObjectRetrySettings);
+
+ RetrySettings lookupStreamObjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupStreamObjectSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .lookupStreamObjectSettings()
+ .setRetrySettings(lookupStreamObjectRetrySettings);
+
+ RetrySettings listStreamObjectsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStreamObjectsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listStreamObjectsSettings()
+ .setRetrySettings(listStreamObjectsRetrySettings);
+
+ RetrySettings startBackfillJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startBackfillJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .startBackfillJobSettings()
+ .setRetrySettings(startBackfillJobRetrySettings);
+
+ RetrySettings stopBackfillJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopBackfillJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .stopBackfillJobSettings()
+ .setRetrySettings(stopBackfillJobRetrySettings);
+
+ RetrySettings fetchStaticIpsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchStaticIpsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.fetchStaticIpsSettings().setRetrySettings(fetchStaticIpsRetrySettings);
+
+ RetrySettings getPrivateConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPrivateConnectionSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getPrivateConnectionSettings()
+ .setRetrySettings(getPrivateConnectionRetrySettings);
+
+ RetrySettings listPrivateConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPrivateConnectionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listPrivateConnectionsSettings()
+ .setRetrySettings(listPrivateConnectionsRetrySettings);
+
+ RetrySettings getRouteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRouteSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRouteSettings().setRetrySettings(getRouteRetrySettings);
+
+ RetrySettings listRoutesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRoutesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listRoutesSettings().setRetrySettings(listRoutesRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listConnectionProfilesRetry = clientProperties.getListConnectionProfilesRetry();
+ if (listConnectionProfilesRetry != null) {
+ RetrySettings listConnectionProfilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionProfilesSettings().getRetrySettings(),
+ listConnectionProfilesRetry);
+ clientSettingsBuilder
+ .listConnectionProfilesSettings()
+ .setRetrySettings(listConnectionProfilesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listConnectionProfiles from properties.");
+ }
+ }
+ Retry getConnectionProfileRetry = clientProperties.getGetConnectionProfileRetry();
+ if (getConnectionProfileRetry != null) {
+ RetrySettings getConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionProfileSettings().getRetrySettings(),
+ getConnectionProfileRetry);
+ clientSettingsBuilder
+ .getConnectionProfileSettings()
+ .setRetrySettings(getConnectionProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getConnectionProfile from properties.");
+ }
+ }
+ Retry discoverConnectionProfileRetry = clientProperties.getDiscoverConnectionProfileRetry();
+ if (discoverConnectionProfileRetry != null) {
+ RetrySettings discoverConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.discoverConnectionProfileSettings().getRetrySettings(),
+ discoverConnectionProfileRetry);
+ clientSettingsBuilder
+ .discoverConnectionProfileSettings()
+ .setRetrySettings(discoverConnectionProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for discoverConnectionProfile from properties.");
+ }
+ }
+ Retry listStreamsRetry = clientProperties.getListStreamsRetry();
+ if (listStreamsRetry != null) {
+ RetrySettings listStreamsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStreamsSettings().getRetrySettings(), listStreamsRetry);
+ clientSettingsBuilder.listStreamsSettings().setRetrySettings(listStreamsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listStreams from properties.");
+ }
+ }
+ Retry getStreamRetry = clientProperties.getGetStreamRetry();
+ if (getStreamRetry != null) {
+ RetrySettings getStreamRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStreamSettings().getRetrySettings(), getStreamRetry);
+ clientSettingsBuilder.getStreamSettings().setRetrySettings(getStreamRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getStream from properties.");
+ }
+ }
+ Retry getStreamObjectRetry = clientProperties.getGetStreamObjectRetry();
+ if (getStreamObjectRetry != null) {
+ RetrySettings getStreamObjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStreamObjectSettings().getRetrySettings(),
+ getStreamObjectRetry);
+ clientSettingsBuilder
+ .getStreamObjectSettings()
+ .setRetrySettings(getStreamObjectRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getStreamObject from properties.");
+ }
+ }
+ Retry lookupStreamObjectRetry = clientProperties.getLookupStreamObjectRetry();
+ if (lookupStreamObjectRetry != null) {
+ RetrySettings lookupStreamObjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lookupStreamObjectSettings().getRetrySettings(),
+ lookupStreamObjectRetry);
+ clientSettingsBuilder
+ .lookupStreamObjectSettings()
+ .setRetrySettings(lookupStreamObjectRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for lookupStreamObject from properties.");
+ }
+ }
+ Retry listStreamObjectsRetry = clientProperties.getListStreamObjectsRetry();
+ if (listStreamObjectsRetry != null) {
+ RetrySettings listStreamObjectsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStreamObjectsSettings().getRetrySettings(),
+ listStreamObjectsRetry);
+ clientSettingsBuilder
+ .listStreamObjectsSettings()
+ .setRetrySettings(listStreamObjectsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listStreamObjects from properties.");
+ }
+ }
+ Retry startBackfillJobRetry = clientProperties.getStartBackfillJobRetry();
+ if (startBackfillJobRetry != null) {
+ RetrySettings startBackfillJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startBackfillJobSettings().getRetrySettings(),
+ startBackfillJobRetry);
+ clientSettingsBuilder
+ .startBackfillJobSettings()
+ .setRetrySettings(startBackfillJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for startBackfillJob from properties.");
+ }
+ }
+ Retry stopBackfillJobRetry = clientProperties.getStopBackfillJobRetry();
+ if (stopBackfillJobRetry != null) {
+ RetrySettings stopBackfillJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopBackfillJobSettings().getRetrySettings(),
+ stopBackfillJobRetry);
+ clientSettingsBuilder
+ .stopBackfillJobSettings()
+ .setRetrySettings(stopBackfillJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for stopBackfillJob from properties.");
+ }
+ }
+ Retry fetchStaticIpsRetry = clientProperties.getFetchStaticIpsRetry();
+ if (fetchStaticIpsRetry != null) {
+ RetrySettings fetchStaticIpsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchStaticIpsSettings().getRetrySettings(),
+ fetchStaticIpsRetry);
+ clientSettingsBuilder.fetchStaticIpsSettings().setRetrySettings(fetchStaticIpsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for fetchStaticIps from properties.");
+ }
+ }
+ Retry getPrivateConnectionRetry = clientProperties.getGetPrivateConnectionRetry();
+ if (getPrivateConnectionRetry != null) {
+ RetrySettings getPrivateConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPrivateConnectionSettings().getRetrySettings(),
+ getPrivateConnectionRetry);
+ clientSettingsBuilder
+ .getPrivateConnectionSettings()
+ .setRetrySettings(getPrivateConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getPrivateConnection from properties.");
+ }
+ }
+ Retry listPrivateConnectionsRetry = clientProperties.getListPrivateConnectionsRetry();
+ if (listPrivateConnectionsRetry != null) {
+ RetrySettings listPrivateConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPrivateConnectionsSettings().getRetrySettings(),
+ listPrivateConnectionsRetry);
+ clientSettingsBuilder
+ .listPrivateConnectionsSettings()
+ .setRetrySettings(listPrivateConnectionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listPrivateConnections from properties.");
+ }
+ }
+ Retry getRouteRetry = clientProperties.getGetRouteRetry();
+ if (getRouteRetry != null) {
+ RetrySettings getRouteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRouteSettings().getRetrySettings(), getRouteRetry);
+ clientSettingsBuilder.getRouteSettings().setRetrySettings(getRouteRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRoute from properties.");
+ }
+ }
+ Retry listRoutesRetry = clientProperties.getListRoutesRetry();
+ if (listRoutesRetry != null) {
+ RetrySettings listRoutesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRoutesSettings().getRetrySettings(), listRoutesRetry);
+ clientSettingsBuilder.listRoutesSettings().setRetrySettings(listRoutesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRoutes from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DatastreamClient bean configured with DatastreamSettings.
+ *
+ * @param datastreamSettings settings to configure an instance of client bean.
+ * @return a {@link DatastreamClient} bean configured with {@link DatastreamSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DatastreamClient datastreamClient(DatastreamSettings datastreamSettings)
+ throws IOException {
+ return DatastreamClient.create(datastreamSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-datastream";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringProperties.java b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringProperties.java
new file mode 100644
index 0000000000..f100a683d2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/DatastreamSpringProperties.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2022 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.datastream.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 Datastream client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.datastream.v1.datastream")
+public class DatastreamSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listConnectionProfiles. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConnectionProfilesRetry;
+ /**
+ * Allow override of retry settings at method-level for getConnectionProfile. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConnectionProfileRetry;
+ /**
+ * Allow override of retry settings at method-level for discoverConnectionProfile. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry discoverConnectionProfileRetry;
+ /**
+ * Allow override of retry settings at method-level for listStreams. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listStreamsRetry;
+ /**
+ * Allow override of retry settings at method-level for getStream. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getStreamRetry;
+ /**
+ * Allow override of retry settings at method-level for getStreamObject. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getStreamObjectRetry;
+ /**
+ * Allow override of retry settings at method-level for lookupStreamObject. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry lookupStreamObjectRetry;
+ /**
+ * Allow override of retry settings at method-level for listStreamObjects. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listStreamObjectsRetry;
+ /**
+ * Allow override of retry settings at method-level for startBackfillJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry startBackfillJobRetry;
+ /**
+ * Allow override of retry settings at method-level for stopBackfillJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry stopBackfillJobRetry;
+ /**
+ * Allow override of retry settings at method-level for fetchStaticIps. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry fetchStaticIpsRetry;
+ /**
+ * Allow override of retry settings at method-level for getPrivateConnection. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPrivateConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for listPrivateConnections. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPrivateConnectionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRoute. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRouteRetry;
+ /**
+ * Allow override of retry settings at method-level for listRoutes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRoutesRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListConnectionProfilesRetry() {
+ return this.listConnectionProfilesRetry;
+ }
+
+ public void setListConnectionProfilesRetry(Retry listConnectionProfilesRetry) {
+ this.listConnectionProfilesRetry = listConnectionProfilesRetry;
+ }
+
+ public Retry getGetConnectionProfileRetry() {
+ return this.getConnectionProfileRetry;
+ }
+
+ public void setGetConnectionProfileRetry(Retry getConnectionProfileRetry) {
+ this.getConnectionProfileRetry = getConnectionProfileRetry;
+ }
+
+ public Retry getDiscoverConnectionProfileRetry() {
+ return this.discoverConnectionProfileRetry;
+ }
+
+ public void setDiscoverConnectionProfileRetry(Retry discoverConnectionProfileRetry) {
+ this.discoverConnectionProfileRetry = discoverConnectionProfileRetry;
+ }
+
+ public Retry getListStreamsRetry() {
+ return this.listStreamsRetry;
+ }
+
+ public void setListStreamsRetry(Retry listStreamsRetry) {
+ this.listStreamsRetry = listStreamsRetry;
+ }
+
+ public Retry getGetStreamRetry() {
+ return this.getStreamRetry;
+ }
+
+ public void setGetStreamRetry(Retry getStreamRetry) {
+ this.getStreamRetry = getStreamRetry;
+ }
+
+ public Retry getGetStreamObjectRetry() {
+ return this.getStreamObjectRetry;
+ }
+
+ public void setGetStreamObjectRetry(Retry getStreamObjectRetry) {
+ this.getStreamObjectRetry = getStreamObjectRetry;
+ }
+
+ public Retry getLookupStreamObjectRetry() {
+ return this.lookupStreamObjectRetry;
+ }
+
+ public void setLookupStreamObjectRetry(Retry lookupStreamObjectRetry) {
+ this.lookupStreamObjectRetry = lookupStreamObjectRetry;
+ }
+
+ public Retry getListStreamObjectsRetry() {
+ return this.listStreamObjectsRetry;
+ }
+
+ public void setListStreamObjectsRetry(Retry listStreamObjectsRetry) {
+ this.listStreamObjectsRetry = listStreamObjectsRetry;
+ }
+
+ public Retry getStartBackfillJobRetry() {
+ return this.startBackfillJobRetry;
+ }
+
+ public void setStartBackfillJobRetry(Retry startBackfillJobRetry) {
+ this.startBackfillJobRetry = startBackfillJobRetry;
+ }
+
+ public Retry getStopBackfillJobRetry() {
+ return this.stopBackfillJobRetry;
+ }
+
+ public void setStopBackfillJobRetry(Retry stopBackfillJobRetry) {
+ this.stopBackfillJobRetry = stopBackfillJobRetry;
+ }
+
+ public Retry getFetchStaticIpsRetry() {
+ return this.fetchStaticIpsRetry;
+ }
+
+ public void setFetchStaticIpsRetry(Retry fetchStaticIpsRetry) {
+ this.fetchStaticIpsRetry = fetchStaticIpsRetry;
+ }
+
+ public Retry getGetPrivateConnectionRetry() {
+ return this.getPrivateConnectionRetry;
+ }
+
+ public void setGetPrivateConnectionRetry(Retry getPrivateConnectionRetry) {
+ this.getPrivateConnectionRetry = getPrivateConnectionRetry;
+ }
+
+ public Retry getListPrivateConnectionsRetry() {
+ return this.listPrivateConnectionsRetry;
+ }
+
+ public void setListPrivateConnectionsRetry(Retry listPrivateConnectionsRetry) {
+ this.listPrivateConnectionsRetry = listPrivateConnectionsRetry;
+ }
+
+ public Retry getGetRouteRetry() {
+ return this.getRouteRetry;
+ }
+
+ public void setGetRouteRetry(Retry getRouteRetry) {
+ this.getRouteRetry = getRouteRetry;
+ }
+
+ public Retry getListRoutesRetry() {
+ return this.listRoutesRetry;
+ }
+
+ public void setListRoutesRetry(Retry listRoutesRetry) {
+ this.listRoutesRetry = listRoutesRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/package-info.java
new file mode 100644
index 0000000000..545d94e3d9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/java/com/google/cloud/datastream/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for datastream. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.datastream.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..bf1355d4b2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.datastream.v1.datastream.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datastream/Datastream components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..c3edf1e8c7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-datastream-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.datastream.v1.spring.DatastreamSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/pom.xml
new file mode 100644
index 0000000000..95f1c53fba
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in Controller2SpringProperties. 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 Controller2Settings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public Controller2Settings controller2Settings( + @Qualifier("defaultController2TransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + Controller2Settings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = Controller2Settings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = Controller2Settings.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 = + Controller2Settings.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 registerDebuggeeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.registerDebuggeeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .registerDebuggeeSettings() + .setRetrySettings(registerDebuggeeRetrySettings); + + RetrySettings listActiveBreakpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listActiveBreakpointsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listActiveBreakpointsSettings() + .setRetrySettings(listActiveBreakpointsRetrySettings); + + RetrySettings updateActiveBreakpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateActiveBreakpointSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateActiveBreakpointSettings() + .setRetrySettings(updateActiveBreakpointRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry registerDebuggeeRetry = clientProperties.getRegisterDebuggeeRetry(); + if (registerDebuggeeRetry != null) { + RetrySettings registerDebuggeeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.registerDebuggeeSettings().getRetrySettings(), + registerDebuggeeRetry); + clientSettingsBuilder + .registerDebuggeeSettings() + .setRetrySettings(registerDebuggeeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for registerDebuggee from properties."); + } + } + Retry listActiveBreakpointsRetry = clientProperties.getListActiveBreakpointsRetry(); + if (listActiveBreakpointsRetry != null) { + RetrySettings listActiveBreakpointsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listActiveBreakpointsSettings().getRetrySettings(), + listActiveBreakpointsRetry); + clientSettingsBuilder + .listActiveBreakpointsSettings() + .setRetrySettings(listActiveBreakpointsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listActiveBreakpoints from properties."); + } + } + Retry updateActiveBreakpointRetry = clientProperties.getUpdateActiveBreakpointRetry(); + if (updateActiveBreakpointRetry != null) { + RetrySettings updateActiveBreakpointRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateActiveBreakpointSettings().getRetrySettings(), + updateActiveBreakpointRetry); + clientSettingsBuilder + .updateActiveBreakpointSettings() + .setRetrySettings(updateActiveBreakpointRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateActiveBreakpoint from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a Controller2Client bean configured with Controller2Settings. + * + * @param controller2Settings settings to configure an instance of client bean. + * @return a {@link Controller2Client} bean configured with {@link Controller2Settings} + */ + @Bean + @ConditionalOnMissingBean + public Controller2Client controller2Client(Controller2Settings controller2Settings) + throws IOException { + return Controller2Client.create(controller2Settings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-controller2"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringProperties.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringProperties.java new file mode 100644 index 0000000000..002522363a --- /dev/null +++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Controller2SpringProperties.java @@ -0,0 +1,123 @@ +/* + * Copyright 2022 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.debugger.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 Controller2 client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.debugger.v2.controller2") +public class Controller2SpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud_debugger"); + /** 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 registerDebuggee. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry registerDebuggeeRetry; + /** + * Allow override of retry settings at method-level for listActiveBreakpoints. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listActiveBreakpointsRetry; + /** + * Allow override of retry settings at method-level for updateActiveBreakpoint. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateActiveBreakpointRetry; + + @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 getRegisterDebuggeeRetry() { + return this.registerDebuggeeRetry; + } + + public void setRegisterDebuggeeRetry(Retry registerDebuggeeRetry) { + this.registerDebuggeeRetry = registerDebuggeeRetry; + } + + public Retry getListActiveBreakpointsRetry() { + return this.listActiveBreakpointsRetry; + } + + public void setListActiveBreakpointsRetry(Retry listActiveBreakpointsRetry) { + this.listActiveBreakpointsRetry = listActiveBreakpointsRetry; + } + + public Retry getUpdateActiveBreakpointRetry() { + return this.updateActiveBreakpointRetry; + } + + public void setUpdateActiveBreakpointRetry(Retry updateActiveBreakpointRetry) { + this.updateActiveBreakpointRetry = updateActiveBreakpointRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java new file mode 100644 index 0000000000..a860d3eadd --- /dev/null +++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringAutoConfiguration.java @@ -0,0 +1,269 @@ +/* + * Copyright 2022 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.debugger.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.debugger.v2.Debugger2Client; +import com.google.cloud.debugger.v2.Debugger2Settings; +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 Debugger2Client}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in Debugger2SpringProperties. 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 Debugger2Settings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public Debugger2Settings debugger2Settings(
+ @Qualifier("defaultDebugger2TransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ Debugger2Settings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = Debugger2Settings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = Debugger2Settings.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 =
+ Debugger2Settings.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 setBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setBreakpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setBreakpointSettings().setRetrySettings(setBreakpointRetrySettings);
+
+ RetrySettings getBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBreakpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getBreakpointSettings().setRetrySettings(getBreakpointRetrySettings);
+
+ RetrySettings deleteBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBreakpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteBreakpointSettings()
+ .setRetrySettings(deleteBreakpointRetrySettings);
+
+ RetrySettings listBreakpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBreakpointsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listBreakpointsSettings()
+ .setRetrySettings(listBreakpointsRetrySettings);
+
+ RetrySettings listDebuggeesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDebuggeesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listDebuggeesSettings().setRetrySettings(listDebuggeesRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry setBreakpointRetry = clientProperties.getSetBreakpointRetry();
+ if (setBreakpointRetry != null) {
+ RetrySettings setBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setBreakpointSettings().getRetrySettings(), setBreakpointRetry);
+ clientSettingsBuilder.setBreakpointSettings().setRetrySettings(setBreakpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setBreakpoint from properties.");
+ }
+ }
+ Retry getBreakpointRetry = clientProperties.getGetBreakpointRetry();
+ if (getBreakpointRetry != null) {
+ RetrySettings getBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBreakpointSettings().getRetrySettings(), getBreakpointRetry);
+ clientSettingsBuilder.getBreakpointSettings().setRetrySettings(getBreakpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBreakpoint from properties.");
+ }
+ }
+ Retry deleteBreakpointRetry = clientProperties.getDeleteBreakpointRetry();
+ if (deleteBreakpointRetry != null) {
+ RetrySettings deleteBreakpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBreakpointSettings().getRetrySettings(),
+ deleteBreakpointRetry);
+ clientSettingsBuilder
+ .deleteBreakpointSettings()
+ .setRetrySettings(deleteBreakpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteBreakpoint from properties.");
+ }
+ }
+ Retry listBreakpointsRetry = clientProperties.getListBreakpointsRetry();
+ if (listBreakpointsRetry != null) {
+ RetrySettings listBreakpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBreakpointsSettings().getRetrySettings(),
+ listBreakpointsRetry);
+ clientSettingsBuilder
+ .listBreakpointsSettings()
+ .setRetrySettings(listBreakpointsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listBreakpoints from properties.");
+ }
+ }
+ Retry listDebuggeesRetry = clientProperties.getListDebuggeesRetry();
+ if (listDebuggeesRetry != null) {
+ RetrySettings listDebuggeesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDebuggeesSettings().getRetrySettings(), listDebuggeesRetry);
+ clientSettingsBuilder.listDebuggeesSettings().setRetrySettings(listDebuggeesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDebuggees from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a Debugger2Client bean configured with Debugger2Settings.
+ *
+ * @param debugger2Settings settings to configure an instance of client bean.
+ * @return a {@link Debugger2Client} bean configured with {@link Debugger2Settings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public Debugger2Client debugger2Client(Debugger2Settings debugger2Settings) throws IOException {
+ return Debugger2Client.create(debugger2Settings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-debugger2";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringProperties.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringProperties.java
new file mode 100644
index 0000000000..23e9748ad3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/Debugger2SpringProperties.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2022 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.debugger.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 Debugger2 client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.debugger.v2.debugger2")
+public class Debugger2SpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud_debugger");
+ /** 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 setBreakpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setBreakpointRetry;
+ /**
+ * Allow override of retry settings at method-level for getBreakpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBreakpointRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteBreakpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteBreakpointRetry;
+ /**
+ * Allow override of retry settings at method-level for listBreakpoints. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBreakpointsRetry;
+ /**
+ * Allow override of retry settings at method-level for listDebuggees. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDebuggeesRetry;
+
+ @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 getSetBreakpointRetry() {
+ return this.setBreakpointRetry;
+ }
+
+ public void setSetBreakpointRetry(Retry setBreakpointRetry) {
+ this.setBreakpointRetry = setBreakpointRetry;
+ }
+
+ public Retry getGetBreakpointRetry() {
+ return this.getBreakpointRetry;
+ }
+
+ public void setGetBreakpointRetry(Retry getBreakpointRetry) {
+ this.getBreakpointRetry = getBreakpointRetry;
+ }
+
+ public Retry getDeleteBreakpointRetry() {
+ return this.deleteBreakpointRetry;
+ }
+
+ public void setDeleteBreakpointRetry(Retry deleteBreakpointRetry) {
+ this.deleteBreakpointRetry = deleteBreakpointRetry;
+ }
+
+ public Retry getListBreakpointsRetry() {
+ return this.listBreakpointsRetry;
+ }
+
+ public void setListBreakpointsRetry(Retry listBreakpointsRetry) {
+ this.listBreakpointsRetry = listBreakpointsRetry;
+ }
+
+ public Retry getListDebuggeesRetry() {
+ return this.listDebuggeesRetry;
+ }
+
+ public void setListDebuggeesRetry(Retry listDebuggeesRetry) {
+ this.listDebuggeesRetry = listDebuggeesRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/package-info.java
new file mode 100644
index 0000000000..a985222a41
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/java/com/google/cloud/debugger/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for clouddebugger. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.debugger.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..98794bcb7a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.debugger.v2.controller2.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud clouddebugger/Controller2 components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.debugger.v2.debugger2.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud clouddebugger/Debugger2 components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..d798133452
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-debugger-client-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.debugger.v2.spring.Controller2SpringAutoConfiguration
+com.google.cloud.debugger.v2.spring.Debugger2SpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-deploy-spring-starter/pom.xml
new file mode 100644
index 0000000000..f7b93169f0
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudDeploySpringProperties. 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 CloudDeploySettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudDeploySettings cloudDeploySettings(
+ @Qualifier("defaultCloudDeployTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudDeploySettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudDeploySettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudDeploySettings.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 =
+ CloudDeploySettings.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 listDeliveryPipelinesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeliveryPipelinesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listDeliveryPipelinesSettings()
+ .setRetrySettings(listDeliveryPipelinesRetrySettings);
+
+ RetrySettings getDeliveryPipelineRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeliveryPipelineSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getDeliveryPipelineSettings()
+ .setRetrySettings(getDeliveryPipelineRetrySettings);
+
+ RetrySettings listTargetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTargetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTargetsSettings().setRetrySettings(listTargetsRetrySettings);
+
+ RetrySettings getTargetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTargetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTargetSettings().setRetrySettings(getTargetRetrySettings);
+
+ RetrySettings listReleasesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReleasesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listReleasesSettings().setRetrySettings(listReleasesRetrySettings);
+
+ RetrySettings getReleaseRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReleaseSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getReleaseSettings().setRetrySettings(getReleaseRetrySettings);
+
+ RetrySettings abandonReleaseRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.abandonReleaseSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.abandonReleaseSettings().setRetrySettings(abandonReleaseRetrySettings);
+
+ RetrySettings approveRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.approveRolloutSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.approveRolloutSettings().setRetrySettings(approveRolloutRetrySettings);
+
+ RetrySettings listRolloutsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRolloutsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listRolloutsSettings().setRetrySettings(listRolloutsRetrySettings);
+
+ RetrySettings getRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRolloutSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRolloutSettings().setRetrySettings(getRolloutRetrySettings);
+
+ RetrySettings retryJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retryJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.retryJobSettings().setRetrySettings(retryJobRetrySettings);
+
+ RetrySettings listJobRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobRunsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listJobRunsSettings().setRetrySettings(listJobRunsRetrySettings);
+
+ RetrySettings getJobRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJobRunSettings().setRetrySettings(getJobRunRetrySettings);
+
+ RetrySettings getConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getConfigSettings().setRetrySettings(getConfigRetrySettings);
+
+ 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 listDeliveryPipelinesRetry = clientProperties.getListDeliveryPipelinesRetry();
+ if (listDeliveryPipelinesRetry != null) {
+ RetrySettings listDeliveryPipelinesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeliveryPipelinesSettings().getRetrySettings(),
+ listDeliveryPipelinesRetry);
+ clientSettingsBuilder
+ .listDeliveryPipelinesSettings()
+ .setRetrySettings(listDeliveryPipelinesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDeliveryPipelines from properties.");
+ }
+ }
+ Retry getDeliveryPipelineRetry = clientProperties.getGetDeliveryPipelineRetry();
+ if (getDeliveryPipelineRetry != null) {
+ RetrySettings getDeliveryPipelineRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeliveryPipelineSettings().getRetrySettings(),
+ getDeliveryPipelineRetry);
+ clientSettingsBuilder
+ .getDeliveryPipelineSettings()
+ .setRetrySettings(getDeliveryPipelineRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getDeliveryPipeline from properties.");
+ }
+ }
+ Retry listTargetsRetry = clientProperties.getListTargetsRetry();
+ if (listTargetsRetry != null) {
+ RetrySettings listTargetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTargetsSettings().getRetrySettings(), listTargetsRetry);
+ clientSettingsBuilder.listTargetsSettings().setRetrySettings(listTargetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTargets from properties.");
+ }
+ }
+ Retry getTargetRetry = clientProperties.getGetTargetRetry();
+ if (getTargetRetry != null) {
+ RetrySettings getTargetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTargetSettings().getRetrySettings(), getTargetRetry);
+ clientSettingsBuilder.getTargetSettings().setRetrySettings(getTargetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTarget from properties.");
+ }
+ }
+ Retry listReleasesRetry = clientProperties.getListReleasesRetry();
+ if (listReleasesRetry != null) {
+ RetrySettings listReleasesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReleasesSettings().getRetrySettings(), listReleasesRetry);
+ clientSettingsBuilder.listReleasesSettings().setRetrySettings(listReleasesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listReleases from properties.");
+ }
+ }
+ Retry getReleaseRetry = clientProperties.getGetReleaseRetry();
+ if (getReleaseRetry != null) {
+ RetrySettings getReleaseRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReleaseSettings().getRetrySettings(), getReleaseRetry);
+ clientSettingsBuilder.getReleaseSettings().setRetrySettings(getReleaseRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRelease from properties.");
+ }
+ }
+ Retry abandonReleaseRetry = clientProperties.getAbandonReleaseRetry();
+ if (abandonReleaseRetry != null) {
+ RetrySettings abandonReleaseRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.abandonReleaseSettings().getRetrySettings(),
+ abandonReleaseRetry);
+ clientSettingsBuilder.abandonReleaseSettings().setRetrySettings(abandonReleaseRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for abandonRelease from properties.");
+ }
+ }
+ Retry approveRolloutRetry = clientProperties.getApproveRolloutRetry();
+ if (approveRolloutRetry != null) {
+ RetrySettings approveRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.approveRolloutSettings().getRetrySettings(),
+ approveRolloutRetry);
+ clientSettingsBuilder.approveRolloutSettings().setRetrySettings(approveRolloutRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for approveRollout from properties.");
+ }
+ }
+ Retry listRolloutsRetry = clientProperties.getListRolloutsRetry();
+ if (listRolloutsRetry != null) {
+ RetrySettings listRolloutsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRolloutsSettings().getRetrySettings(), listRolloutsRetry);
+ clientSettingsBuilder.listRolloutsSettings().setRetrySettings(listRolloutsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRollouts from properties.");
+ }
+ }
+ Retry getRolloutRetry = clientProperties.getGetRolloutRetry();
+ if (getRolloutRetry != null) {
+ RetrySettings getRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRolloutSettings().getRetrySettings(), getRolloutRetry);
+ clientSettingsBuilder.getRolloutSettings().setRetrySettings(getRolloutRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRollout from properties.");
+ }
+ }
+ Retry retryJobRetry = clientProperties.getRetryJobRetry();
+ if (retryJobRetry != null) {
+ RetrySettings retryJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retryJobSettings().getRetrySettings(), retryJobRetry);
+ clientSettingsBuilder.retryJobSettings().setRetrySettings(retryJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for retryJob from properties.");
+ }
+ }
+ Retry listJobRunsRetry = clientProperties.getListJobRunsRetry();
+ if (listJobRunsRetry != null) {
+ RetrySettings listJobRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobRunsSettings().getRetrySettings(), listJobRunsRetry);
+ clientSettingsBuilder.listJobRunsSettings().setRetrySettings(listJobRunsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listJobRuns from properties.");
+ }
+ }
+ Retry getJobRunRetry = clientProperties.getGetJobRunRetry();
+ if (getJobRunRetry != null) {
+ RetrySettings getJobRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobRunSettings().getRetrySettings(), getJobRunRetry);
+ clientSettingsBuilder.getJobRunSettings().setRetrySettings(getJobRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJobRun from properties.");
+ }
+ }
+ Retry getConfigRetry = clientProperties.getGetConfigRetry();
+ if (getConfigRetry != null) {
+ RetrySettings getConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConfigSettings().getRetrySettings(), getConfigRetry);
+ clientSettingsBuilder.getConfigSettings().setRetrySettings(getConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getConfig 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 CloudDeployClient bean configured with CloudDeploySettings.
+ *
+ * @param cloudDeploySettings settings to configure an instance of client bean.
+ * @return a {@link CloudDeployClient} bean configured with {@link CloudDeploySettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudDeployClient cloudDeployClient(CloudDeploySettings cloudDeploySettings)
+ throws IOException {
+ return CloudDeployClient.create(cloudDeploySettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-deploy";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
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
new file mode 100644
index 0000000000..ed8ff25586
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright 2022 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.deploy.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 CloudDeploy client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.deploy.v1.cloud-deploy")
+public class CloudDeploySpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listDeliveryPipelines. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeliveryPipelinesRetry;
+ /**
+ * Allow override of retry settings at method-level for getDeliveryPipeline. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDeliveryPipelineRetry;
+ /**
+ * Allow override of retry settings at method-level for listTargets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTargetsRetry;
+ /**
+ * Allow override of retry settings at method-level for getTarget. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTargetRetry;
+ /**
+ * Allow override of retry settings at method-level for listReleases. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listReleasesRetry;
+ /**
+ * Allow override of retry settings at method-level for getRelease. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getReleaseRetry;
+ /**
+ * Allow override of retry settings at method-level for abandonRelease. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry abandonReleaseRetry;
+ /**
+ * Allow override of retry settings at method-level for approveRollout. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry approveRolloutRetry;
+ /**
+ * Allow override of retry settings at method-level for listRollouts. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRolloutsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRollout. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRolloutRetry;
+ /**
+ * Allow override of retry settings at method-level for retryJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry retryJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listJobRuns. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listJobRunsRetry;
+ /**
+ * Allow override of retry settings at method-level for getJobRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJobRunRetry;
+ /**
+ * Allow override of retry settings at method-level for getConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListDeliveryPipelinesRetry() {
+ return this.listDeliveryPipelinesRetry;
+ }
+
+ public void setListDeliveryPipelinesRetry(Retry listDeliveryPipelinesRetry) {
+ this.listDeliveryPipelinesRetry = listDeliveryPipelinesRetry;
+ }
+
+ public Retry getGetDeliveryPipelineRetry() {
+ return this.getDeliveryPipelineRetry;
+ }
+
+ public void setGetDeliveryPipelineRetry(Retry getDeliveryPipelineRetry) {
+ this.getDeliveryPipelineRetry = getDeliveryPipelineRetry;
+ }
+
+ public Retry getListTargetsRetry() {
+ return this.listTargetsRetry;
+ }
+
+ public void setListTargetsRetry(Retry listTargetsRetry) {
+ this.listTargetsRetry = listTargetsRetry;
+ }
+
+ public Retry getGetTargetRetry() {
+ return this.getTargetRetry;
+ }
+
+ public void setGetTargetRetry(Retry getTargetRetry) {
+ this.getTargetRetry = getTargetRetry;
+ }
+
+ public Retry getListReleasesRetry() {
+ return this.listReleasesRetry;
+ }
+
+ public void setListReleasesRetry(Retry listReleasesRetry) {
+ this.listReleasesRetry = listReleasesRetry;
+ }
+
+ public Retry getGetReleaseRetry() {
+ return this.getReleaseRetry;
+ }
+
+ public void setGetReleaseRetry(Retry getReleaseRetry) {
+ this.getReleaseRetry = getReleaseRetry;
+ }
+
+ public Retry getAbandonReleaseRetry() {
+ return this.abandonReleaseRetry;
+ }
+
+ public void setAbandonReleaseRetry(Retry abandonReleaseRetry) {
+ this.abandonReleaseRetry = abandonReleaseRetry;
+ }
+
+ public Retry getApproveRolloutRetry() {
+ return this.approveRolloutRetry;
+ }
+
+ public void setApproveRolloutRetry(Retry approveRolloutRetry) {
+ this.approveRolloutRetry = approveRolloutRetry;
+ }
+
+ public Retry getListRolloutsRetry() {
+ return this.listRolloutsRetry;
+ }
+
+ public void setListRolloutsRetry(Retry listRolloutsRetry) {
+ this.listRolloutsRetry = listRolloutsRetry;
+ }
+
+ public Retry getGetRolloutRetry() {
+ return this.getRolloutRetry;
+ }
+
+ public void setGetRolloutRetry(Retry getRolloutRetry) {
+ this.getRolloutRetry = getRolloutRetry;
+ }
+
+ public Retry getRetryJobRetry() {
+ return this.retryJobRetry;
+ }
+
+ public void setRetryJobRetry(Retry retryJobRetry) {
+ this.retryJobRetry = retryJobRetry;
+ }
+
+ public Retry getListJobRunsRetry() {
+ return this.listJobRunsRetry;
+ }
+
+ public void setListJobRunsRetry(Retry listJobRunsRetry) {
+ this.listJobRunsRetry = listJobRunsRetry;
+ }
+
+ public Retry getGetJobRunRetry() {
+ return this.getJobRunRetry;
+ }
+
+ public void setGetJobRunRetry(Retry getJobRunRetry) {
+ this.getJobRunRetry = getJobRunRetry;
+ }
+
+ public Retry getGetConfigRetry() {
+ return this.getConfigRetry;
+ }
+
+ public void setGetConfigRetry(Retry getConfigRetry) {
+ this.getConfigRetry = getConfigRetry;
+ }
+
+ 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-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/package-info.java
new file mode 100644
index 0000000000..ada0f7891f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for clouddeploy. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.deploy.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..7cc48fadb3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.deploy.v1.cloud-deploy.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud clouddeploy/CloudDeploy components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..2315628e92
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.deploy.v1.spring.CloudDeploySpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/pom.xml
new file mode 100644
index 0000000000..395d203dee
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AgentsSpringProperties. 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 AgentsSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public AgentsSettings agentsSettings( + @Qualifier("defaultAgentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AgentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AgentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AgentsSettings.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 = + AgentsSettings.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 getAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAgentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getAgentSettings().setRetrySettings(getAgentRetrySettings); + + RetrySettings setAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setAgentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.setAgentSettings().setRetrySettings(setAgentRetrySettings); + + RetrySettings deleteAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAgentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteAgentSettings().setRetrySettings(deleteAgentRetrySettings); + + RetrySettings searchAgentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchAgentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchAgentsSettings().setRetrySettings(searchAgentsRetrySettings); + + RetrySettings getValidationResultRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getValidationResultSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getValidationResultSettings() + .setRetrySettings(getValidationResultRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getAgentRetry = clientProperties.getGetAgentRetry(); + if (getAgentRetry != null) { + RetrySettings getAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAgentSettings().getRetrySettings(), getAgentRetry); + clientSettingsBuilder.getAgentSettings().setRetrySettings(getAgentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getAgent from properties."); + } + } + Retry setAgentRetry = clientProperties.getSetAgentRetry(); + if (setAgentRetry != null) { + RetrySettings setAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setAgentSettings().getRetrySettings(), setAgentRetry); + clientSettingsBuilder.setAgentSettings().setRetrySettings(setAgentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for setAgent from properties."); + } + } + Retry deleteAgentRetry = clientProperties.getDeleteAgentRetry(); + if (deleteAgentRetry != null) { + RetrySettings deleteAgentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAgentSettings().getRetrySettings(), deleteAgentRetry); + clientSettingsBuilder.deleteAgentSettings().setRetrySettings(deleteAgentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteAgent from properties."); + } + } + Retry searchAgentsRetry = clientProperties.getSearchAgentsRetry(); + if (searchAgentsRetry != null) { + RetrySettings searchAgentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchAgentsSettings().getRetrySettings(), searchAgentsRetry); + clientSettingsBuilder.searchAgentsSettings().setRetrySettings(searchAgentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchAgents from properties."); + } + } + Retry getValidationResultRetry = clientProperties.getGetValidationResultRetry(); + if (getValidationResultRetry != null) { + RetrySettings getValidationResultRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getValidationResultSettings().getRetrySettings(), + getValidationResultRetry); + clientSettingsBuilder + .getValidationResultSettings() + .setRetrySettings(getValidationResultRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getValidationResult from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AgentsClient bean configured with AgentsSettings. + * + * @param agentsSettings settings to configure an instance of client bean. + * @return a {@link AgentsClient} bean configured with {@link AgentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public AgentsClient agentsClient(AgentsSettings agentsSettings) throws IOException { + return AgentsClient.create(agentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-agents"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringProperties.java new file mode 100644 index 0000000000..801c8c48c7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AgentsSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 Agents client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.agents") +public class AgentsSpringProperties 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/dialogflow"); + /** 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 getAgent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAgentRetry; + /** + * Allow override of retry settings at method-level for setAgent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setAgentRetry; + /** + * Allow override of retry settings at method-level for deleteAgent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteAgentRetry; + /** + * Allow override of retry settings at method-level for searchAgents. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchAgentsRetry; + /** + * Allow override of retry settings at method-level for getValidationResult. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getValidationResultRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetAgentRetry() { + return this.getAgentRetry; + } + + public void setGetAgentRetry(Retry getAgentRetry) { + this.getAgentRetry = getAgentRetry; + } + + public Retry getSetAgentRetry() { + return this.setAgentRetry; + } + + public void setSetAgentRetry(Retry setAgentRetry) { + this.setAgentRetry = setAgentRetry; + } + + public Retry getDeleteAgentRetry() { + return this.deleteAgentRetry; + } + + public void setDeleteAgentRetry(Retry deleteAgentRetry) { + this.deleteAgentRetry = deleteAgentRetry; + } + + public Retry getSearchAgentsRetry() { + return this.searchAgentsRetry; + } + + public void setSearchAgentsRetry(Retry searchAgentsRetry) { + this.searchAgentsRetry = searchAgentsRetry; + } + + public Retry getGetValidationResultRetry() { + return this.getValidationResultRetry; + } + + public void setGetValidationResultRetry(Retry getValidationResultRetry) { + this.getValidationResultRetry = getValidationResultRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java new file mode 100644 index 0000000000..aa08a53706 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringAutoConfiguration.java @@ -0,0 +1,258 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.dialogflow.v2.AnswerRecordsSettings; +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 AnswerRecordsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in AnswerRecordsSpringProperties. 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 AnswerRecordsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public AnswerRecordsSettings answerRecordsSettings( + @Qualifier("defaultAnswerRecordsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + AnswerRecordsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = AnswerRecordsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = AnswerRecordsSettings.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 = + AnswerRecordsSettings.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 listAnswerRecordsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAnswerRecordsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listAnswerRecordsSettings() + .setRetrySettings(listAnswerRecordsRetrySettings); + + RetrySettings updateAnswerRecordRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAnswerRecordSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateAnswerRecordSettings() + .setRetrySettings(updateAnswerRecordRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listAnswerRecordsRetry = clientProperties.getListAnswerRecordsRetry(); + if (listAnswerRecordsRetry != null) { + RetrySettings listAnswerRecordsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listAnswerRecordsSettings().getRetrySettings(), + listAnswerRecordsRetry); + clientSettingsBuilder + .listAnswerRecordsSettings() + .setRetrySettings(listAnswerRecordsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listAnswerRecords from properties."); + } + } + Retry updateAnswerRecordRetry = clientProperties.getUpdateAnswerRecordRetry(); + if (updateAnswerRecordRetry != null) { + RetrySettings updateAnswerRecordRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAnswerRecordSettings().getRetrySettings(), + updateAnswerRecordRetry); + clientSettingsBuilder + .updateAnswerRecordSettings() + .setRetrySettings(updateAnswerRecordRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateAnswerRecord from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a AnswerRecordsClient bean configured with AnswerRecordsSettings. + * + * @param answerRecordsSettings settings to configure an instance of client bean. + * @return a {@link AnswerRecordsClient} bean configured with {@link AnswerRecordsSettings} + */ + @Bean + @ConditionalOnMissingBean + public AnswerRecordsClient answerRecordsClient(AnswerRecordsSettings answerRecordsSettings) + throws IOException { + return AnswerRecordsClient.create(answerRecordsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-answer-records"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringProperties.java new file mode 100644 index 0000000000..a188ae6e7f --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/AnswerRecordsSpringProperties.java @@ -0,0 +1,136 @@ +/* + * Copyright 2022 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.dialogflow.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 AnswerRecords client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.answer-records") +public class AnswerRecordsSpringProperties 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/dialogflow"); + /** 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 listAnswerRecords. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listAnswerRecordsRetry; + /** + * Allow override of retry settings at method-level for updateAnswerRecord. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateAnswerRecordRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListAnswerRecordsRetry() { + return this.listAnswerRecordsRetry; + } + + public void setListAnswerRecordsRetry(Retry listAnswerRecordsRetry) { + this.listAnswerRecordsRetry = listAnswerRecordsRetry; + } + + public Retry getUpdateAnswerRecordRetry() { + return this.updateAnswerRecordRetry; + } + + public void setUpdateAnswerRecordRetry(Retry updateAnswerRecordRetry) { + this.updateAnswerRecordRetry = updateAnswerRecordRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java new file mode 100644 index 0000000000..b1845aa2ad --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringAutoConfiguration.java @@ -0,0 +1,309 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ContextsClient; +import com.google.cloud.dialogflow.v2.ContextsSettings; +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 ContextsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ContextsSpringProperties. 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 ContextsSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ContextsSettings contextsSettings( + @Qualifier("defaultContextsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ContextsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ContextsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ContextsSettings.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 = + ContextsSettings.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 listContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContextsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listContextsSettings().setRetrySettings(listContextsRetrySettings); + + RetrySettings getContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getContextSettings().setRetrySettings(getContextRetrySettings); + + RetrySettings createContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createContextSettings().setRetrySettings(createContextRetrySettings); + + RetrySettings updateContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateContextSettings().setRetrySettings(updateContextRetrySettings); + + RetrySettings deleteContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteContextSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteContextSettings().setRetrySettings(deleteContextRetrySettings); + + RetrySettings deleteAllContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAllContextsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteAllContextsSettings() + .setRetrySettings(deleteAllContextsRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listContextsRetry = clientProperties.getListContextsRetry(); + if (listContextsRetry != null) { + RetrySettings listContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listContextsSettings().getRetrySettings(), listContextsRetry); + clientSettingsBuilder.listContextsSettings().setRetrySettings(listContextsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listContexts from properties."); + } + } + Retry getContextRetry = clientProperties.getGetContextRetry(); + if (getContextRetry != null) { + RetrySettings getContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getContextSettings().getRetrySettings(), getContextRetry); + clientSettingsBuilder.getContextSettings().setRetrySettings(getContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getContext from properties."); + } + } + Retry createContextRetry = clientProperties.getCreateContextRetry(); + if (createContextRetry != null) { + RetrySettings createContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createContextSettings().getRetrySettings(), createContextRetry); + clientSettingsBuilder.createContextSettings().setRetrySettings(createContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createContext from properties."); + } + } + Retry updateContextRetry = clientProperties.getUpdateContextRetry(); + if (updateContextRetry != null) { + RetrySettings updateContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateContextSettings().getRetrySettings(), updateContextRetry); + clientSettingsBuilder.updateContextSettings().setRetrySettings(updateContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateContext from properties."); + } + } + Retry deleteContextRetry = clientProperties.getDeleteContextRetry(); + if (deleteContextRetry != null) { + RetrySettings deleteContextRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteContextSettings().getRetrySettings(), deleteContextRetry); + clientSettingsBuilder.deleteContextSettings().setRetrySettings(deleteContextRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteContext from properties."); + } + } + Retry deleteAllContextsRetry = clientProperties.getDeleteAllContextsRetry(); + if (deleteAllContextsRetry != null) { + RetrySettings deleteAllContextsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteAllContextsSettings().getRetrySettings(), + deleteAllContextsRetry); + clientSettingsBuilder + .deleteAllContextsSettings() + .setRetrySettings(deleteAllContextsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteAllContexts from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ContextsClient bean configured with ContextsSettings. + * + * @param contextsSettings settings to configure an instance of client bean. + * @return a {@link ContextsClient} bean configured with {@link ContextsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ContextsClient contextsClient(ContextsSettings contextsSettings) throws IOException { + return ContextsClient.create(contextsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-contexts"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringProperties.java new file mode 100644 index 0000000000..10528bcd23 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ContextsSpringProperties.java @@ -0,0 +1,188 @@ +/* + * Copyright 2022 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.dialogflow.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 Contexts client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.contexts") +public class ContextsSpringProperties 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/dialogflow"); + /** 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 listContexts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listContextsRetry; + /** + * Allow override of retry settings at method-level for getContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getContextRetry; + /** + * Allow override of retry settings at method-level for createContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createContextRetry; + /** + * Allow override of retry settings at method-level for updateContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateContextRetry; + /** + * Allow override of retry settings at method-level for deleteContext. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteContextRetry; + /** + * Allow override of retry settings at method-level for deleteAllContexts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteAllContextsRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListContextsRetry() { + return this.listContextsRetry; + } + + public void setListContextsRetry(Retry listContextsRetry) { + this.listContextsRetry = listContextsRetry; + } + + public Retry getGetContextRetry() { + return this.getContextRetry; + } + + public void setGetContextRetry(Retry getContextRetry) { + this.getContextRetry = getContextRetry; + } + + public Retry getCreateContextRetry() { + return this.createContextRetry; + } + + public void setCreateContextRetry(Retry createContextRetry) { + this.createContextRetry = createContextRetry; + } + + public Retry getUpdateContextRetry() { + return this.updateContextRetry; + } + + public void setUpdateContextRetry(Retry updateContextRetry) { + this.updateContextRetry = updateContextRetry; + } + + public Retry getDeleteContextRetry() { + return this.deleteContextRetry; + } + + public void setDeleteContextRetry(Retry deleteContextRetry) { + this.deleteContextRetry = deleteContextRetry; + } + + public Retry getDeleteAllContextsRetry() { + return this.deleteAllContextsRetry; + } + + public void setDeleteAllContextsRetry(Retry deleteAllContextsRetry) { + this.deleteAllContextsRetry = deleteAllContextsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java new file mode 100644 index 0000000000..57b7334428 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringAutoConfiguration.java @@ -0,0 +1,263 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.dialogflow.v2.ConversationDatasetsSettings; +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 ConversationDatasetsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ConversationDatasetsSpringProperties. 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 ConversationDatasetsSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConversationDatasetsSettings conversationDatasetsSettings( + @Qualifier("defaultConversationDatasetsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConversationDatasetsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConversationDatasetsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConversationDatasetsSettings.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 = + ConversationDatasetsSettings.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 getConversationDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationDatasetSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getConversationDatasetSettings() + .setRetrySettings(getConversationDatasetRetrySettings); + + RetrySettings listConversationDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationDatasetsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listConversationDatasetsSettings() + .setRetrySettings(listConversationDatasetsRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getConversationDatasetRetry = clientProperties.getGetConversationDatasetRetry(); + if (getConversationDatasetRetry != null) { + RetrySettings getConversationDatasetRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationDatasetSettings().getRetrySettings(), + getConversationDatasetRetry); + clientSettingsBuilder + .getConversationDatasetSettings() + .setRetrySettings(getConversationDatasetRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getConversationDataset from properties."); + } + } + Retry listConversationDatasetsRetry = clientProperties.getListConversationDatasetsRetry(); + if (listConversationDatasetsRetry != null) { + RetrySettings listConversationDatasetsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationDatasetsSettings().getRetrySettings(), + listConversationDatasetsRetry); + clientSettingsBuilder + .listConversationDatasetsSettings() + .setRetrySettings(listConversationDatasetsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversationDatasets from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConversationDatasetsClient bean configured with ConversationDatasetsSettings. + * + * @param conversationDatasetsSettings settings to configure an instance of client bean. + * @return a {@link ConversationDatasetsClient} bean configured with {@link + * ConversationDatasetsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConversationDatasetsClient conversationDatasetsClient( + ConversationDatasetsSettings conversationDatasetsSettings) throws IOException { + return ConversationDatasetsClient.create(conversationDatasetsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-conversation-datasets"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringProperties.java new file mode 100644 index 0000000000..8b7922a480 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationDatasetsSpringProperties.java @@ -0,0 +1,136 @@ +/* + * Copyright 2022 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.dialogflow.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 ConversationDatasets client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.conversation-datasets") +public class ConversationDatasetsSpringProperties 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/dialogflow"); + /** 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 getConversationDataset. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationDatasetRetry; + /** + * Allow override of retry settings at method-level for listConversationDatasets. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationDatasetsRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetConversationDatasetRetry() { + return this.getConversationDatasetRetry; + } + + public void setGetConversationDatasetRetry(Retry getConversationDatasetRetry) { + this.getConversationDatasetRetry = getConversationDatasetRetry; + } + + public Retry getListConversationDatasetsRetry() { + return this.listConversationDatasetsRetry; + } + + public void setListConversationDatasetsRetry(Retry listConversationDatasetsRetry) { + this.listConversationDatasetsRetry = listConversationDatasetsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java new file mode 100644 index 0000000000..97ac20a142 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringAutoConfiguration.java @@ -0,0 +1,308 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.dialogflow.v2.ConversationModelsSettings; +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 ConversationModelsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ConversationModelsSpringProperties. 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 ConversationModelsSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConversationModelsSettings conversationModelsSettings( + @Qualifier("defaultConversationModelsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConversationModelsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConversationModelsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConversationModelsSettings.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 = + ConversationModelsSettings.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 getConversationModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationModelSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getConversationModelSettings() + .setRetrySettings(getConversationModelRetrySettings); + + RetrySettings listConversationModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationModelsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listConversationModelsSettings() + .setRetrySettings(listConversationModelsRetrySettings); + + RetrySettings getConversationModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationModelEvaluationSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getConversationModelEvaluationSettings() + .setRetrySettings(getConversationModelEvaluationRetrySettings); + + RetrySettings listConversationModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationModelEvaluationsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listConversationModelEvaluationsSettings() + .setRetrySettings(listConversationModelEvaluationsRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getConversationModelRetry = clientProperties.getGetConversationModelRetry(); + if (getConversationModelRetry != null) { + RetrySettings getConversationModelRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationModelSettings().getRetrySettings(), + getConversationModelRetry); + clientSettingsBuilder + .getConversationModelSettings() + .setRetrySettings(getConversationModelRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getConversationModel from properties."); + } + } + Retry listConversationModelsRetry = clientProperties.getListConversationModelsRetry(); + if (listConversationModelsRetry != null) { + RetrySettings listConversationModelsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationModelsSettings().getRetrySettings(), + listConversationModelsRetry); + clientSettingsBuilder + .listConversationModelsSettings() + .setRetrySettings(listConversationModelsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversationModels from properties."); + } + } + Retry getConversationModelEvaluationRetry = + clientProperties.getGetConversationModelEvaluationRetry(); + if (getConversationModelEvaluationRetry != null) { + RetrySettings getConversationModelEvaluationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationModelEvaluationSettings().getRetrySettings(), + getConversationModelEvaluationRetry); + clientSettingsBuilder + .getConversationModelEvaluationSettings() + .setRetrySettings(getConversationModelEvaluationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getConversationModelEvaluation from properties."); + } + } + Retry listConversationModelEvaluationsRetry = + clientProperties.getListConversationModelEvaluationsRetry(); + if (listConversationModelEvaluationsRetry != null) { + RetrySettings listConversationModelEvaluationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationModelEvaluationsSettings().getRetrySettings(), + listConversationModelEvaluationsRetry); + clientSettingsBuilder + .listConversationModelEvaluationsSettings() + .setRetrySettings(listConversationModelEvaluationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversationModelEvaluations from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConversationModelsClient bean configured with ConversationModelsSettings. + * + * @param conversationModelsSettings settings to configure an instance of client bean. + * @return a {@link ConversationModelsClient} bean configured with {@link + * ConversationModelsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConversationModelsClient conversationModelsClient( + ConversationModelsSettings conversationModelsSettings) throws IOException { + return ConversationModelsClient.create(conversationModelsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-conversation-models"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringProperties.java new file mode 100644 index 0000000000..e5fef002a0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationModelsSpringProperties.java @@ -0,0 +1,163 @@ +/* + * Copyright 2022 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.dialogflow.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 ConversationModels client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.conversation-models") +public class ConversationModelsSpringProperties 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/dialogflow"); + /** 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 getConversationModel. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationModelRetry; + /** + * Allow override of retry settings at method-level for listConversationModels. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationModelsRetry; + /** + * Allow override of retry settings at method-level for getConversationModelEvaluation. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationModelEvaluationRetry; + /** + * Allow override of retry settings at method-level for listConversationModelEvaluations. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationModelEvaluationsRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetConversationModelRetry() { + return this.getConversationModelRetry; + } + + public void setGetConversationModelRetry(Retry getConversationModelRetry) { + this.getConversationModelRetry = getConversationModelRetry; + } + + public Retry getListConversationModelsRetry() { + return this.listConversationModelsRetry; + } + + public void setListConversationModelsRetry(Retry listConversationModelsRetry) { + this.listConversationModelsRetry = listConversationModelsRetry; + } + + public Retry getGetConversationModelEvaluationRetry() { + return this.getConversationModelEvaluationRetry; + } + + public void setGetConversationModelEvaluationRetry(Retry getConversationModelEvaluationRetry) { + this.getConversationModelEvaluationRetry = getConversationModelEvaluationRetry; + } + + public Retry getListConversationModelEvaluationsRetry() { + return this.listConversationModelEvaluationsRetry; + } + + public void setListConversationModelEvaluationsRetry( + Retry listConversationModelEvaluationsRetry) { + this.listConversationModelEvaluationsRetry = listConversationModelEvaluationsRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java new file mode 100644 index 0000000000..548ae072b9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringAutoConfiguration.java @@ -0,0 +1,329 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.dialogflow.v2.ConversationProfilesSettings; +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 ConversationProfilesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ConversationProfilesSpringProperties. 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 ConversationProfilesSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ConversationProfilesSettings conversationProfilesSettings( + @Qualifier("defaultConversationProfilesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConversationProfilesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConversationProfilesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConversationProfilesSettings.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 = + ConversationProfilesSettings.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 listConversationProfilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationProfilesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listConversationProfilesSettings() + .setRetrySettings(listConversationProfilesRetrySettings); + + RetrySettings getConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationProfileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getConversationProfileSettings() + .setRetrySettings(getConversationProfileRetrySettings); + + RetrySettings createConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationProfileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createConversationProfileSettings() + .setRetrySettings(createConversationProfileRetrySettings); + + RetrySettings updateConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateConversationProfileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateConversationProfileSettings() + .setRetrySettings(updateConversationProfileRetrySettings); + + RetrySettings deleteConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteConversationProfileSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteConversationProfileSettings() + .setRetrySettings(deleteConversationProfileRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listConversationProfilesRetry = clientProperties.getListConversationProfilesRetry(); + if (listConversationProfilesRetry != null) { + RetrySettings listConversationProfilesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationProfilesSettings().getRetrySettings(), + listConversationProfilesRetry); + clientSettingsBuilder + .listConversationProfilesSettings() + .setRetrySettings(listConversationProfilesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversationProfiles from properties."); + } + } + Retry getConversationProfileRetry = clientProperties.getGetConversationProfileRetry(); + if (getConversationProfileRetry != null) { + RetrySettings getConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationProfileSettings().getRetrySettings(), + getConversationProfileRetry); + clientSettingsBuilder + .getConversationProfileSettings() + .setRetrySettings(getConversationProfileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getConversationProfile from properties."); + } + } + Retry createConversationProfileRetry = clientProperties.getCreateConversationProfileRetry(); + if (createConversationProfileRetry != null) { + RetrySettings createConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationProfileSettings().getRetrySettings(), + createConversationProfileRetry); + clientSettingsBuilder + .createConversationProfileSettings() + .setRetrySettings(createConversationProfileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createConversationProfile from properties."); + } + } + Retry updateConversationProfileRetry = clientProperties.getUpdateConversationProfileRetry(); + if (updateConversationProfileRetry != null) { + RetrySettings updateConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateConversationProfileSettings().getRetrySettings(), + updateConversationProfileRetry); + clientSettingsBuilder + .updateConversationProfileSettings() + .setRetrySettings(updateConversationProfileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateConversationProfile from properties."); + } + } + Retry deleteConversationProfileRetry = clientProperties.getDeleteConversationProfileRetry(); + if (deleteConversationProfileRetry != null) { + RetrySettings deleteConversationProfileRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteConversationProfileSettings().getRetrySettings(), + deleteConversationProfileRetry); + clientSettingsBuilder + .deleteConversationProfileSettings() + .setRetrySettings(deleteConversationProfileRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteConversationProfile from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConversationProfilesClient bean configured with ConversationProfilesSettings. + * + * @param conversationProfilesSettings settings to configure an instance of client bean. + * @return a {@link ConversationProfilesClient} bean configured with {@link + * ConversationProfilesSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConversationProfilesClient conversationProfilesClient( + ConversationProfilesSettings conversationProfilesSettings) throws IOException { + return ConversationProfilesClient.create(conversationProfilesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-conversation-profiles"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringProperties.java new file mode 100644 index 0000000000..85549e48e0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationProfilesSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 ConversationProfiles client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.conversation-profiles") +public class ConversationProfilesSpringProperties 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/dialogflow"); + /** 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 listConversationProfiles. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationProfilesRetry; + /** + * Allow override of retry settings at method-level for getConversationProfile. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationProfileRetry; + /** + * Allow override of retry settings at method-level for createConversationProfile. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createConversationProfileRetry; + /** + * Allow override of retry settings at method-level for updateConversationProfile. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateConversationProfileRetry; + /** + * Allow override of retry settings at method-level for deleteConversationProfile. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteConversationProfileRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListConversationProfilesRetry() { + return this.listConversationProfilesRetry; + } + + public void setListConversationProfilesRetry(Retry listConversationProfilesRetry) { + this.listConversationProfilesRetry = listConversationProfilesRetry; + } + + public Retry getGetConversationProfileRetry() { + return this.getConversationProfileRetry; + } + + public void setGetConversationProfileRetry(Retry getConversationProfileRetry) { + this.getConversationProfileRetry = getConversationProfileRetry; + } + + public Retry getCreateConversationProfileRetry() { + return this.createConversationProfileRetry; + } + + public void setCreateConversationProfileRetry(Retry createConversationProfileRetry) { + this.createConversationProfileRetry = createConversationProfileRetry; + } + + public Retry getUpdateConversationProfileRetry() { + return this.updateConversationProfileRetry; + } + + public void setUpdateConversationProfileRetry(Retry updateConversationProfileRetry) { + this.updateConversationProfileRetry = updateConversationProfileRetry; + } + + public Retry getDeleteConversationProfileRetry() { + return this.deleteConversationProfileRetry; + } + + public void setDeleteConversationProfileRetry(Retry deleteConversationProfileRetry) { + this.deleteConversationProfileRetry = deleteConversationProfileRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java new file mode 100644 index 0000000000..9e5f39c166 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringAutoConfiguration.java @@ -0,0 +1,315 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ConversationsClient; +import com.google.cloud.dialogflow.v2.ConversationsSettings; +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 ConversationsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ConversationsSpringProperties. 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 ConversationsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ConversationsSettings conversationsSettings( + @Qualifier("defaultConversationsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ConversationsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ConversationsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ConversationsSettings.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 = + ConversationsSettings.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 createConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createConversationSettings() + .setRetrySettings(createConversationRetrySettings); + + RetrySettings listConversationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listConversationsSettings() + .setRetrySettings(listConversationsRetrySettings); + + RetrySettings getConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getConversationSettings() + .setRetrySettings(getConversationRetrySettings); + + RetrySettings completeConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeConversationSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .completeConversationSettings() + .setRetrySettings(completeConversationRetrySettings); + + RetrySettings listMessagesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMessagesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listMessagesSettings().setRetrySettings(listMessagesRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createConversationRetry = clientProperties.getCreateConversationRetry(); + if (createConversationRetry != null) { + RetrySettings createConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createConversationSettings().getRetrySettings(), + createConversationRetry); + clientSettingsBuilder + .createConversationSettings() + .setRetrySettings(createConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createConversation from properties."); + } + } + Retry listConversationsRetry = clientProperties.getListConversationsRetry(); + if (listConversationsRetry != null) { + RetrySettings listConversationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listConversationsSettings().getRetrySettings(), + listConversationsRetry); + clientSettingsBuilder + .listConversationsSettings() + .setRetrySettings(listConversationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listConversations from properties."); + } + } + Retry getConversationRetry = clientProperties.getGetConversationRetry(); + if (getConversationRetry != null) { + RetrySettings getConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getConversationSettings().getRetrySettings(), + getConversationRetry); + clientSettingsBuilder + .getConversationSettings() + .setRetrySettings(getConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getConversation from properties."); + } + } + Retry completeConversationRetry = clientProperties.getCompleteConversationRetry(); + if (completeConversationRetry != null) { + RetrySettings completeConversationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeConversationSettings().getRetrySettings(), + completeConversationRetry); + clientSettingsBuilder + .completeConversationSettings() + .setRetrySettings(completeConversationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for completeConversation from properties."); + } + } + Retry listMessagesRetry = clientProperties.getListMessagesRetry(); + if (listMessagesRetry != null) { + RetrySettings listMessagesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listMessagesSettings().getRetrySettings(), listMessagesRetry); + clientSettingsBuilder.listMessagesSettings().setRetrySettings(listMessagesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listMessages from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ConversationsClient bean configured with ConversationsSettings. + * + * @param conversationsSettings settings to configure an instance of client bean. + * @return a {@link ConversationsClient} bean configured with {@link ConversationsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ConversationsClient conversationsClient(ConversationsSettings conversationsSettings) + throws IOException { + return ConversationsClient.create(conversationsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-conversations"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringProperties.java new file mode 100644 index 0000000000..083bee9925 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ConversationsSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 Conversations client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.conversations") +public class ConversationsSpringProperties 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/dialogflow"); + /** 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 createConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createConversationRetry; + /** + * Allow override of retry settings at method-level for listConversations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listConversationsRetry; + /** + * Allow override of retry settings at method-level for getConversation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getConversationRetry; + /** + * Allow override of retry settings at method-level for completeConversation. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry completeConversationRetry; + /** + * Allow override of retry settings at method-level for listMessages. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listMessagesRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCreateConversationRetry() { + return this.createConversationRetry; + } + + public void setCreateConversationRetry(Retry createConversationRetry) { + this.createConversationRetry = createConversationRetry; + } + + public Retry getListConversationsRetry() { + return this.listConversationsRetry; + } + + public void setListConversationsRetry(Retry listConversationsRetry) { + this.listConversationsRetry = listConversationsRetry; + } + + public Retry getGetConversationRetry() { + return this.getConversationRetry; + } + + public void setGetConversationRetry(Retry getConversationRetry) { + this.getConversationRetry = getConversationRetry; + } + + public Retry getCompleteConversationRetry() { + return this.completeConversationRetry; + } + + public void setCompleteConversationRetry(Retry completeConversationRetry) { + this.completeConversationRetry = completeConversationRetry; + } + + public Retry getListMessagesRetry() { + return this.listMessagesRetry; + } + + public void setListMessagesRetry(Retry listMessagesRetry) { + this.listMessagesRetry = listMessagesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java new file mode 100644 index 0000000000..90b3d41136 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringAutoConfiguration.java @@ -0,0 +1,243 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.DocumentsClient; +import com.google.cloud.dialogflow.v2.DocumentsSettings; +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 DocumentsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in DocumentsSpringProperties. 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 DocumentsSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public DocumentsSettings documentsSettings( + @Qualifier("defaultDocumentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + DocumentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = DocumentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = DocumentsSettings.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 = + DocumentsSettings.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 listDocumentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDocumentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listDocumentsSettings().setRetrySettings(listDocumentsRetrySettings); + + RetrySettings getDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDocumentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getDocumentSettings().setRetrySettings(getDocumentRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listDocumentsRetry = clientProperties.getListDocumentsRetry(); + if (listDocumentsRetry != null) { + RetrySettings listDocumentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDocumentsSettings().getRetrySettings(), listDocumentsRetry); + clientSettingsBuilder.listDocumentsSettings().setRetrySettings(listDocumentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listDocuments from properties."); + } + } + Retry getDocumentRetry = clientProperties.getGetDocumentRetry(); + if (getDocumentRetry != null) { + RetrySettings getDocumentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDocumentSettings().getRetrySettings(), getDocumentRetry); + clientSettingsBuilder.getDocumentSettings().setRetrySettings(getDocumentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDocument from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a DocumentsClient bean configured with DocumentsSettings. + * + * @param documentsSettings settings to configure an instance of client bean. + * @return a {@link DocumentsClient} bean configured with {@link DocumentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public DocumentsClient documentsClient(DocumentsSettings documentsSettings) throws IOException { + return DocumentsClient.create(documentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-documents"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringProperties.java new file mode 100644 index 0000000000..4c6fccab33 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/DocumentsSpringProperties.java @@ -0,0 +1,136 @@ +/* + * Copyright 2022 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.dialogflow.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 Documents client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.documents") +public class DocumentsSpringProperties 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/dialogflow"); + /** 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 listDocuments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDocumentsRetry; + /** + * Allow override of retry settings at method-level for getDocument. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDocumentRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListDocumentsRetry() { + return this.listDocumentsRetry; + } + + public void setListDocumentsRetry(Retry listDocumentsRetry) { + this.listDocumentsRetry = listDocumentsRetry; + } + + public Retry getGetDocumentRetry() { + return this.getDocumentRetry; + } + + public void setGetDocumentRetry(Retry getDocumentRetry) { + this.getDocumentRetry = getDocumentRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java new file mode 100644 index 0000000000..1d666c06bf --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringAutoConfiguration.java @@ -0,0 +1,313 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.EntityTypesClient; +import com.google.cloud.dialogflow.v2.EntityTypesSettings; +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 EntityTypesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in EntityTypesSpringProperties. 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 EntityTypesSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EntityTypesSettings entityTypesSettings( + @Qualifier("defaultEntityTypesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EntityTypesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EntityTypesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EntityTypesSettings.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 = + EntityTypesSettings.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 listEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntityTypesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEntityTypesSettings() + .setRetrySettings(listEntityTypesRetrySettings); + + RetrySettings getEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEntityTypeSettings().setRetrySettings(getEntityTypeRetrySettings); + + RetrySettings createEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createEntityTypeSettings() + .setRetrySettings(createEntityTypeRetrySettings); + + RetrySettings updateEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateEntityTypeSettings() + .setRetrySettings(updateEntityTypeRetrySettings); + + RetrySettings deleteEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntityTypeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteEntityTypeSettings() + .setRetrySettings(deleteEntityTypeRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listEntityTypesRetry = clientProperties.getListEntityTypesRetry(); + if (listEntityTypesRetry != null) { + RetrySettings listEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEntityTypesSettings().getRetrySettings(), + listEntityTypesRetry); + clientSettingsBuilder + .listEntityTypesSettings() + .setRetrySettings(listEntityTypesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listEntityTypes from properties."); + } + } + Retry getEntityTypeRetry = clientProperties.getGetEntityTypeRetry(); + if (getEntityTypeRetry != null) { + RetrySettings getEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEntityTypeSettings().getRetrySettings(), getEntityTypeRetry); + clientSettingsBuilder.getEntityTypeSettings().setRetrySettings(getEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEntityType from properties."); + } + } + Retry createEntityTypeRetry = clientProperties.getCreateEntityTypeRetry(); + if (createEntityTypeRetry != null) { + RetrySettings createEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEntityTypeSettings().getRetrySettings(), + createEntityTypeRetry); + clientSettingsBuilder + .createEntityTypeSettings() + .setRetrySettings(createEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createEntityType from properties."); + } + } + Retry updateEntityTypeRetry = clientProperties.getUpdateEntityTypeRetry(); + if (updateEntityTypeRetry != null) { + RetrySettings updateEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEntityTypeSettings().getRetrySettings(), + updateEntityTypeRetry); + clientSettingsBuilder + .updateEntityTypeSettings() + .setRetrySettings(updateEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateEntityType from properties."); + } + } + Retry deleteEntityTypeRetry = clientProperties.getDeleteEntityTypeRetry(); + if (deleteEntityTypeRetry != null) { + RetrySettings deleteEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEntityTypeSettings().getRetrySettings(), + deleteEntityTypeRetry); + clientSettingsBuilder + .deleteEntityTypeSettings() + .setRetrySettings(deleteEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteEntityType from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a EntityTypesClient bean configured with EntityTypesSettings. + * + * @param entityTypesSettings settings to configure an instance of client bean. + * @return a {@link EntityTypesClient} bean configured with {@link EntityTypesSettings} + */ + @Bean + @ConditionalOnMissingBean + public EntityTypesClient entityTypesClient(EntityTypesSettings entityTypesSettings) + throws IOException { + return EntityTypesClient.create(entityTypesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-entity-types"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringProperties.java new file mode 100644 index 0000000000..21a5bb01d4 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EntityTypesSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 EntityTypes client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.entity-types") +public class EntityTypesSpringProperties 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/dialogflow"); + /** 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 listEntityTypes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEntityTypesRetry; + /** + * Allow override of retry settings at method-level for getEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEntityTypeRetry; + /** + * Allow override of retry settings at method-level for createEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createEntityTypeRetry; + /** + * Allow override of retry settings at method-level for updateEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEntityTypeRetry; + /** + * Allow override of retry settings at method-level for deleteEntityType. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteEntityTypeRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListEntityTypesRetry() { + return this.listEntityTypesRetry; + } + + public void setListEntityTypesRetry(Retry listEntityTypesRetry) { + this.listEntityTypesRetry = listEntityTypesRetry; + } + + public Retry getGetEntityTypeRetry() { + return this.getEntityTypeRetry; + } + + public void setGetEntityTypeRetry(Retry getEntityTypeRetry) { + this.getEntityTypeRetry = getEntityTypeRetry; + } + + public Retry getCreateEntityTypeRetry() { + return this.createEntityTypeRetry; + } + + public void setCreateEntityTypeRetry(Retry createEntityTypeRetry) { + this.createEntityTypeRetry = createEntityTypeRetry; + } + + public Retry getUpdateEntityTypeRetry() { + return this.updateEntityTypeRetry; + } + + public void setUpdateEntityTypeRetry(Retry updateEntityTypeRetry) { + this.updateEntityTypeRetry = updateEntityTypeRetry; + } + + public Retry getDeleteEntityTypeRetry() { + return this.deleteEntityTypeRetry; + } + + public void setDeleteEntityTypeRetry(Retry deleteEntityTypeRetry) { + this.deleteEntityTypeRetry = deleteEntityTypeRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java new file mode 100644 index 0000000000..7c69858628 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringAutoConfiguration.java @@ -0,0 +1,338 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.dialogflow.v2.EnvironmentsSettings; +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 EnvironmentsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in EnvironmentsSpringProperties. 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 EnvironmentsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EnvironmentsSettings environmentsSettings( + @Qualifier("defaultEnvironmentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EnvironmentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EnvironmentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EnvironmentsSettings.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 = + EnvironmentsSettings.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 listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + + RetrySettings getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + + RetrySettings createEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createEnvironmentSettings() + .setRetrySettings(createEnvironmentRetrySettings); + + RetrySettings updateEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateEnvironmentSettings() + .setRetrySettings(updateEnvironmentRetrySettings); + + RetrySettings deleteEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteEnvironmentSettings() + .setRetrySettings(deleteEnvironmentRetrySettings); + + RetrySettings getEnvironmentHistoryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentHistorySettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getEnvironmentHistorySettings() + .setRetrySettings(getEnvironmentHistoryRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listEnvironmentsRetry = clientProperties.getListEnvironmentsRetry(); + if (listEnvironmentsRetry != null) { + RetrySettings listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), + listEnvironmentsRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEnvironments from properties."); + } + } + Retry getEnvironmentRetry = clientProperties.getGetEnvironmentRetry(); + if (getEnvironmentRetry != null) { + RetrySettings getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), + getEnvironmentRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEnvironment from properties."); + } + } + Retry createEnvironmentRetry = clientProperties.getCreateEnvironmentRetry(); + if (createEnvironmentRetry != null) { + RetrySettings createEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createEnvironmentSettings().getRetrySettings(), + createEnvironmentRetry); + clientSettingsBuilder + .createEnvironmentSettings() + .setRetrySettings(createEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createEnvironment from properties."); + } + } + Retry updateEnvironmentRetry = clientProperties.getUpdateEnvironmentRetry(); + if (updateEnvironmentRetry != null) { + RetrySettings updateEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateEnvironmentSettings().getRetrySettings(), + updateEnvironmentRetry); + clientSettingsBuilder + .updateEnvironmentSettings() + .setRetrySettings(updateEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateEnvironment from properties."); + } + } + Retry deleteEnvironmentRetry = clientProperties.getDeleteEnvironmentRetry(); + if (deleteEnvironmentRetry != null) { + RetrySettings deleteEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteEnvironmentSettings().getRetrySettings(), + deleteEnvironmentRetry); + clientSettingsBuilder + .deleteEnvironmentSettings() + .setRetrySettings(deleteEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteEnvironment from properties."); + } + } + Retry getEnvironmentHistoryRetry = clientProperties.getGetEnvironmentHistoryRetry(); + if (getEnvironmentHistoryRetry != null) { + RetrySettings getEnvironmentHistoryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentHistorySettings().getRetrySettings(), + getEnvironmentHistoryRetry); + clientSettingsBuilder + .getEnvironmentHistorySettings() + .setRetrySettings(getEnvironmentHistoryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEnvironmentHistory from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a EnvironmentsClient bean configured with EnvironmentsSettings. + * + * @param environmentsSettings settings to configure an instance of client bean. + * @return a {@link EnvironmentsClient} bean configured with {@link EnvironmentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public EnvironmentsClient environmentsClient(EnvironmentsSettings environmentsSettings) + throws IOException { + return EnvironmentsClient.create(environmentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-environments"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringProperties.java new file mode 100644 index 0000000000..bf20fe8289 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/EnvironmentsSpringProperties.java @@ -0,0 +1,188 @@ +/* + * Copyright 2022 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.dialogflow.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 Environments client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.environments") +public class EnvironmentsSpringProperties 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/dialogflow"); + /** 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 listEnvironments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEnvironmentsRetry; + /** + * Allow override of retry settings at method-level for getEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEnvironmentRetry; + /** + * Allow override of retry settings at method-level for createEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createEnvironmentRetry; + /** + * Allow override of retry settings at method-level for updateEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateEnvironmentRetry; + /** + * Allow override of retry settings at method-level for deleteEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteEnvironmentRetry; + /** + * Allow override of retry settings at method-level for getEnvironmentHistory. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEnvironmentHistoryRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListEnvironmentsRetry() { + return this.listEnvironmentsRetry; + } + + public void setListEnvironmentsRetry(Retry listEnvironmentsRetry) { + this.listEnvironmentsRetry = listEnvironmentsRetry; + } + + public Retry getGetEnvironmentRetry() { + return this.getEnvironmentRetry; + } + + public void setGetEnvironmentRetry(Retry getEnvironmentRetry) { + this.getEnvironmentRetry = getEnvironmentRetry; + } + + public Retry getCreateEnvironmentRetry() { + return this.createEnvironmentRetry; + } + + public void setCreateEnvironmentRetry(Retry createEnvironmentRetry) { + this.createEnvironmentRetry = createEnvironmentRetry; + } + + public Retry getUpdateEnvironmentRetry() { + return this.updateEnvironmentRetry; + } + + public void setUpdateEnvironmentRetry(Retry updateEnvironmentRetry) { + this.updateEnvironmentRetry = updateEnvironmentRetry; + } + + public Retry getDeleteEnvironmentRetry() { + return this.deleteEnvironmentRetry; + } + + public void setDeleteEnvironmentRetry(Retry deleteEnvironmentRetry) { + this.deleteEnvironmentRetry = deleteEnvironmentRetry; + } + + public Retry getGetEnvironmentHistoryRetry() { + return this.getEnvironmentHistoryRetry; + } + + public void setGetEnvironmentHistoryRetry(Retry getEnvironmentHistoryRetry) { + this.getEnvironmentHistoryRetry = getEnvironmentHistoryRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java new file mode 100644 index 0000000000..e1c7ebfee6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringAutoConfiguration.java @@ -0,0 +1,253 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.dialogflow.v2.FulfillmentsSettings; +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 FulfillmentsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in FulfillmentsSpringProperties. 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 FulfillmentsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public FulfillmentsSettings fulfillmentsSettings( + @Qualifier("defaultFulfillmentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + FulfillmentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = FulfillmentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = FulfillmentsSettings.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 = + FulfillmentsSettings.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 getFulfillmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFulfillmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getFulfillmentSettings().setRetrySettings(getFulfillmentRetrySettings); + + RetrySettings updateFulfillmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateFulfillmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateFulfillmentSettings() + .setRetrySettings(updateFulfillmentRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getFulfillmentRetry = clientProperties.getGetFulfillmentRetry(); + if (getFulfillmentRetry != null) { + RetrySettings getFulfillmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getFulfillmentSettings().getRetrySettings(), + getFulfillmentRetry); + clientSettingsBuilder.getFulfillmentSettings().setRetrySettings(getFulfillmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getFulfillment from properties."); + } + } + Retry updateFulfillmentRetry = clientProperties.getUpdateFulfillmentRetry(); + if (updateFulfillmentRetry != null) { + RetrySettings updateFulfillmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateFulfillmentSettings().getRetrySettings(), + updateFulfillmentRetry); + clientSettingsBuilder + .updateFulfillmentSettings() + .setRetrySettings(updateFulfillmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateFulfillment from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a FulfillmentsClient bean configured with FulfillmentsSettings. + * + * @param fulfillmentsSettings settings to configure an instance of client bean. + * @return a {@link FulfillmentsClient} bean configured with {@link FulfillmentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public FulfillmentsClient fulfillmentsClient(FulfillmentsSettings fulfillmentsSettings) + throws IOException { + return FulfillmentsClient.create(fulfillmentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-fulfillments"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringProperties.java new file mode 100644 index 0000000000..da91ba0428 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/FulfillmentsSpringProperties.java @@ -0,0 +1,136 @@ +/* + * Copyright 2022 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.dialogflow.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 Fulfillments client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.fulfillments") +public class FulfillmentsSpringProperties 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/dialogflow"); + /** 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 getFulfillment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getFulfillmentRetry; + /** + * Allow override of retry settings at method-level for updateFulfillment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateFulfillmentRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getGetFulfillmentRetry() { + return this.getFulfillmentRetry; + } + + public void setGetFulfillmentRetry(Retry getFulfillmentRetry) { + this.getFulfillmentRetry = getFulfillmentRetry; + } + + public Retry getUpdateFulfillmentRetry() { + return this.updateFulfillmentRetry; + } + + public void setUpdateFulfillmentRetry(Retry updateFulfillmentRetry) { + this.updateFulfillmentRetry = updateFulfillmentRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java new file mode 100644 index 0000000000..9b450bcb88 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringAutoConfiguration.java @@ -0,0 +1,288 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.IntentsClient; +import com.google.cloud.dialogflow.v2.IntentsSettings; +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 IntentsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in IntentsSpringProperties. 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 IntentsSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public IntentsSettings intentsSettings( + @Qualifier("defaultIntentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + IntentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = IntentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = IntentsSettings.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 = + IntentsSettings.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 listIntentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIntentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listIntentsSettings().setRetrySettings(listIntentsRetrySettings); + + RetrySettings getIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIntentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getIntentSettings().setRetrySettings(getIntentRetrySettings); + + RetrySettings createIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIntentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createIntentSettings().setRetrySettings(createIntentRetrySettings); + + RetrySettings updateIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIntentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateIntentSettings().setRetrySettings(updateIntentRetrySettings); + + RetrySettings deleteIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIntentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteIntentSettings().setRetrySettings(deleteIntentRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listIntentsRetry = clientProperties.getListIntentsRetry(); + if (listIntentsRetry != null) { + RetrySettings listIntentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listIntentsSettings().getRetrySettings(), listIntentsRetry); + clientSettingsBuilder.listIntentsSettings().setRetrySettings(listIntentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listIntents from properties."); + } + } + Retry getIntentRetry = clientProperties.getGetIntentRetry(); + if (getIntentRetry != null) { + RetrySettings getIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getIntentSettings().getRetrySettings(), getIntentRetry); + clientSettingsBuilder.getIntentSettings().setRetrySettings(getIntentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getIntent from properties."); + } + } + Retry createIntentRetry = clientProperties.getCreateIntentRetry(); + if (createIntentRetry != null) { + RetrySettings createIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createIntentSettings().getRetrySettings(), createIntentRetry); + clientSettingsBuilder.createIntentSettings().setRetrySettings(createIntentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createIntent from properties."); + } + } + Retry updateIntentRetry = clientProperties.getUpdateIntentRetry(); + if (updateIntentRetry != null) { + RetrySettings updateIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateIntentSettings().getRetrySettings(), updateIntentRetry); + clientSettingsBuilder.updateIntentSettings().setRetrySettings(updateIntentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateIntent from properties."); + } + } + Retry deleteIntentRetry = clientProperties.getDeleteIntentRetry(); + if (deleteIntentRetry != null) { + RetrySettings deleteIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteIntentSettings().getRetrySettings(), deleteIntentRetry); + clientSettingsBuilder.deleteIntentSettings().setRetrySettings(deleteIntentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteIntent from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a IntentsClient bean configured with IntentsSettings. + * + * @param intentsSettings settings to configure an instance of client bean. + * @return a {@link IntentsClient} bean configured with {@link IntentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public IntentsClient intentsClient(IntentsSettings intentsSettings) throws IOException { + return IntentsClient.create(intentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-intents"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringProperties.java new file mode 100644 index 0000000000..3bb4ec756d --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/IntentsSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 Intents client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.intents") +public class IntentsSpringProperties 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/dialogflow"); + /** 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 listIntents. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listIntentsRetry; + /** + * Allow override of retry settings at method-level for getIntent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getIntentRetry; + /** + * Allow override of retry settings at method-level for createIntent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createIntentRetry; + /** + * Allow override of retry settings at method-level for updateIntent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateIntentRetry; + /** + * Allow override of retry settings at method-level for deleteIntent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteIntentRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListIntentsRetry() { + return this.listIntentsRetry; + } + + public void setListIntentsRetry(Retry listIntentsRetry) { + this.listIntentsRetry = listIntentsRetry; + } + + public Retry getGetIntentRetry() { + return this.getIntentRetry; + } + + public void setGetIntentRetry(Retry getIntentRetry) { + this.getIntentRetry = getIntentRetry; + } + + public Retry getCreateIntentRetry() { + return this.createIntentRetry; + } + + public void setCreateIntentRetry(Retry createIntentRetry) { + this.createIntentRetry = createIntentRetry; + } + + public Retry getUpdateIntentRetry() { + return this.updateIntentRetry; + } + + public void setUpdateIntentRetry(Retry updateIntentRetry) { + this.updateIntentRetry = updateIntentRetry; + } + + public Retry getDeleteIntentRetry() { + return this.deleteIntentRetry; + } + + public void setDeleteIntentRetry(Retry deleteIntentRetry) { + this.deleteIntentRetry = deleteIntentRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java new file mode 100644 index 0000000000..3c7d8a0b9a --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringAutoConfiguration.java @@ -0,0 +1,321 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.dialogflow.v2.KnowledgeBasesSettings; +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 KnowledgeBasesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in KnowledgeBasesSpringProperties. 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 KnowledgeBasesSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public KnowledgeBasesSettings knowledgeBasesSettings( + @Qualifier("defaultKnowledgeBasesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + KnowledgeBasesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = KnowledgeBasesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = KnowledgeBasesSettings.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 = + KnowledgeBasesSettings.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 listKnowledgeBasesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listKnowledgeBasesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listKnowledgeBasesSettings() + .setRetrySettings(listKnowledgeBasesRetrySettings); + + RetrySettings getKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKnowledgeBaseSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getKnowledgeBaseSettings() + .setRetrySettings(getKnowledgeBaseRetrySettings); + + RetrySettings createKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createKnowledgeBaseSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createKnowledgeBaseSettings() + .setRetrySettings(createKnowledgeBaseRetrySettings); + + RetrySettings deleteKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteKnowledgeBaseSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteKnowledgeBaseSettings() + .setRetrySettings(deleteKnowledgeBaseRetrySettings); + + RetrySettings updateKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateKnowledgeBaseSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateKnowledgeBaseSettings() + .setRetrySettings(updateKnowledgeBaseRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listKnowledgeBasesRetry = clientProperties.getListKnowledgeBasesRetry(); + if (listKnowledgeBasesRetry != null) { + RetrySettings listKnowledgeBasesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listKnowledgeBasesSettings().getRetrySettings(), + listKnowledgeBasesRetry); + clientSettingsBuilder + .listKnowledgeBasesSettings() + .setRetrySettings(listKnowledgeBasesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listKnowledgeBases from properties."); + } + } + Retry getKnowledgeBaseRetry = clientProperties.getGetKnowledgeBaseRetry(); + if (getKnowledgeBaseRetry != null) { + RetrySettings getKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getKnowledgeBaseSettings().getRetrySettings(), + getKnowledgeBaseRetry); + clientSettingsBuilder + .getKnowledgeBaseSettings() + .setRetrySettings(getKnowledgeBaseRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getKnowledgeBase from properties."); + } + } + Retry createKnowledgeBaseRetry = clientProperties.getCreateKnowledgeBaseRetry(); + if (createKnowledgeBaseRetry != null) { + RetrySettings createKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createKnowledgeBaseSettings().getRetrySettings(), + createKnowledgeBaseRetry); + clientSettingsBuilder + .createKnowledgeBaseSettings() + .setRetrySettings(createKnowledgeBaseRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createKnowledgeBase from properties."); + } + } + Retry deleteKnowledgeBaseRetry = clientProperties.getDeleteKnowledgeBaseRetry(); + if (deleteKnowledgeBaseRetry != null) { + RetrySettings deleteKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteKnowledgeBaseSettings().getRetrySettings(), + deleteKnowledgeBaseRetry); + clientSettingsBuilder + .deleteKnowledgeBaseSettings() + .setRetrySettings(deleteKnowledgeBaseRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteKnowledgeBase from properties."); + } + } + Retry updateKnowledgeBaseRetry = clientProperties.getUpdateKnowledgeBaseRetry(); + if (updateKnowledgeBaseRetry != null) { + RetrySettings updateKnowledgeBaseRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateKnowledgeBaseSettings().getRetrySettings(), + updateKnowledgeBaseRetry); + clientSettingsBuilder + .updateKnowledgeBaseSettings() + .setRetrySettings(updateKnowledgeBaseRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateKnowledgeBase from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a KnowledgeBasesClient bean configured with KnowledgeBasesSettings. + * + * @param knowledgeBasesSettings settings to configure an instance of client bean. + * @return a {@link KnowledgeBasesClient} bean configured with {@link KnowledgeBasesSettings} + */ + @Bean + @ConditionalOnMissingBean + public KnowledgeBasesClient knowledgeBasesClient(KnowledgeBasesSettings knowledgeBasesSettings) + throws IOException { + return KnowledgeBasesClient.create(knowledgeBasesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-knowledge-bases"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringProperties.java new file mode 100644 index 0000000000..3a66c150b0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/KnowledgeBasesSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 KnowledgeBases client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.knowledge-bases") +public class KnowledgeBasesSpringProperties 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/dialogflow"); + /** 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 listKnowledgeBases. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listKnowledgeBasesRetry; + /** + * Allow override of retry settings at method-level for getKnowledgeBase. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getKnowledgeBaseRetry; + /** + * Allow override of retry settings at method-level for createKnowledgeBase. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createKnowledgeBaseRetry; + /** + * Allow override of retry settings at method-level for deleteKnowledgeBase. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteKnowledgeBaseRetry; + /** + * Allow override of retry settings at method-level for updateKnowledgeBase. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateKnowledgeBaseRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListKnowledgeBasesRetry() { + return this.listKnowledgeBasesRetry; + } + + public void setListKnowledgeBasesRetry(Retry listKnowledgeBasesRetry) { + this.listKnowledgeBasesRetry = listKnowledgeBasesRetry; + } + + public Retry getGetKnowledgeBaseRetry() { + return this.getKnowledgeBaseRetry; + } + + public void setGetKnowledgeBaseRetry(Retry getKnowledgeBaseRetry) { + this.getKnowledgeBaseRetry = getKnowledgeBaseRetry; + } + + public Retry getCreateKnowledgeBaseRetry() { + return this.createKnowledgeBaseRetry; + } + + public void setCreateKnowledgeBaseRetry(Retry createKnowledgeBaseRetry) { + this.createKnowledgeBaseRetry = createKnowledgeBaseRetry; + } + + public Retry getDeleteKnowledgeBaseRetry() { + return this.deleteKnowledgeBaseRetry; + } + + public void setDeleteKnowledgeBaseRetry(Retry deleteKnowledgeBaseRetry) { + this.deleteKnowledgeBaseRetry = deleteKnowledgeBaseRetry; + } + + public Retry getUpdateKnowledgeBaseRetry() { + return this.updateKnowledgeBaseRetry; + } + + public void setUpdateKnowledgeBaseRetry(Retry updateKnowledgeBaseRetry) { + this.updateKnowledgeBaseRetry = updateKnowledgeBaseRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java new file mode 100644 index 0000000000..8016cde98a --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringAutoConfiguration.java @@ -0,0 +1,373 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.ParticipantsClient; +import com.google.cloud.dialogflow.v2.ParticipantsSettings; +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 ParticipantsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ParticipantsSpringProperties. 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 ParticipantsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ParticipantsSettings participantsSettings( + @Qualifier("defaultParticipantsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ParticipantsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ParticipantsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ParticipantsSettings.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 = + ParticipantsSettings.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 createParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createParticipantSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createParticipantSettings() + .setRetrySettings(createParticipantRetrySettings); + + RetrySettings getParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getParticipantSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getParticipantSettings().setRetrySettings(getParticipantRetrySettings); + + RetrySettings listParticipantsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listParticipantsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listParticipantsSettings() + .setRetrySettings(listParticipantsRetrySettings); + + RetrySettings updateParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateParticipantSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateParticipantSettings() + .setRetrySettings(updateParticipantRetrySettings); + + RetrySettings analyzeContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.analyzeContentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.analyzeContentSettings().setRetrySettings(analyzeContentRetrySettings); + + RetrySettings suggestArticlesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestArticlesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .suggestArticlesSettings() + .setRetrySettings(suggestArticlesRetrySettings); + + RetrySettings suggestFaqAnswersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestFaqAnswersSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .suggestFaqAnswersSettings() + .setRetrySettings(suggestFaqAnswersRetrySettings); + + RetrySettings suggestSmartRepliesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestSmartRepliesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .suggestSmartRepliesSettings() + .setRetrySettings(suggestSmartRepliesRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createParticipantRetry = clientProperties.getCreateParticipantRetry(); + if (createParticipantRetry != null) { + RetrySettings createParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createParticipantSettings().getRetrySettings(), + createParticipantRetry); + clientSettingsBuilder + .createParticipantSettings() + .setRetrySettings(createParticipantRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createParticipant from properties."); + } + } + Retry getParticipantRetry = clientProperties.getGetParticipantRetry(); + if (getParticipantRetry != null) { + RetrySettings getParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getParticipantSettings().getRetrySettings(), + getParticipantRetry); + clientSettingsBuilder.getParticipantSettings().setRetrySettings(getParticipantRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getParticipant from properties."); + } + } + Retry listParticipantsRetry = clientProperties.getListParticipantsRetry(); + if (listParticipantsRetry != null) { + RetrySettings listParticipantsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listParticipantsSettings().getRetrySettings(), + listParticipantsRetry); + clientSettingsBuilder + .listParticipantsSettings() + .setRetrySettings(listParticipantsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listParticipants from properties."); + } + } + Retry updateParticipantRetry = clientProperties.getUpdateParticipantRetry(); + if (updateParticipantRetry != null) { + RetrySettings updateParticipantRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateParticipantSettings().getRetrySettings(), + updateParticipantRetry); + clientSettingsBuilder + .updateParticipantSettings() + .setRetrySettings(updateParticipantRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateParticipant from properties."); + } + } + Retry analyzeContentRetry = clientProperties.getAnalyzeContentRetry(); + if (analyzeContentRetry != null) { + RetrySettings analyzeContentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.analyzeContentSettings().getRetrySettings(), + analyzeContentRetry); + clientSettingsBuilder.analyzeContentSettings().setRetrySettings(analyzeContentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for analyzeContent from properties."); + } + } + Retry suggestArticlesRetry = clientProperties.getSuggestArticlesRetry(); + if (suggestArticlesRetry != null) { + RetrySettings suggestArticlesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestArticlesSettings().getRetrySettings(), + suggestArticlesRetry); + clientSettingsBuilder + .suggestArticlesSettings() + .setRetrySettings(suggestArticlesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for suggestArticles from properties."); + } + } + Retry suggestFaqAnswersRetry = clientProperties.getSuggestFaqAnswersRetry(); + if (suggestFaqAnswersRetry != null) { + RetrySettings suggestFaqAnswersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestFaqAnswersSettings().getRetrySettings(), + suggestFaqAnswersRetry); + clientSettingsBuilder + .suggestFaqAnswersSettings() + .setRetrySettings(suggestFaqAnswersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for suggestFaqAnswers from properties."); + } + } + Retry suggestSmartRepliesRetry = clientProperties.getSuggestSmartRepliesRetry(); + if (suggestSmartRepliesRetry != null) { + RetrySettings suggestSmartRepliesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.suggestSmartRepliesSettings().getRetrySettings(), + suggestSmartRepliesRetry); + clientSettingsBuilder + .suggestSmartRepliesSettings() + .setRetrySettings(suggestSmartRepliesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for suggestSmartReplies from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ParticipantsClient bean configured with ParticipantsSettings. + * + * @param participantsSettings settings to configure an instance of client bean. + * @return a {@link ParticipantsClient} bean configured with {@link ParticipantsSettings} + */ + @Bean + @ConditionalOnMissingBean + public ParticipantsClient participantsClient(ParticipantsSettings participantsSettings) + throws IOException { + return ParticipantsClient.create(participantsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-participants"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringProperties.java new file mode 100644 index 0000000000..6dbf3ffc3c --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/ParticipantsSpringProperties.java @@ -0,0 +1,214 @@ +/* + * Copyright 2022 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.dialogflow.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 Participants client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.participants") +public class ParticipantsSpringProperties 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/dialogflow"); + /** 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 createParticipant. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createParticipantRetry; + /** + * Allow override of retry settings at method-level for getParticipant. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getParticipantRetry; + /** + * Allow override of retry settings at method-level for listParticipants. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listParticipantsRetry; + /** + * Allow override of retry settings at method-level for updateParticipant. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateParticipantRetry; + /** + * Allow override of retry settings at method-level for analyzeContent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry analyzeContentRetry; + /** + * Allow override of retry settings at method-level for suggestArticles. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry suggestArticlesRetry; + /** + * Allow override of retry settings at method-level for suggestFaqAnswers. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry suggestFaqAnswersRetry; + /** + * Allow override of retry settings at method-level for suggestSmartReplies. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry suggestSmartRepliesRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCreateParticipantRetry() { + return this.createParticipantRetry; + } + + public void setCreateParticipantRetry(Retry createParticipantRetry) { + this.createParticipantRetry = createParticipantRetry; + } + + public Retry getGetParticipantRetry() { + return this.getParticipantRetry; + } + + public void setGetParticipantRetry(Retry getParticipantRetry) { + this.getParticipantRetry = getParticipantRetry; + } + + public Retry getListParticipantsRetry() { + return this.listParticipantsRetry; + } + + public void setListParticipantsRetry(Retry listParticipantsRetry) { + this.listParticipantsRetry = listParticipantsRetry; + } + + public Retry getUpdateParticipantRetry() { + return this.updateParticipantRetry; + } + + public void setUpdateParticipantRetry(Retry updateParticipantRetry) { + this.updateParticipantRetry = updateParticipantRetry; + } + + public Retry getAnalyzeContentRetry() { + return this.analyzeContentRetry; + } + + public void setAnalyzeContentRetry(Retry analyzeContentRetry) { + this.analyzeContentRetry = analyzeContentRetry; + } + + public Retry getSuggestArticlesRetry() { + return this.suggestArticlesRetry; + } + + public void setSuggestArticlesRetry(Retry suggestArticlesRetry) { + this.suggestArticlesRetry = suggestArticlesRetry; + } + + public Retry getSuggestFaqAnswersRetry() { + return this.suggestFaqAnswersRetry; + } + + public void setSuggestFaqAnswersRetry(Retry suggestFaqAnswersRetry) { + this.suggestFaqAnswersRetry = suggestFaqAnswersRetry; + } + + public Retry getSuggestSmartRepliesRetry() { + return this.suggestSmartRepliesRetry; + } + + public void setSuggestSmartRepliesRetry(Retry suggestSmartRepliesRetry) { + this.suggestSmartRepliesRetry = suggestSmartRepliesRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java new file mode 100644 index 0000000000..51932d4497 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringAutoConfiguration.java @@ -0,0 +1,328 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.dialogflow.v2.SessionEntityTypesSettings; +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 SessionEntityTypesClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in SessionEntityTypesSpringProperties. 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 SessionEntityTypesSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SessionEntityTypesSettings sessionEntityTypesSettings( + @Qualifier("defaultSessionEntityTypesTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SessionEntityTypesSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SessionEntityTypesSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SessionEntityTypesSettings.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 = + SessionEntityTypesSettings.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 listSessionEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionEntityTypesSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listSessionEntityTypesSettings() + .setRetrySettings(listSessionEntityTypesRetrySettings); + + RetrySettings getSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getSessionEntityTypeSettings() + .setRetrySettings(getSessionEntityTypeRetrySettings); + + RetrySettings createSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createSessionEntityTypeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createSessionEntityTypeSettings() + .setRetrySettings(createSessionEntityTypeRetrySettings); + + RetrySettings updateSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSessionEntityTypeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateSessionEntityTypeSettings() + .setRetrySettings(updateSessionEntityTypeRetrySettings); + + RetrySettings deleteSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteSessionEntityTypeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deleteSessionEntityTypeSettings() + .setRetrySettings(deleteSessionEntityTypeRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listSessionEntityTypesRetry = clientProperties.getListSessionEntityTypesRetry(); + if (listSessionEntityTypesRetry != null) { + RetrySettings listSessionEntityTypesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSessionEntityTypesSettings().getRetrySettings(), + listSessionEntityTypesRetry); + clientSettingsBuilder + .listSessionEntityTypesSettings() + .setRetrySettings(listSessionEntityTypesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listSessionEntityTypes from properties."); + } + } + Retry getSessionEntityTypeRetry = clientProperties.getGetSessionEntityTypeRetry(); + if (getSessionEntityTypeRetry != null) { + RetrySettings getSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings(), + getSessionEntityTypeRetry); + clientSettingsBuilder + .getSessionEntityTypeSettings() + .setRetrySettings(getSessionEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getSessionEntityType from properties."); + } + } + Retry createSessionEntityTypeRetry = clientProperties.getCreateSessionEntityTypeRetry(); + if (createSessionEntityTypeRetry != null) { + RetrySettings createSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createSessionEntityTypeSettings().getRetrySettings(), + createSessionEntityTypeRetry); + clientSettingsBuilder + .createSessionEntityTypeSettings() + .setRetrySettings(createSessionEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createSessionEntityType from properties."); + } + } + Retry updateSessionEntityTypeRetry = clientProperties.getUpdateSessionEntityTypeRetry(); + if (updateSessionEntityTypeRetry != null) { + RetrySettings updateSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateSessionEntityTypeSettings().getRetrySettings(), + updateSessionEntityTypeRetry); + clientSettingsBuilder + .updateSessionEntityTypeSettings() + .setRetrySettings(updateSessionEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateSessionEntityType from properties."); + } + } + Retry deleteSessionEntityTypeRetry = clientProperties.getDeleteSessionEntityTypeRetry(); + if (deleteSessionEntityTypeRetry != null) { + RetrySettings deleteSessionEntityTypeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteSessionEntityTypeSettings().getRetrySettings(), + deleteSessionEntityTypeRetry); + clientSettingsBuilder + .deleteSessionEntityTypeSettings() + .setRetrySettings(deleteSessionEntityTypeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteSessionEntityType from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SessionEntityTypesClient bean configured with SessionEntityTypesSettings. + * + * @param sessionEntityTypesSettings settings to configure an instance of client bean. + * @return a {@link SessionEntityTypesClient} bean configured with {@link + * SessionEntityTypesSettings} + */ + @Bean + @ConditionalOnMissingBean + public SessionEntityTypesClient sessionEntityTypesClient( + SessionEntityTypesSettings sessionEntityTypesSettings) throws IOException { + return SessionEntityTypesClient.create(sessionEntityTypesSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-session-entity-types"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringProperties.java new file mode 100644 index 0000000000..743e29efb6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionEntityTypesSpringProperties.java @@ -0,0 +1,175 @@ +/* + * Copyright 2022 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.dialogflow.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 SessionEntityTypes client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.session-entity-types") +public class SessionEntityTypesSpringProperties 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/dialogflow"); + /** 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 listSessionEntityTypes. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSessionEntityTypesRetry; + /** + * Allow override of retry settings at method-level for getSessionEntityType. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSessionEntityTypeRetry; + /** + * Allow override of retry settings at method-level for createSessionEntityType. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createSessionEntityTypeRetry; + /** + * Allow override of retry settings at method-level for updateSessionEntityType. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateSessionEntityTypeRetry; + /** + * Allow override of retry settings at method-level for deleteSessionEntityType. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteSessionEntityTypeRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getListSessionEntityTypesRetry() { + return this.listSessionEntityTypesRetry; + } + + public void setListSessionEntityTypesRetry(Retry listSessionEntityTypesRetry) { + this.listSessionEntityTypesRetry = listSessionEntityTypesRetry; + } + + public Retry getGetSessionEntityTypeRetry() { + return this.getSessionEntityTypeRetry; + } + + public void setGetSessionEntityTypeRetry(Retry getSessionEntityTypeRetry) { + this.getSessionEntityTypeRetry = getSessionEntityTypeRetry; + } + + public Retry getCreateSessionEntityTypeRetry() { + return this.createSessionEntityTypeRetry; + } + + public void setCreateSessionEntityTypeRetry(Retry createSessionEntityTypeRetry) { + this.createSessionEntityTypeRetry = createSessionEntityTypeRetry; + } + + public Retry getUpdateSessionEntityTypeRetry() { + return this.updateSessionEntityTypeRetry; + } + + public void setUpdateSessionEntityTypeRetry(Retry updateSessionEntityTypeRetry) { + this.updateSessionEntityTypeRetry = updateSessionEntityTypeRetry; + } + + public Retry getDeleteSessionEntityTypeRetry() { + return this.deleteSessionEntityTypeRetry; + } + + public void setDeleteSessionEntityTypeRetry(Retry deleteSessionEntityTypeRetry) { + this.deleteSessionEntityTypeRetry = deleteSessionEntityTypeRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java new file mode 100644 index 0000000000..5b62af7ecc --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringAutoConfiguration.java @@ -0,0 +1,228 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.SessionsClient; +import com.google.cloud.dialogflow.v2.SessionsSettings; +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 SessionsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in SessionsSpringProperties. 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 SessionsSettings} bean configured with {@link TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public SessionsSettings sessionsSettings( + @Qualifier("defaultSessionsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SessionsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SessionsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SessionsSettings.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 = + SessionsSettings.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 detectIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.detectIntentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.detectIntentSettings().setRetrySettings(detectIntentRetrySettings); + + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry detectIntentRetry = clientProperties.getDetectIntentRetry(); + if (detectIntentRetry != null) { + RetrySettings detectIntentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.detectIntentSettings().getRetrySettings(), detectIntentRetry); + clientSettingsBuilder.detectIntentSettings().setRetrySettings(detectIntentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for detectIntent from properties."); + } + } + Retry listLocationsRetry = clientProperties.getListLocationsRetry(); + if (listLocationsRetry != null) { + RetrySettings listLocationsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry); + clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listLocations from properties."); + } + } + Retry getLocationRetry = clientProperties.getGetLocationRetry(); + if (getLocationRetry != null) { + RetrySettings getLocationRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry); + clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getLocation from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SessionsClient bean configured with SessionsSettings. + * + * @param sessionsSettings settings to configure an instance of client bean. + * @return a {@link SessionsClient} bean configured with {@link SessionsSettings} + */ + @Bean + @ConditionalOnMissingBean + public SessionsClient sessionsClient(SessionsSettings sessionsSettings) throws IOException { + return SessionsClient.create(sessionsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-sessions"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringProperties.java new file mode 100644 index 0000000000..f29f44dc71 --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/SessionsSpringProperties.java @@ -0,0 +1,123 @@ +/* + * Copyright 2022 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.dialogflow.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 Sessions client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.dialogflow.v2.sessions") +public class SessionsSpringProperties 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/dialogflow"); + /** 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 detectIntent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry detectIntentRetry; + /** + * Allow override of retry settings at method-level for listLocations. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listLocationsRetry; + /** + * Allow override of retry settings at method-level for getLocation. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getLocationRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getDetectIntentRetry() { + return this.detectIntentRetry; + } + + public void setDetectIntentRetry(Retry detectIntentRetry) { + this.detectIntentRetry = detectIntentRetry; + } + + public Retry getListLocationsRetry() { + return this.listLocationsRetry; + } + + public void setListLocationsRetry(Retry listLocationsRetry) { + this.listLocationsRetry = listLocationsRetry; + } + + public Retry getGetLocationRetry() { + return this.getLocationRetry; + } + + public void setGetLocationRetry(Retry getLocationRetry) { + this.getLocationRetry = getLocationRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java new file mode 100644 index 0000000000..165e26be6e --- /dev/null +++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringAutoConfiguration.java @@ -0,0 +1,288 @@ +/* + * Copyright 2022 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.dialogflow.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.dialogflow.v2.VersionsClient; +import com.google.cloud.dialogflow.v2.VersionsSettings; +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 VersionsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VersionsSpringProperties. 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 VersionsSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VersionsSettings versionsSettings(
+ @Qualifier("defaultVersionsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VersionsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = VersionsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = VersionsSettings.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 =
+ VersionsSettings.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 listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+
+ RetrySettings createVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createVersionSettings().setRetrySettings(createVersionRetrySettings);
+
+ RetrySettings updateVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateVersionSettings().setRetrySettings(updateVersionRetrySettings);
+
+ RetrySettings deleteVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteVersionSettings().setRetrySettings(deleteVersionRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listVersionsRetry = clientProperties.getListVersionsRetry();
+ if (listVersionsRetry != null) {
+ RetrySettings listVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVersionsSettings().getRetrySettings(), listVersionsRetry);
+ clientSettingsBuilder.listVersionsSettings().setRetrySettings(listVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listVersions from properties.");
+ }
+ }
+ Retry getVersionRetry = clientProperties.getGetVersionRetry();
+ if (getVersionRetry != null) {
+ RetrySettings getVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVersionSettings().getRetrySettings(), getVersionRetry);
+ clientSettingsBuilder.getVersionSettings().setRetrySettings(getVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getVersion from properties.");
+ }
+ }
+ Retry createVersionRetry = clientProperties.getCreateVersionRetry();
+ if (createVersionRetry != null) {
+ RetrySettings createVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createVersionSettings().getRetrySettings(), createVersionRetry);
+ clientSettingsBuilder.createVersionSettings().setRetrySettings(createVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createVersion from properties.");
+ }
+ }
+ Retry updateVersionRetry = clientProperties.getUpdateVersionRetry();
+ if (updateVersionRetry != null) {
+ RetrySettings updateVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateVersionSettings().getRetrySettings(), updateVersionRetry);
+ clientSettingsBuilder.updateVersionSettings().setRetrySettings(updateVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateVersion from properties.");
+ }
+ }
+ Retry deleteVersionRetry = clientProperties.getDeleteVersionRetry();
+ if (deleteVersionRetry != null) {
+ RetrySettings deleteVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteVersionSettings().getRetrySettings(), deleteVersionRetry);
+ clientSettingsBuilder.deleteVersionSettings().setRetrySettings(deleteVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteVersion from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a VersionsClient bean configured with VersionsSettings.
+ *
+ * @param versionsSettings settings to configure an instance of client bean.
+ * @return a {@link VersionsClient} bean configured with {@link VersionsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VersionsClient versionsClient(VersionsSettings versionsSettings) throws IOException {
+ return VersionsClient.create(versionsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-versions";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringProperties.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringProperties.java
new file mode 100644
index 0000000000..b25f68b722
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/VersionsSpringProperties.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2022 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.dialogflow.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 Versions client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.dialogflow.v2.versions")
+public class VersionsSpringProperties 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/dialogflow");
+ /** 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 listVersions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for createVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for updateVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListVersionsRetry() {
+ return this.listVersionsRetry;
+ }
+
+ public void setListVersionsRetry(Retry listVersionsRetry) {
+ this.listVersionsRetry = listVersionsRetry;
+ }
+
+ public Retry getGetVersionRetry() {
+ return this.getVersionRetry;
+ }
+
+ public void setGetVersionRetry(Retry getVersionRetry) {
+ this.getVersionRetry = getVersionRetry;
+ }
+
+ public Retry getCreateVersionRetry() {
+ return this.createVersionRetry;
+ }
+
+ public void setCreateVersionRetry(Retry createVersionRetry) {
+ this.createVersionRetry = createVersionRetry;
+ }
+
+ public Retry getUpdateVersionRetry() {
+ return this.updateVersionRetry;
+ }
+
+ public void setUpdateVersionRetry(Retry updateVersionRetry) {
+ this.updateVersionRetry = updateVersionRetry;
+ }
+
+ public Retry getDeleteVersionRetry() {
+ return this.deleteVersionRetry;
+ }
+
+ public void setDeleteVersionRetry(Retry deleteVersionRetry) {
+ this.deleteVersionRetry = deleteVersionRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/package-info.java
new file mode 100644
index 0000000000..3b5a73d79d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/java/com/google/cloud/dialogflow/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for dialogflow. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.dialogflow.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..9aaa381333
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,106 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.dialogflow.v2.agents.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Agents components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.answer-records.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/AnswerRecords components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.contexts.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Contexts components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.conversations.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Conversations components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.conversation-datasets.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/ConversationDatasets components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.conversation-models.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/ConversationModels components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.conversation-profiles.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/ConversationProfiles components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.documents.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Documents components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.entity-types.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/EntityTypes components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.environments.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Environments components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.fulfillments.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Fulfillments components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.intents.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Intents components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.knowledge-bases.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/KnowledgeBases components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.participants.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Participants components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.sessions.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Sessions components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.session-entity-types.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/SessionEntityTypes components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.dialogflow.v2.versions.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dialogflow/Versions components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..b010137332
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dialogflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,17 @@
+com.google.cloud.dialogflow.v2.spring.AgentsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.AnswerRecordsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ContextsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ConversationsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ConversationDatasetsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ConversationModelsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ConversationProfilesSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.DocumentsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.EntityTypesSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.EnvironmentsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.FulfillmentsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.IntentsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.KnowledgeBasesSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.ParticipantsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.SessionsSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.SessionEntityTypesSpringAutoConfiguration
+com.google.cloud.dialogflow.v2.spring.VersionsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dlp-spring-starter/pom.xml
new file mode 100644
index 0000000000..c29b84eadc
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DlpServiceSpringProperties. 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 DlpServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DlpServiceSettings dlpServiceSettings(
+ @Qualifier("defaultDlpServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DlpServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DlpServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DlpServiceSettings.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 =
+ DlpServiceSettings.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 inspectContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.inspectContentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.inspectContentSettings().setRetrySettings(inspectContentRetrySettings);
+
+ RetrySettings redactImageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.redactImageSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.redactImageSettings().setRetrySettings(redactImageRetrySettings);
+
+ RetrySettings deidentifyContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deidentifyContentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deidentifyContentSettings()
+ .setRetrySettings(deidentifyContentRetrySettings);
+
+ RetrySettings reidentifyContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.reidentifyContentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .reidentifyContentSettings()
+ .setRetrySettings(reidentifyContentRetrySettings);
+
+ RetrySettings listInfoTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInfoTypesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInfoTypesSettings().setRetrySettings(listInfoTypesRetrySettings);
+
+ RetrySettings createInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createInspectTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createInspectTemplateSettings()
+ .setRetrySettings(createInspectTemplateRetrySettings);
+
+ RetrySettings updateInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInspectTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateInspectTemplateSettings()
+ .setRetrySettings(updateInspectTemplateRetrySettings);
+
+ RetrySettings getInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInspectTemplateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getInspectTemplateSettings()
+ .setRetrySettings(getInspectTemplateRetrySettings);
+
+ RetrySettings listInspectTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInspectTemplatesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listInspectTemplatesSettings()
+ .setRetrySettings(listInspectTemplatesRetrySettings);
+
+ RetrySettings deleteInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteInspectTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteInspectTemplateSettings()
+ .setRetrySettings(deleteInspectTemplateRetrySettings);
+
+ RetrySettings createDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeidentifyTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createDeidentifyTemplateSettings()
+ .setRetrySettings(createDeidentifyTemplateRetrySettings);
+
+ RetrySettings updateDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeidentifyTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateDeidentifyTemplateSettings()
+ .setRetrySettings(updateDeidentifyTemplateRetrySettings);
+
+ RetrySettings getDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeidentifyTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getDeidentifyTemplateSettings()
+ .setRetrySettings(getDeidentifyTemplateRetrySettings);
+
+ RetrySettings listDeidentifyTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeidentifyTemplatesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listDeidentifyTemplatesSettings()
+ .setRetrySettings(listDeidentifyTemplatesRetrySettings);
+
+ RetrySettings deleteDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeidentifyTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteDeidentifyTemplateSettings()
+ .setRetrySettings(deleteDeidentifyTemplateRetrySettings);
+
+ RetrySettings createJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createJobTriggerSettings()
+ .setRetrySettings(createJobTriggerRetrySettings);
+
+ RetrySettings updateJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateJobTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateJobTriggerSettings()
+ .setRetrySettings(updateJobTriggerRetrySettings);
+
+ RetrySettings hybridInspectJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.hybridInspectJobTriggerSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .hybridInspectJobTriggerSettings()
+ .setRetrySettings(hybridInspectJobTriggerRetrySettings);
+
+ RetrySettings getJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJobTriggerSettings().setRetrySettings(getJobTriggerRetrySettings);
+
+ RetrySettings listJobTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobTriggersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listJobTriggersSettings()
+ .setRetrySettings(listJobTriggersRetrySettings);
+
+ RetrySettings deleteJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteJobTriggerSettings()
+ .setRetrySettings(deleteJobTriggerRetrySettings);
+
+ RetrySettings activateJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.activateJobTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .activateJobTriggerSettings()
+ .setRetrySettings(activateJobTriggerRetrySettings);
+
+ RetrySettings createDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createDlpJobSettings().setRetrySettings(createDlpJobRetrySettings);
+
+ RetrySettings listDlpJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDlpJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listDlpJobsSettings().setRetrySettings(listDlpJobsRetrySettings);
+
+ RetrySettings getDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDlpJobSettings().setRetrySettings(getDlpJobRetrySettings);
+
+ RetrySettings deleteDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteDlpJobSettings().setRetrySettings(deleteDlpJobRetrySettings);
+
+ RetrySettings cancelDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.cancelDlpJobSettings().setRetrySettings(cancelDlpJobRetrySettings);
+
+ RetrySettings createStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createStoredInfoTypeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createStoredInfoTypeSettings()
+ .setRetrySettings(createStoredInfoTypeRetrySettings);
+
+ RetrySettings updateStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateStoredInfoTypeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateStoredInfoTypeSettings()
+ .setRetrySettings(updateStoredInfoTypeRetrySettings);
+
+ RetrySettings getStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStoredInfoTypeSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getStoredInfoTypeSettings()
+ .setRetrySettings(getStoredInfoTypeRetrySettings);
+
+ RetrySettings listStoredInfoTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStoredInfoTypesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listStoredInfoTypesSettings()
+ .setRetrySettings(listStoredInfoTypesRetrySettings);
+
+ RetrySettings deleteStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteStoredInfoTypeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteStoredInfoTypeSettings()
+ .setRetrySettings(deleteStoredInfoTypeRetrySettings);
+
+ RetrySettings hybridInspectDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.hybridInspectDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .hybridInspectDlpJobSettings()
+ .setRetrySettings(hybridInspectDlpJobRetrySettings);
+
+ RetrySettings finishDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.finishDlpJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.finishDlpJobSettings().setRetrySettings(finishDlpJobRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry inspectContentRetry = clientProperties.getInspectContentRetry();
+ if (inspectContentRetry != null) {
+ RetrySettings inspectContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.inspectContentSettings().getRetrySettings(),
+ inspectContentRetry);
+ clientSettingsBuilder.inspectContentSettings().setRetrySettings(inspectContentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for inspectContent from properties.");
+ }
+ }
+ Retry redactImageRetry = clientProperties.getRedactImageRetry();
+ if (redactImageRetry != null) {
+ RetrySettings redactImageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.redactImageSettings().getRetrySettings(), redactImageRetry);
+ clientSettingsBuilder.redactImageSettings().setRetrySettings(redactImageRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for redactImage from properties.");
+ }
+ }
+ Retry deidentifyContentRetry = clientProperties.getDeidentifyContentRetry();
+ if (deidentifyContentRetry != null) {
+ RetrySettings deidentifyContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deidentifyContentSettings().getRetrySettings(),
+ deidentifyContentRetry);
+ clientSettingsBuilder
+ .deidentifyContentSettings()
+ .setRetrySettings(deidentifyContentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deidentifyContent from properties.");
+ }
+ }
+ Retry reidentifyContentRetry = clientProperties.getReidentifyContentRetry();
+ if (reidentifyContentRetry != null) {
+ RetrySettings reidentifyContentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.reidentifyContentSettings().getRetrySettings(),
+ reidentifyContentRetry);
+ clientSettingsBuilder
+ .reidentifyContentSettings()
+ .setRetrySettings(reidentifyContentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for reidentifyContent from properties.");
+ }
+ }
+ Retry listInfoTypesRetry = clientProperties.getListInfoTypesRetry();
+ if (listInfoTypesRetry != null) {
+ RetrySettings listInfoTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInfoTypesSettings().getRetrySettings(), listInfoTypesRetry);
+ clientSettingsBuilder.listInfoTypesSettings().setRetrySettings(listInfoTypesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInfoTypes from properties.");
+ }
+ }
+ Retry createInspectTemplateRetry = clientProperties.getCreateInspectTemplateRetry();
+ if (createInspectTemplateRetry != null) {
+ RetrySettings createInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createInspectTemplateSettings().getRetrySettings(),
+ createInspectTemplateRetry);
+ clientSettingsBuilder
+ .createInspectTemplateSettings()
+ .setRetrySettings(createInspectTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createInspectTemplate from properties.");
+ }
+ }
+ Retry updateInspectTemplateRetry = clientProperties.getUpdateInspectTemplateRetry();
+ if (updateInspectTemplateRetry != null) {
+ RetrySettings updateInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInspectTemplateSettings().getRetrySettings(),
+ updateInspectTemplateRetry);
+ clientSettingsBuilder
+ .updateInspectTemplateSettings()
+ .setRetrySettings(updateInspectTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateInspectTemplate from properties.");
+ }
+ }
+ Retry getInspectTemplateRetry = clientProperties.getGetInspectTemplateRetry();
+ if (getInspectTemplateRetry != null) {
+ RetrySettings getInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInspectTemplateSettings().getRetrySettings(),
+ getInspectTemplateRetry);
+ clientSettingsBuilder
+ .getInspectTemplateSettings()
+ .setRetrySettings(getInspectTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getInspectTemplate from properties.");
+ }
+ }
+ Retry listInspectTemplatesRetry = clientProperties.getListInspectTemplatesRetry();
+ if (listInspectTemplatesRetry != null) {
+ RetrySettings listInspectTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInspectTemplatesSettings().getRetrySettings(),
+ listInspectTemplatesRetry);
+ clientSettingsBuilder
+ .listInspectTemplatesSettings()
+ .setRetrySettings(listInspectTemplatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listInspectTemplates from properties.");
+ }
+ }
+ Retry deleteInspectTemplateRetry = clientProperties.getDeleteInspectTemplateRetry();
+ if (deleteInspectTemplateRetry != null) {
+ RetrySettings deleteInspectTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteInspectTemplateSettings().getRetrySettings(),
+ deleteInspectTemplateRetry);
+ clientSettingsBuilder
+ .deleteInspectTemplateSettings()
+ .setRetrySettings(deleteInspectTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteInspectTemplate from properties.");
+ }
+ }
+ Retry createDeidentifyTemplateRetry = clientProperties.getCreateDeidentifyTemplateRetry();
+ if (createDeidentifyTemplateRetry != null) {
+ RetrySettings createDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeidentifyTemplateSettings().getRetrySettings(),
+ createDeidentifyTemplateRetry);
+ clientSettingsBuilder
+ .createDeidentifyTemplateSettings()
+ .setRetrySettings(createDeidentifyTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createDeidentifyTemplate from properties.");
+ }
+ }
+ Retry updateDeidentifyTemplateRetry = clientProperties.getUpdateDeidentifyTemplateRetry();
+ if (updateDeidentifyTemplateRetry != null) {
+ RetrySettings updateDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeidentifyTemplateSettings().getRetrySettings(),
+ updateDeidentifyTemplateRetry);
+ clientSettingsBuilder
+ .updateDeidentifyTemplateSettings()
+ .setRetrySettings(updateDeidentifyTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateDeidentifyTemplate from properties.");
+ }
+ }
+ Retry getDeidentifyTemplateRetry = clientProperties.getGetDeidentifyTemplateRetry();
+ if (getDeidentifyTemplateRetry != null) {
+ RetrySettings getDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeidentifyTemplateSettings().getRetrySettings(),
+ getDeidentifyTemplateRetry);
+ clientSettingsBuilder
+ .getDeidentifyTemplateSettings()
+ .setRetrySettings(getDeidentifyTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getDeidentifyTemplate from properties.");
+ }
+ }
+ Retry listDeidentifyTemplatesRetry = clientProperties.getListDeidentifyTemplatesRetry();
+ if (listDeidentifyTemplatesRetry != null) {
+ RetrySettings listDeidentifyTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeidentifyTemplatesSettings().getRetrySettings(),
+ listDeidentifyTemplatesRetry);
+ clientSettingsBuilder
+ .listDeidentifyTemplatesSettings()
+ .setRetrySettings(listDeidentifyTemplatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDeidentifyTemplates from properties.");
+ }
+ }
+ Retry deleteDeidentifyTemplateRetry = clientProperties.getDeleteDeidentifyTemplateRetry();
+ if (deleteDeidentifyTemplateRetry != null) {
+ RetrySettings deleteDeidentifyTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeidentifyTemplateSettings().getRetrySettings(),
+ deleteDeidentifyTemplateRetry);
+ clientSettingsBuilder
+ .deleteDeidentifyTemplateSettings()
+ .setRetrySettings(deleteDeidentifyTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteDeidentifyTemplate from properties.");
+ }
+ }
+ Retry createJobTriggerRetry = clientProperties.getCreateJobTriggerRetry();
+ if (createJobTriggerRetry != null) {
+ RetrySettings createJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobTriggerSettings().getRetrySettings(),
+ createJobTriggerRetry);
+ clientSettingsBuilder
+ .createJobTriggerSettings()
+ .setRetrySettings(createJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createJobTrigger from properties.");
+ }
+ }
+ Retry updateJobTriggerRetry = clientProperties.getUpdateJobTriggerRetry();
+ if (updateJobTriggerRetry != null) {
+ RetrySettings updateJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateJobTriggerSettings().getRetrySettings(),
+ updateJobTriggerRetry);
+ clientSettingsBuilder
+ .updateJobTriggerSettings()
+ .setRetrySettings(updateJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateJobTrigger from properties.");
+ }
+ }
+ Retry hybridInspectJobTriggerRetry = clientProperties.getHybridInspectJobTriggerRetry();
+ if (hybridInspectJobTriggerRetry != null) {
+ RetrySettings hybridInspectJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.hybridInspectJobTriggerSettings().getRetrySettings(),
+ hybridInspectJobTriggerRetry);
+ clientSettingsBuilder
+ .hybridInspectJobTriggerSettings()
+ .setRetrySettings(hybridInspectJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for hybridInspectJobTrigger from properties.");
+ }
+ }
+ Retry getJobTriggerRetry = clientProperties.getGetJobTriggerRetry();
+ if (getJobTriggerRetry != null) {
+ RetrySettings getJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobTriggerSettings().getRetrySettings(), getJobTriggerRetry);
+ clientSettingsBuilder.getJobTriggerSettings().setRetrySettings(getJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJobTrigger from properties.");
+ }
+ }
+ Retry listJobTriggersRetry = clientProperties.getListJobTriggersRetry();
+ if (listJobTriggersRetry != null) {
+ RetrySettings listJobTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobTriggersSettings().getRetrySettings(),
+ listJobTriggersRetry);
+ clientSettingsBuilder
+ .listJobTriggersSettings()
+ .setRetrySettings(listJobTriggersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listJobTriggers from properties.");
+ }
+ }
+ Retry deleteJobTriggerRetry = clientProperties.getDeleteJobTriggerRetry();
+ if (deleteJobTriggerRetry != null) {
+ RetrySettings deleteJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobTriggerSettings().getRetrySettings(),
+ deleteJobTriggerRetry);
+ clientSettingsBuilder
+ .deleteJobTriggerSettings()
+ .setRetrySettings(deleteJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteJobTrigger from properties.");
+ }
+ }
+ Retry activateJobTriggerRetry = clientProperties.getActivateJobTriggerRetry();
+ if (activateJobTriggerRetry != null) {
+ RetrySettings activateJobTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.activateJobTriggerSettings().getRetrySettings(),
+ activateJobTriggerRetry);
+ clientSettingsBuilder
+ .activateJobTriggerSettings()
+ .setRetrySettings(activateJobTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for activateJobTrigger from properties.");
+ }
+ }
+ Retry createDlpJobRetry = clientProperties.getCreateDlpJobRetry();
+ if (createDlpJobRetry != null) {
+ RetrySettings createDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDlpJobSettings().getRetrySettings(), createDlpJobRetry);
+ clientSettingsBuilder.createDlpJobSettings().setRetrySettings(createDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createDlpJob from properties.");
+ }
+ }
+ Retry listDlpJobsRetry = clientProperties.getListDlpJobsRetry();
+ if (listDlpJobsRetry != null) {
+ RetrySettings listDlpJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDlpJobsSettings().getRetrySettings(), listDlpJobsRetry);
+ clientSettingsBuilder.listDlpJobsSettings().setRetrySettings(listDlpJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDlpJobs from properties.");
+ }
+ }
+ Retry getDlpJobRetry = clientProperties.getGetDlpJobRetry();
+ if (getDlpJobRetry != null) {
+ RetrySettings getDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDlpJobSettings().getRetrySettings(), getDlpJobRetry);
+ clientSettingsBuilder.getDlpJobSettings().setRetrySettings(getDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDlpJob from properties.");
+ }
+ }
+ Retry deleteDlpJobRetry = clientProperties.getDeleteDlpJobRetry();
+ if (deleteDlpJobRetry != null) {
+ RetrySettings deleteDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDlpJobSettings().getRetrySettings(), deleteDlpJobRetry);
+ clientSettingsBuilder.deleteDlpJobSettings().setRetrySettings(deleteDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteDlpJob from properties.");
+ }
+ }
+ Retry cancelDlpJobRetry = clientProperties.getCancelDlpJobRetry();
+ if (cancelDlpJobRetry != null) {
+ RetrySettings cancelDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelDlpJobSettings().getRetrySettings(), cancelDlpJobRetry);
+ clientSettingsBuilder.cancelDlpJobSettings().setRetrySettings(cancelDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for cancelDlpJob from properties.");
+ }
+ }
+ Retry createStoredInfoTypeRetry = clientProperties.getCreateStoredInfoTypeRetry();
+ if (createStoredInfoTypeRetry != null) {
+ RetrySettings createStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createStoredInfoTypeSettings().getRetrySettings(),
+ createStoredInfoTypeRetry);
+ clientSettingsBuilder
+ .createStoredInfoTypeSettings()
+ .setRetrySettings(createStoredInfoTypeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createStoredInfoType from properties.");
+ }
+ }
+ Retry updateStoredInfoTypeRetry = clientProperties.getUpdateStoredInfoTypeRetry();
+ if (updateStoredInfoTypeRetry != null) {
+ RetrySettings updateStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateStoredInfoTypeSettings().getRetrySettings(),
+ updateStoredInfoTypeRetry);
+ clientSettingsBuilder
+ .updateStoredInfoTypeSettings()
+ .setRetrySettings(updateStoredInfoTypeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateStoredInfoType from properties.");
+ }
+ }
+ Retry getStoredInfoTypeRetry = clientProperties.getGetStoredInfoTypeRetry();
+ if (getStoredInfoTypeRetry != null) {
+ RetrySettings getStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getStoredInfoTypeSettings().getRetrySettings(),
+ getStoredInfoTypeRetry);
+ clientSettingsBuilder
+ .getStoredInfoTypeSettings()
+ .setRetrySettings(getStoredInfoTypeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getStoredInfoType from properties.");
+ }
+ }
+ Retry listStoredInfoTypesRetry = clientProperties.getListStoredInfoTypesRetry();
+ if (listStoredInfoTypesRetry != null) {
+ RetrySettings listStoredInfoTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listStoredInfoTypesSettings().getRetrySettings(),
+ listStoredInfoTypesRetry);
+ clientSettingsBuilder
+ .listStoredInfoTypesSettings()
+ .setRetrySettings(listStoredInfoTypesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listStoredInfoTypes from properties.");
+ }
+ }
+ Retry deleteStoredInfoTypeRetry = clientProperties.getDeleteStoredInfoTypeRetry();
+ if (deleteStoredInfoTypeRetry != null) {
+ RetrySettings deleteStoredInfoTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteStoredInfoTypeSettings().getRetrySettings(),
+ deleteStoredInfoTypeRetry);
+ clientSettingsBuilder
+ .deleteStoredInfoTypeSettings()
+ .setRetrySettings(deleteStoredInfoTypeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteStoredInfoType from properties.");
+ }
+ }
+ Retry hybridInspectDlpJobRetry = clientProperties.getHybridInspectDlpJobRetry();
+ if (hybridInspectDlpJobRetry != null) {
+ RetrySettings hybridInspectDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.hybridInspectDlpJobSettings().getRetrySettings(),
+ hybridInspectDlpJobRetry);
+ clientSettingsBuilder
+ .hybridInspectDlpJobSettings()
+ .setRetrySettings(hybridInspectDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for hybridInspectDlpJob from properties.");
+ }
+ }
+ Retry finishDlpJobRetry = clientProperties.getFinishDlpJobRetry();
+ if (finishDlpJobRetry != null) {
+ RetrySettings finishDlpJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.finishDlpJobSettings().getRetrySettings(), finishDlpJobRetry);
+ clientSettingsBuilder.finishDlpJobSettings().setRetrySettings(finishDlpJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for finishDlpJob from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DlpServiceClient bean configured with DlpServiceSettings.
+ *
+ * @param dlpServiceSettings settings to configure an instance of client bean.
+ * @return a {@link DlpServiceClient} bean configured with {@link DlpServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DlpServiceClient dlpServiceClient(DlpServiceSettings dlpServiceSettings)
+ throws IOException {
+ return DlpServiceClient.create(dlpServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-dlp-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringProperties.java
new file mode 100644
index 0000000000..63d22f2658
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/DlpServiceSpringProperties.java
@@ -0,0 +1,524 @@
+/*
+ * Copyright 2022 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.dlp.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 DlpService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.dlp.v2.dlp-service")
+public class DlpServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for inspectContent. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry inspectContentRetry;
+ /**
+ * Allow override of retry settings at method-level for redactImage. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry redactImageRetry;
+ /**
+ * Allow override of retry settings at method-level for deidentifyContent. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deidentifyContentRetry;
+ /**
+ * Allow override of retry settings at method-level for reidentifyContent. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry reidentifyContentRetry;
+ /**
+ * Allow override of retry settings at method-level for listInfoTypes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInfoTypesRetry;
+ /**
+ * Allow override of retry settings at method-level for createInspectTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createInspectTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for updateInspectTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateInspectTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for getInspectTemplate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInspectTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for listInspectTemplates. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInspectTemplatesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteInspectTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteInspectTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for createDeidentifyTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDeidentifyTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for updateDeidentifyTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateDeidentifyTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for getDeidentifyTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDeidentifyTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for listDeidentifyTemplates. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeidentifyTemplatesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDeidentifyTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDeidentifyTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for createJobTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for updateJobTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for hybridInspectJobTrigger. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry hybridInspectJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for getJobTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for listJobTriggers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listJobTriggersRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteJobTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for activateJobTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry activateJobTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for createDlpJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDlpJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listDlpJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDlpJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getDlpJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDlpJobRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDlpJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDlpJobRetry;
+ /**
+ * Allow override of retry settings at method-level for cancelDlpJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry cancelDlpJobRetry;
+ /**
+ * Allow override of retry settings at method-level for createStoredInfoType. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createStoredInfoTypeRetry;
+ /**
+ * Allow override of retry settings at method-level for updateStoredInfoType. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateStoredInfoTypeRetry;
+ /**
+ * Allow override of retry settings at method-level for getStoredInfoType. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getStoredInfoTypeRetry;
+ /**
+ * Allow override of retry settings at method-level for listStoredInfoTypes. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listStoredInfoTypesRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteStoredInfoType. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteStoredInfoTypeRetry;
+ /**
+ * Allow override of retry settings at method-level for hybridInspectDlpJob. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry hybridInspectDlpJobRetry;
+ /**
+ * Allow override of retry settings at method-level for finishDlpJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry finishDlpJobRetry;
+
+ @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 getInspectContentRetry() {
+ return this.inspectContentRetry;
+ }
+
+ public void setInspectContentRetry(Retry inspectContentRetry) {
+ this.inspectContentRetry = inspectContentRetry;
+ }
+
+ public Retry getRedactImageRetry() {
+ return this.redactImageRetry;
+ }
+
+ public void setRedactImageRetry(Retry redactImageRetry) {
+ this.redactImageRetry = redactImageRetry;
+ }
+
+ public Retry getDeidentifyContentRetry() {
+ return this.deidentifyContentRetry;
+ }
+
+ public void setDeidentifyContentRetry(Retry deidentifyContentRetry) {
+ this.deidentifyContentRetry = deidentifyContentRetry;
+ }
+
+ public Retry getReidentifyContentRetry() {
+ return this.reidentifyContentRetry;
+ }
+
+ public void setReidentifyContentRetry(Retry reidentifyContentRetry) {
+ this.reidentifyContentRetry = reidentifyContentRetry;
+ }
+
+ public Retry getListInfoTypesRetry() {
+ return this.listInfoTypesRetry;
+ }
+
+ public void setListInfoTypesRetry(Retry listInfoTypesRetry) {
+ this.listInfoTypesRetry = listInfoTypesRetry;
+ }
+
+ public Retry getCreateInspectTemplateRetry() {
+ return this.createInspectTemplateRetry;
+ }
+
+ public void setCreateInspectTemplateRetry(Retry createInspectTemplateRetry) {
+ this.createInspectTemplateRetry = createInspectTemplateRetry;
+ }
+
+ public Retry getUpdateInspectTemplateRetry() {
+ return this.updateInspectTemplateRetry;
+ }
+
+ public void setUpdateInspectTemplateRetry(Retry updateInspectTemplateRetry) {
+ this.updateInspectTemplateRetry = updateInspectTemplateRetry;
+ }
+
+ public Retry getGetInspectTemplateRetry() {
+ return this.getInspectTemplateRetry;
+ }
+
+ public void setGetInspectTemplateRetry(Retry getInspectTemplateRetry) {
+ this.getInspectTemplateRetry = getInspectTemplateRetry;
+ }
+
+ public Retry getListInspectTemplatesRetry() {
+ return this.listInspectTemplatesRetry;
+ }
+
+ public void setListInspectTemplatesRetry(Retry listInspectTemplatesRetry) {
+ this.listInspectTemplatesRetry = listInspectTemplatesRetry;
+ }
+
+ public Retry getDeleteInspectTemplateRetry() {
+ return this.deleteInspectTemplateRetry;
+ }
+
+ public void setDeleteInspectTemplateRetry(Retry deleteInspectTemplateRetry) {
+ this.deleteInspectTemplateRetry = deleteInspectTemplateRetry;
+ }
+
+ public Retry getCreateDeidentifyTemplateRetry() {
+ return this.createDeidentifyTemplateRetry;
+ }
+
+ public void setCreateDeidentifyTemplateRetry(Retry createDeidentifyTemplateRetry) {
+ this.createDeidentifyTemplateRetry = createDeidentifyTemplateRetry;
+ }
+
+ public Retry getUpdateDeidentifyTemplateRetry() {
+ return this.updateDeidentifyTemplateRetry;
+ }
+
+ public void setUpdateDeidentifyTemplateRetry(Retry updateDeidentifyTemplateRetry) {
+ this.updateDeidentifyTemplateRetry = updateDeidentifyTemplateRetry;
+ }
+
+ public Retry getGetDeidentifyTemplateRetry() {
+ return this.getDeidentifyTemplateRetry;
+ }
+
+ public void setGetDeidentifyTemplateRetry(Retry getDeidentifyTemplateRetry) {
+ this.getDeidentifyTemplateRetry = getDeidentifyTemplateRetry;
+ }
+
+ public Retry getListDeidentifyTemplatesRetry() {
+ return this.listDeidentifyTemplatesRetry;
+ }
+
+ public void setListDeidentifyTemplatesRetry(Retry listDeidentifyTemplatesRetry) {
+ this.listDeidentifyTemplatesRetry = listDeidentifyTemplatesRetry;
+ }
+
+ public Retry getDeleteDeidentifyTemplateRetry() {
+ return this.deleteDeidentifyTemplateRetry;
+ }
+
+ public void setDeleteDeidentifyTemplateRetry(Retry deleteDeidentifyTemplateRetry) {
+ this.deleteDeidentifyTemplateRetry = deleteDeidentifyTemplateRetry;
+ }
+
+ public Retry getCreateJobTriggerRetry() {
+ return this.createJobTriggerRetry;
+ }
+
+ public void setCreateJobTriggerRetry(Retry createJobTriggerRetry) {
+ this.createJobTriggerRetry = createJobTriggerRetry;
+ }
+
+ public Retry getUpdateJobTriggerRetry() {
+ return this.updateJobTriggerRetry;
+ }
+
+ public void setUpdateJobTriggerRetry(Retry updateJobTriggerRetry) {
+ this.updateJobTriggerRetry = updateJobTriggerRetry;
+ }
+
+ public Retry getHybridInspectJobTriggerRetry() {
+ return this.hybridInspectJobTriggerRetry;
+ }
+
+ public void setHybridInspectJobTriggerRetry(Retry hybridInspectJobTriggerRetry) {
+ this.hybridInspectJobTriggerRetry = hybridInspectJobTriggerRetry;
+ }
+
+ public Retry getGetJobTriggerRetry() {
+ return this.getJobTriggerRetry;
+ }
+
+ public void setGetJobTriggerRetry(Retry getJobTriggerRetry) {
+ this.getJobTriggerRetry = getJobTriggerRetry;
+ }
+
+ public Retry getListJobTriggersRetry() {
+ return this.listJobTriggersRetry;
+ }
+
+ public void setListJobTriggersRetry(Retry listJobTriggersRetry) {
+ this.listJobTriggersRetry = listJobTriggersRetry;
+ }
+
+ public Retry getDeleteJobTriggerRetry() {
+ return this.deleteJobTriggerRetry;
+ }
+
+ public void setDeleteJobTriggerRetry(Retry deleteJobTriggerRetry) {
+ this.deleteJobTriggerRetry = deleteJobTriggerRetry;
+ }
+
+ public Retry getActivateJobTriggerRetry() {
+ return this.activateJobTriggerRetry;
+ }
+
+ public void setActivateJobTriggerRetry(Retry activateJobTriggerRetry) {
+ this.activateJobTriggerRetry = activateJobTriggerRetry;
+ }
+
+ public Retry getCreateDlpJobRetry() {
+ return this.createDlpJobRetry;
+ }
+
+ public void setCreateDlpJobRetry(Retry createDlpJobRetry) {
+ this.createDlpJobRetry = createDlpJobRetry;
+ }
+
+ public Retry getListDlpJobsRetry() {
+ return this.listDlpJobsRetry;
+ }
+
+ public void setListDlpJobsRetry(Retry listDlpJobsRetry) {
+ this.listDlpJobsRetry = listDlpJobsRetry;
+ }
+
+ public Retry getGetDlpJobRetry() {
+ return this.getDlpJobRetry;
+ }
+
+ public void setGetDlpJobRetry(Retry getDlpJobRetry) {
+ this.getDlpJobRetry = getDlpJobRetry;
+ }
+
+ public Retry getDeleteDlpJobRetry() {
+ return this.deleteDlpJobRetry;
+ }
+
+ public void setDeleteDlpJobRetry(Retry deleteDlpJobRetry) {
+ this.deleteDlpJobRetry = deleteDlpJobRetry;
+ }
+
+ public Retry getCancelDlpJobRetry() {
+ return this.cancelDlpJobRetry;
+ }
+
+ public void setCancelDlpJobRetry(Retry cancelDlpJobRetry) {
+ this.cancelDlpJobRetry = cancelDlpJobRetry;
+ }
+
+ public Retry getCreateStoredInfoTypeRetry() {
+ return this.createStoredInfoTypeRetry;
+ }
+
+ public void setCreateStoredInfoTypeRetry(Retry createStoredInfoTypeRetry) {
+ this.createStoredInfoTypeRetry = createStoredInfoTypeRetry;
+ }
+
+ public Retry getUpdateStoredInfoTypeRetry() {
+ return this.updateStoredInfoTypeRetry;
+ }
+
+ public void setUpdateStoredInfoTypeRetry(Retry updateStoredInfoTypeRetry) {
+ this.updateStoredInfoTypeRetry = updateStoredInfoTypeRetry;
+ }
+
+ public Retry getGetStoredInfoTypeRetry() {
+ return this.getStoredInfoTypeRetry;
+ }
+
+ public void setGetStoredInfoTypeRetry(Retry getStoredInfoTypeRetry) {
+ this.getStoredInfoTypeRetry = getStoredInfoTypeRetry;
+ }
+
+ public Retry getListStoredInfoTypesRetry() {
+ return this.listStoredInfoTypesRetry;
+ }
+
+ public void setListStoredInfoTypesRetry(Retry listStoredInfoTypesRetry) {
+ this.listStoredInfoTypesRetry = listStoredInfoTypesRetry;
+ }
+
+ public Retry getDeleteStoredInfoTypeRetry() {
+ return this.deleteStoredInfoTypeRetry;
+ }
+
+ public void setDeleteStoredInfoTypeRetry(Retry deleteStoredInfoTypeRetry) {
+ this.deleteStoredInfoTypeRetry = deleteStoredInfoTypeRetry;
+ }
+
+ public Retry getHybridInspectDlpJobRetry() {
+ return this.hybridInspectDlpJobRetry;
+ }
+
+ public void setHybridInspectDlpJobRetry(Retry hybridInspectDlpJobRetry) {
+ this.hybridInspectDlpJobRetry = hybridInspectDlpJobRetry;
+ }
+
+ public Retry getFinishDlpJobRetry() {
+ return this.finishDlpJobRetry;
+ }
+
+ public void setFinishDlpJobRetry(Retry finishDlpJobRetry) {
+ this.finishDlpJobRetry = finishDlpJobRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/package-info.java
new file mode 100644
index 0000000000..8fb105c7ce
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/java/com/google/cloud/dlp/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for dlp. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.dlp.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..2188e0540b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.dlp.v2.dlp-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud dlp/DlpService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1875be55ca
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dlp-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.dlp.v2.spring.DlpServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-dms-spring-starter/pom.xml
new file mode 100644
index 0000000000..0db02dd5b5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dms-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DataMigrationServiceSpringProperties. 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 DataMigrationServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataMigrationServiceSettings dataMigrationServiceSettings(
+ @Qualifier("defaultDataMigrationServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DataMigrationServiceSettings.Builder clientSettingsBuilder =
+ DataMigrationServiceSettings.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 =
+ DataMigrationServiceSettings.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 listMigrationJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMigrationJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listMigrationJobsSettings()
+ .setRetrySettings(listMigrationJobsRetrySettings);
+
+ RetrySettings getMigrationJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMigrationJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getMigrationJobSettings()
+ .setRetrySettings(getMigrationJobRetrySettings);
+
+ RetrySettings generateSshScriptRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateSshScriptSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .generateSshScriptSettings()
+ .setRetrySettings(generateSshScriptRetrySettings);
+
+ RetrySettings listConnectionProfilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionProfilesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listConnectionProfilesSettings()
+ .setRetrySettings(listConnectionProfilesRetrySettings);
+
+ RetrySettings getConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionProfileSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getConnectionProfileSettings()
+ .setRetrySettings(getConnectionProfileRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listMigrationJobsRetry = clientProperties.getListMigrationJobsRetry();
+ if (listMigrationJobsRetry != null) {
+ RetrySettings listMigrationJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMigrationJobsSettings().getRetrySettings(),
+ listMigrationJobsRetry);
+ clientSettingsBuilder
+ .listMigrationJobsSettings()
+ .setRetrySettings(listMigrationJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listMigrationJobs from properties.");
+ }
+ }
+ Retry getMigrationJobRetry = clientProperties.getGetMigrationJobRetry();
+ if (getMigrationJobRetry != null) {
+ RetrySettings getMigrationJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMigrationJobSettings().getRetrySettings(),
+ getMigrationJobRetry);
+ clientSettingsBuilder
+ .getMigrationJobSettings()
+ .setRetrySettings(getMigrationJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getMigrationJob from properties.");
+ }
+ }
+ Retry generateSshScriptRetry = clientProperties.getGenerateSshScriptRetry();
+ if (generateSshScriptRetry != null) {
+ RetrySettings generateSshScriptRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateSshScriptSettings().getRetrySettings(),
+ generateSshScriptRetry);
+ clientSettingsBuilder
+ .generateSshScriptSettings()
+ .setRetrySettings(generateSshScriptRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateSshScript from properties.");
+ }
+ }
+ Retry listConnectionProfilesRetry = clientProperties.getListConnectionProfilesRetry();
+ if (listConnectionProfilesRetry != null) {
+ RetrySettings listConnectionProfilesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectionProfilesSettings().getRetrySettings(),
+ listConnectionProfilesRetry);
+ clientSettingsBuilder
+ .listConnectionProfilesSettings()
+ .setRetrySettings(listConnectionProfilesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listConnectionProfiles from properties.");
+ }
+ }
+ Retry getConnectionProfileRetry = clientProperties.getGetConnectionProfileRetry();
+ if (getConnectionProfileRetry != null) {
+ RetrySettings getConnectionProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectionProfileSettings().getRetrySettings(),
+ getConnectionProfileRetry);
+ clientSettingsBuilder
+ .getConnectionProfileSettings()
+ .setRetrySettings(getConnectionProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getConnectionProfile from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DataMigrationServiceClient bean configured with DataMigrationServiceSettings.
+ *
+ * @param dataMigrationServiceSettings settings to configure an instance of client bean.
+ * @return a {@link DataMigrationServiceClient} bean configured with {@link
+ * DataMigrationServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DataMigrationServiceClient dataMigrationServiceClient(
+ DataMigrationServiceSettings dataMigrationServiceSettings) throws IOException {
+ return DataMigrationServiceClient.create(dataMigrationServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-data-migration-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringProperties.java
new file mode 100644
index 0000000000..1de48e00a3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/DataMigrationServiceSpringProperties.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2022 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.clouddms.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 DataMigrationService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.clouddms.v1.data-migration-service")
+public class DataMigrationServiceSpringProperties 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 listMigrationJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listMigrationJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getMigrationJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMigrationJobRetry;
+ /**
+ * Allow override of retry settings at method-level for generateSshScript. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateSshScriptRetry;
+ /**
+ * Allow override of retry settings at method-level for listConnectionProfiles. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConnectionProfilesRetry;
+ /**
+ * Allow override of retry settings at method-level for getConnectionProfile. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConnectionProfileRetry;
+
+ @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 getListMigrationJobsRetry() {
+ return this.listMigrationJobsRetry;
+ }
+
+ public void setListMigrationJobsRetry(Retry listMigrationJobsRetry) {
+ this.listMigrationJobsRetry = listMigrationJobsRetry;
+ }
+
+ public Retry getGetMigrationJobRetry() {
+ return this.getMigrationJobRetry;
+ }
+
+ public void setGetMigrationJobRetry(Retry getMigrationJobRetry) {
+ this.getMigrationJobRetry = getMigrationJobRetry;
+ }
+
+ public Retry getGenerateSshScriptRetry() {
+ return this.generateSshScriptRetry;
+ }
+
+ public void setGenerateSshScriptRetry(Retry generateSshScriptRetry) {
+ this.generateSshScriptRetry = generateSshScriptRetry;
+ }
+
+ public Retry getListConnectionProfilesRetry() {
+ return this.listConnectionProfilesRetry;
+ }
+
+ public void setListConnectionProfilesRetry(Retry listConnectionProfilesRetry) {
+ this.listConnectionProfilesRetry = listConnectionProfilesRetry;
+ }
+
+ public Retry getGetConnectionProfileRetry() {
+ return this.getConnectionProfileRetry;
+ }
+
+ public void setGetConnectionProfileRetry(Retry getConnectionProfileRetry) {
+ this.getConnectionProfileRetry = getConnectionProfileRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/package-info.java
new file mode 100644
index 0000000000..ab17c9344a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/java/com/google/cloud/clouddms/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for datamigration. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.clouddms.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..e04040971d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.clouddms.v1.data-migration-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud datamigration/DataMigrationService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a727a19b5a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-dms-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.clouddms.v1.spring.DataMigrationServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-document-ai-spring-starter/pom.xml
new file mode 100644
index 0000000000..1d2fbe282f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DocumentProcessorServiceSpringProperties. 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 DocumentProcessorServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DocumentProcessorServiceSettings documentProcessorServiceSettings(
+ @Qualifier("defaultDocumentProcessorServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DocumentProcessorServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DocumentProcessorServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DocumentProcessorServiceSettings.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 =
+ DocumentProcessorServiceSettings.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 processDocumentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.processDocumentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .processDocumentSettings()
+ .setRetrySettings(processDocumentRetrySettings);
+
+ RetrySettings fetchProcessorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchProcessorTypesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .fetchProcessorTypesSettings()
+ .setRetrySettings(fetchProcessorTypesRetrySettings);
+
+ RetrySettings listProcessorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorTypesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listProcessorTypesSettings()
+ .setRetrySettings(listProcessorTypesRetrySettings);
+
+ RetrySettings listProcessorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listProcessorsSettings().setRetrySettings(listProcessorsRetrySettings);
+
+ RetrySettings getProcessorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProcessorSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getProcessorSettings().setRetrySettings(getProcessorRetrySettings);
+
+ RetrySettings getProcessorVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProcessorVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getProcessorVersionSettings()
+ .setRetrySettings(getProcessorVersionRetrySettings);
+
+ RetrySettings listProcessorVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorVersionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listProcessorVersionsSettings()
+ .setRetrySettings(listProcessorVersionsRetrySettings);
+
+ RetrySettings createProcessorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createProcessorSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createProcessorSettings()
+ .setRetrySettings(createProcessorRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry processDocumentRetry = clientProperties.getProcessDocumentRetry();
+ if (processDocumentRetry != null) {
+ RetrySettings processDocumentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.processDocumentSettings().getRetrySettings(),
+ processDocumentRetry);
+ clientSettingsBuilder
+ .processDocumentSettings()
+ .setRetrySettings(processDocumentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for processDocument from properties.");
+ }
+ }
+ Retry fetchProcessorTypesRetry = clientProperties.getFetchProcessorTypesRetry();
+ if (fetchProcessorTypesRetry != null) {
+ RetrySettings fetchProcessorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchProcessorTypesSettings().getRetrySettings(),
+ fetchProcessorTypesRetry);
+ clientSettingsBuilder
+ .fetchProcessorTypesSettings()
+ .setRetrySettings(fetchProcessorTypesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for fetchProcessorTypes from properties.");
+ }
+ }
+ Retry listProcessorTypesRetry = clientProperties.getListProcessorTypesRetry();
+ if (listProcessorTypesRetry != null) {
+ RetrySettings listProcessorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorTypesSettings().getRetrySettings(),
+ listProcessorTypesRetry);
+ clientSettingsBuilder
+ .listProcessorTypesSettings()
+ .setRetrySettings(listProcessorTypesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listProcessorTypes from properties.");
+ }
+ }
+ Retry listProcessorsRetry = clientProperties.getListProcessorsRetry();
+ if (listProcessorsRetry != null) {
+ RetrySettings listProcessorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorsSettings().getRetrySettings(),
+ listProcessorsRetry);
+ clientSettingsBuilder.listProcessorsSettings().setRetrySettings(listProcessorsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listProcessors from properties.");
+ }
+ }
+ Retry getProcessorRetry = clientProperties.getGetProcessorRetry();
+ if (getProcessorRetry != null) {
+ RetrySettings getProcessorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProcessorSettings().getRetrySettings(), getProcessorRetry);
+ clientSettingsBuilder.getProcessorSettings().setRetrySettings(getProcessorRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getProcessor from properties.");
+ }
+ }
+ Retry getProcessorVersionRetry = clientProperties.getGetProcessorVersionRetry();
+ if (getProcessorVersionRetry != null) {
+ RetrySettings getProcessorVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProcessorVersionSettings().getRetrySettings(),
+ getProcessorVersionRetry);
+ clientSettingsBuilder
+ .getProcessorVersionSettings()
+ .setRetrySettings(getProcessorVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getProcessorVersion from properties.");
+ }
+ }
+ Retry listProcessorVersionsRetry = clientProperties.getListProcessorVersionsRetry();
+ if (listProcessorVersionsRetry != null) {
+ RetrySettings listProcessorVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProcessorVersionsSettings().getRetrySettings(),
+ listProcessorVersionsRetry);
+ clientSettingsBuilder
+ .listProcessorVersionsSettings()
+ .setRetrySettings(listProcessorVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listProcessorVersions from properties.");
+ }
+ }
+ Retry createProcessorRetry = clientProperties.getCreateProcessorRetry();
+ if (createProcessorRetry != null) {
+ RetrySettings createProcessorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createProcessorSettings().getRetrySettings(),
+ createProcessorRetry);
+ clientSettingsBuilder
+ .createProcessorSettings()
+ .setRetrySettings(createProcessorRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createProcessor from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DocumentProcessorServiceClient bean configured with
+ * DocumentProcessorServiceSettings.
+ *
+ * @param documentProcessorServiceSettings settings to configure an instance of client bean.
+ * @return a {@link DocumentProcessorServiceClient} bean configured with {@link
+ * DocumentProcessorServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DocumentProcessorServiceClient documentProcessorServiceClient(
+ DocumentProcessorServiceSettings documentProcessorServiceSettings) throws IOException {
+ return DocumentProcessorServiceClient.create(documentProcessorServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-document-processor-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringProperties.java b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringProperties.java
new file mode 100644
index 0000000000..282ff69b2e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/DocumentProcessorServiceSpringProperties.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2022 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.documentai.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 DocumentProcessorService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.documentai.v1.document-processor-service")
+public class DocumentProcessorServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for processDocument. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry processDocumentRetry;
+ /**
+ * Allow override of retry settings at method-level for fetchProcessorTypes. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry fetchProcessorTypesRetry;
+ /**
+ * Allow override of retry settings at method-level for listProcessorTypes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listProcessorTypesRetry;
+ /**
+ * Allow override of retry settings at method-level for listProcessors. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listProcessorsRetry;
+ /**
+ * Allow override of retry settings at method-level for getProcessor. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getProcessorRetry;
+ /**
+ * Allow override of retry settings at method-level for getProcessorVersion. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getProcessorVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for listProcessorVersions. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listProcessorVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for createProcessor. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createProcessorRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getProcessDocumentRetry() {
+ return this.processDocumentRetry;
+ }
+
+ public void setProcessDocumentRetry(Retry processDocumentRetry) {
+ this.processDocumentRetry = processDocumentRetry;
+ }
+
+ public Retry getFetchProcessorTypesRetry() {
+ return this.fetchProcessorTypesRetry;
+ }
+
+ public void setFetchProcessorTypesRetry(Retry fetchProcessorTypesRetry) {
+ this.fetchProcessorTypesRetry = fetchProcessorTypesRetry;
+ }
+
+ public Retry getListProcessorTypesRetry() {
+ return this.listProcessorTypesRetry;
+ }
+
+ public void setListProcessorTypesRetry(Retry listProcessorTypesRetry) {
+ this.listProcessorTypesRetry = listProcessorTypesRetry;
+ }
+
+ public Retry getListProcessorsRetry() {
+ return this.listProcessorsRetry;
+ }
+
+ public void setListProcessorsRetry(Retry listProcessorsRetry) {
+ this.listProcessorsRetry = listProcessorsRetry;
+ }
+
+ public Retry getGetProcessorRetry() {
+ return this.getProcessorRetry;
+ }
+
+ public void setGetProcessorRetry(Retry getProcessorRetry) {
+ this.getProcessorRetry = getProcessorRetry;
+ }
+
+ public Retry getGetProcessorVersionRetry() {
+ return this.getProcessorVersionRetry;
+ }
+
+ public void setGetProcessorVersionRetry(Retry getProcessorVersionRetry) {
+ this.getProcessorVersionRetry = getProcessorVersionRetry;
+ }
+
+ public Retry getListProcessorVersionsRetry() {
+ return this.listProcessorVersionsRetry;
+ }
+
+ public void setListProcessorVersionsRetry(Retry listProcessorVersionsRetry) {
+ this.listProcessorVersionsRetry = listProcessorVersionsRetry;
+ }
+
+ public Retry getCreateProcessorRetry() {
+ return this.createProcessorRetry;
+ }
+
+ public void setCreateProcessorRetry(Retry createProcessorRetry) {
+ this.createProcessorRetry = createProcessorRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/package-info.java
new file mode 100644
index 0000000000..5743d75ea2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/java/com/google/cloud/documentai/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for documentai. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.documentai.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..a91338edec
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.documentai.v1.document-processor-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud documentai/DocumentProcessorService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..048f076c87
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-document-ai-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.documentai.v1.spring.DocumentProcessorServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-domains-spring-starter/pom.xml
new file mode 100644
index 0000000000..0bc83f4937
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-domains-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DomainsSpringProperties. 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 DomainsSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DomainsSettings domainsSettings(
+ @Qualifier("defaultDomainsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DomainsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DomainsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DomainsSettings.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 =
+ DomainsSettings.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 searchDomainsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchDomainsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.searchDomainsSettings().setRetrySettings(searchDomainsRetrySettings);
+
+ RetrySettings retrieveRegisterParametersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveRegisterParametersSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .retrieveRegisterParametersSettings()
+ .setRetrySettings(retrieveRegisterParametersRetrySettings);
+
+ RetrySettings retrieveTransferParametersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveTransferParametersSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .retrieveTransferParametersSettings()
+ .setRetrySettings(retrieveTransferParametersRetrySettings);
+
+ RetrySettings listRegistrationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRegistrationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listRegistrationsSettings()
+ .setRetrySettings(listRegistrationsRetrySettings);
+
+ RetrySettings getRegistrationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRegistrationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getRegistrationSettings()
+ .setRetrySettings(getRegistrationRetrySettings);
+
+ RetrySettings retrieveAuthorizationCodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveAuthorizationCodeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .retrieveAuthorizationCodeSettings()
+ .setRetrySettings(retrieveAuthorizationCodeRetrySettings);
+
+ RetrySettings resetAuthorizationCodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resetAuthorizationCodeSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .resetAuthorizationCodeSettings()
+ .setRetrySettings(resetAuthorizationCodeRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry searchDomainsRetry = clientProperties.getSearchDomainsRetry();
+ if (searchDomainsRetry != null) {
+ RetrySettings searchDomainsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchDomainsSettings().getRetrySettings(), searchDomainsRetry);
+ clientSettingsBuilder.searchDomainsSettings().setRetrySettings(searchDomainsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for searchDomains from properties.");
+ }
+ }
+ Retry retrieveRegisterParametersRetry = clientProperties.getRetrieveRegisterParametersRetry();
+ if (retrieveRegisterParametersRetry != null) {
+ RetrySettings retrieveRegisterParametersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveRegisterParametersSettings().getRetrySettings(),
+ retrieveRegisterParametersRetry);
+ clientSettingsBuilder
+ .retrieveRegisterParametersSettings()
+ .setRetrySettings(retrieveRegisterParametersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for retrieveRegisterParameters from properties.");
+ }
+ }
+ Retry retrieveTransferParametersRetry = clientProperties.getRetrieveTransferParametersRetry();
+ if (retrieveTransferParametersRetry != null) {
+ RetrySettings retrieveTransferParametersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveTransferParametersSettings().getRetrySettings(),
+ retrieveTransferParametersRetry);
+ clientSettingsBuilder
+ .retrieveTransferParametersSettings()
+ .setRetrySettings(retrieveTransferParametersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for retrieveTransferParameters from properties.");
+ }
+ }
+ Retry listRegistrationsRetry = clientProperties.getListRegistrationsRetry();
+ if (listRegistrationsRetry != null) {
+ RetrySettings listRegistrationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRegistrationsSettings().getRetrySettings(),
+ listRegistrationsRetry);
+ clientSettingsBuilder
+ .listRegistrationsSettings()
+ .setRetrySettings(listRegistrationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRegistrations from properties.");
+ }
+ }
+ Retry getRegistrationRetry = clientProperties.getGetRegistrationRetry();
+ if (getRegistrationRetry != null) {
+ RetrySettings getRegistrationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRegistrationSettings().getRetrySettings(),
+ getRegistrationRetry);
+ clientSettingsBuilder
+ .getRegistrationSettings()
+ .setRetrySettings(getRegistrationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRegistration from properties.");
+ }
+ }
+ Retry retrieveAuthorizationCodeRetry = clientProperties.getRetrieveAuthorizationCodeRetry();
+ if (retrieveAuthorizationCodeRetry != null) {
+ RetrySettings retrieveAuthorizationCodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveAuthorizationCodeSettings().getRetrySettings(),
+ retrieveAuthorizationCodeRetry);
+ clientSettingsBuilder
+ .retrieveAuthorizationCodeSettings()
+ .setRetrySettings(retrieveAuthorizationCodeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for retrieveAuthorizationCode from properties.");
+ }
+ }
+ Retry resetAuthorizationCodeRetry = clientProperties.getResetAuthorizationCodeRetry();
+ if (resetAuthorizationCodeRetry != null) {
+ RetrySettings resetAuthorizationCodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resetAuthorizationCodeSettings().getRetrySettings(),
+ resetAuthorizationCodeRetry);
+ clientSettingsBuilder
+ .resetAuthorizationCodeSettings()
+ .setRetrySettings(resetAuthorizationCodeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for resetAuthorizationCode from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DomainsClient bean configured with DomainsSettings.
+ *
+ * @param domainsSettings settings to configure an instance of client bean.
+ * @return a {@link DomainsClient} bean configured with {@link DomainsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DomainsClient domainsClient(DomainsSettings domainsSettings) throws IOException {
+ return DomainsClient.create(domainsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-domains";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringProperties.java b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringProperties.java
new file mode 100644
index 0000000000..e419118f38
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/DomainsSpringProperties.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2022 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.domains.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 Domains client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.domains.v1.domains")
+public class DomainsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for searchDomains. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchDomainsRetry;
+ /**
+ * Allow override of retry settings at method-level for retrieveRegisterParameters. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry retrieveRegisterParametersRetry;
+ /**
+ * Allow override of retry settings at method-level for retrieveTransferParameters. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry retrieveTransferParametersRetry;
+ /**
+ * Allow override of retry settings at method-level for listRegistrations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRegistrationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRegistration. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRegistrationRetry;
+ /**
+ * Allow override of retry settings at method-level for retrieveAuthorizationCode. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry retrieveAuthorizationCodeRetry;
+ /**
+ * Allow override of retry settings at method-level for resetAuthorizationCode. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry resetAuthorizationCodeRetry;
+
+ @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 getSearchDomainsRetry() {
+ return this.searchDomainsRetry;
+ }
+
+ public void setSearchDomainsRetry(Retry searchDomainsRetry) {
+ this.searchDomainsRetry = searchDomainsRetry;
+ }
+
+ public Retry getRetrieveRegisterParametersRetry() {
+ return this.retrieveRegisterParametersRetry;
+ }
+
+ public void setRetrieveRegisterParametersRetry(Retry retrieveRegisterParametersRetry) {
+ this.retrieveRegisterParametersRetry = retrieveRegisterParametersRetry;
+ }
+
+ public Retry getRetrieveTransferParametersRetry() {
+ return this.retrieveTransferParametersRetry;
+ }
+
+ public void setRetrieveTransferParametersRetry(Retry retrieveTransferParametersRetry) {
+ this.retrieveTransferParametersRetry = retrieveTransferParametersRetry;
+ }
+
+ public Retry getListRegistrationsRetry() {
+ return this.listRegistrationsRetry;
+ }
+
+ public void setListRegistrationsRetry(Retry listRegistrationsRetry) {
+ this.listRegistrationsRetry = listRegistrationsRetry;
+ }
+
+ public Retry getGetRegistrationRetry() {
+ return this.getRegistrationRetry;
+ }
+
+ public void setGetRegistrationRetry(Retry getRegistrationRetry) {
+ this.getRegistrationRetry = getRegistrationRetry;
+ }
+
+ public Retry getRetrieveAuthorizationCodeRetry() {
+ return this.retrieveAuthorizationCodeRetry;
+ }
+
+ public void setRetrieveAuthorizationCodeRetry(Retry retrieveAuthorizationCodeRetry) {
+ this.retrieveAuthorizationCodeRetry = retrieveAuthorizationCodeRetry;
+ }
+
+ public Retry getResetAuthorizationCodeRetry() {
+ return this.resetAuthorizationCodeRetry;
+ }
+
+ public void setResetAuthorizationCodeRetry(Retry resetAuthorizationCodeRetry) {
+ this.resetAuthorizationCodeRetry = resetAuthorizationCodeRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/package-info.java
new file mode 100644
index 0000000000..14c1b9b71a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/java/com/google/cloud/domains/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for domains. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.domains.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..1b8bc95b49
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.domains.v1.domains.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud domains/Domains components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..9f75208939
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-domains-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.domains.v1.spring.DomainsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/pom.xml
new file mode 100644
index 0000000000..37c1fd77c2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in EssentialContactsServiceSpringProperties. 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 EssentialContactsServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public EssentialContactsServiceSettings essentialContactsServiceSettings(
+ @Qualifier("defaultEssentialContactsServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ EssentialContactsServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = EssentialContactsServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = EssentialContactsServiceSettings.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 =
+ EssentialContactsServiceSettings.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 createContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createContactSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createContactSettings().setRetrySettings(createContactRetrySettings);
+
+ RetrySettings updateContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateContactSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateContactSettings().setRetrySettings(updateContactRetrySettings);
+
+ RetrySettings listContactsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listContactsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listContactsSettings().setRetrySettings(listContactsRetrySettings);
+
+ RetrySettings getContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getContactSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getContactSettings().setRetrySettings(getContactRetrySettings);
+
+ RetrySettings deleteContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteContactSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteContactSettings().setRetrySettings(deleteContactRetrySettings);
+
+ RetrySettings computeContactsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.computeContactsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .computeContactsSettings()
+ .setRetrySettings(computeContactsRetrySettings);
+
+ RetrySettings sendTestMessageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.sendTestMessageSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .sendTestMessageSettings()
+ .setRetrySettings(sendTestMessageRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createContactRetry = clientProperties.getCreateContactRetry();
+ if (createContactRetry != null) {
+ RetrySettings createContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createContactSettings().getRetrySettings(), createContactRetry);
+ clientSettingsBuilder.createContactSettings().setRetrySettings(createContactRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createContact from properties.");
+ }
+ }
+ Retry updateContactRetry = clientProperties.getUpdateContactRetry();
+ if (updateContactRetry != null) {
+ RetrySettings updateContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateContactSettings().getRetrySettings(), updateContactRetry);
+ clientSettingsBuilder.updateContactSettings().setRetrySettings(updateContactRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateContact from properties.");
+ }
+ }
+ Retry listContactsRetry = clientProperties.getListContactsRetry();
+ if (listContactsRetry != null) {
+ RetrySettings listContactsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listContactsSettings().getRetrySettings(), listContactsRetry);
+ clientSettingsBuilder.listContactsSettings().setRetrySettings(listContactsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listContacts from properties.");
+ }
+ }
+ Retry getContactRetry = clientProperties.getGetContactRetry();
+ if (getContactRetry != null) {
+ RetrySettings getContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getContactSettings().getRetrySettings(), getContactRetry);
+ clientSettingsBuilder.getContactSettings().setRetrySettings(getContactRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getContact from properties.");
+ }
+ }
+ Retry deleteContactRetry = clientProperties.getDeleteContactRetry();
+ if (deleteContactRetry != null) {
+ RetrySettings deleteContactRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteContactSettings().getRetrySettings(), deleteContactRetry);
+ clientSettingsBuilder.deleteContactSettings().setRetrySettings(deleteContactRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteContact from properties.");
+ }
+ }
+ Retry computeContactsRetry = clientProperties.getComputeContactsRetry();
+ if (computeContactsRetry != null) {
+ RetrySettings computeContactsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.computeContactsSettings().getRetrySettings(),
+ computeContactsRetry);
+ clientSettingsBuilder
+ .computeContactsSettings()
+ .setRetrySettings(computeContactsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for computeContacts from properties.");
+ }
+ }
+ Retry sendTestMessageRetry = clientProperties.getSendTestMessageRetry();
+ if (sendTestMessageRetry != null) {
+ RetrySettings sendTestMessageRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.sendTestMessageSettings().getRetrySettings(),
+ sendTestMessageRetry);
+ clientSettingsBuilder
+ .sendTestMessageSettings()
+ .setRetrySettings(sendTestMessageRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for sendTestMessage from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a EssentialContactsServiceClient bean configured with
+ * EssentialContactsServiceSettings.
+ *
+ * @param essentialContactsServiceSettings settings to configure an instance of client bean.
+ * @return a {@link EssentialContactsServiceClient} bean configured with {@link
+ * EssentialContactsServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public EssentialContactsServiceClient essentialContactsServiceClient(
+ EssentialContactsServiceSettings essentialContactsServiceSettings) throws IOException {
+ return EssentialContactsServiceClient.create(essentialContactsServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-essential-contacts-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringProperties.java
new file mode 100644
index 0000000000..a56a378906
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/EssentialContactsServiceSpringProperties.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2022 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.essentialcontacts.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 EssentialContactsService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.essentialcontacts.v1.essential-contacts-service")
+public class EssentialContactsServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createContact. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createContactRetry;
+ /**
+ * Allow override of retry settings at method-level for updateContact. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateContactRetry;
+ /**
+ * Allow override of retry settings at method-level for listContacts. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listContactsRetry;
+ /**
+ * Allow override of retry settings at method-level for getContact. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getContactRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteContact. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteContactRetry;
+ /**
+ * Allow override of retry settings at method-level for computeContacts. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry computeContactsRetry;
+ /**
+ * Allow override of retry settings at method-level for sendTestMessage. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry sendTestMessageRetry;
+
+ @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 getCreateContactRetry() {
+ return this.createContactRetry;
+ }
+
+ public void setCreateContactRetry(Retry createContactRetry) {
+ this.createContactRetry = createContactRetry;
+ }
+
+ public Retry getUpdateContactRetry() {
+ return this.updateContactRetry;
+ }
+
+ public void setUpdateContactRetry(Retry updateContactRetry) {
+ this.updateContactRetry = updateContactRetry;
+ }
+
+ public Retry getListContactsRetry() {
+ return this.listContactsRetry;
+ }
+
+ public void setListContactsRetry(Retry listContactsRetry) {
+ this.listContactsRetry = listContactsRetry;
+ }
+
+ public Retry getGetContactRetry() {
+ return this.getContactRetry;
+ }
+
+ public void setGetContactRetry(Retry getContactRetry) {
+ this.getContactRetry = getContactRetry;
+ }
+
+ public Retry getDeleteContactRetry() {
+ return this.deleteContactRetry;
+ }
+
+ public void setDeleteContactRetry(Retry deleteContactRetry) {
+ this.deleteContactRetry = deleteContactRetry;
+ }
+
+ public Retry getComputeContactsRetry() {
+ return this.computeContactsRetry;
+ }
+
+ public void setComputeContactsRetry(Retry computeContactsRetry) {
+ this.computeContactsRetry = computeContactsRetry;
+ }
+
+ public Retry getSendTestMessageRetry() {
+ return this.sendTestMessageRetry;
+ }
+
+ public void setSendTestMessageRetry(Retry sendTestMessageRetry) {
+ this.sendTestMessageRetry = sendTestMessageRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/package-info.java
new file mode 100644
index 0000000000..45907cd5f6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/java/com/google/cloud/essentialcontacts/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for essentialcontacts. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.essentialcontacts.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..5d403bdac2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.essentialcontacts.v1.essential-contacts-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud essentialcontacts/EssentialContactsService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..bc0512ade7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-essential-contacts-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.essentialcontacts.v1.spring.EssentialContactsServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-eventarc-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-eventarc-spring-starter/pom.xml
new file mode 100644
index 0000000000..30663deb54
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in EventarcSpringProperties. 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 EventarcSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public EventarcSettings eventarcSettings(
+ @Qualifier("defaultEventarcTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ EventarcSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = EventarcSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = EventarcSettings.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 =
+ EventarcSettings.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 getTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTriggerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTriggerSettings().setRetrySettings(getTriggerRetrySettings);
+
+ RetrySettings listTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTriggersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTriggersSettings().setRetrySettings(listTriggersRetrySettings);
+
+ RetrySettings getChannelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getChannelSettings().setRetrySettings(getChannelRetrySettings);
+
+ RetrySettings listChannelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listChannelsSettings().setRetrySettings(listChannelsRetrySettings);
+
+ RetrySettings getProviderRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProviderSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getProviderSettings().setRetrySettings(getProviderRetrySettings);
+
+ RetrySettings listProvidersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProvidersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listProvidersSettings().setRetrySettings(listProvidersRetrySettings);
+
+ RetrySettings getChannelConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelConnectionSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getChannelConnectionSettings()
+ .setRetrySettings(getChannelConnectionRetrySettings);
+
+ RetrySettings listChannelConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelConnectionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listChannelConnectionsSettings()
+ .setRetrySettings(listChannelConnectionsRetrySettings);
+
+ RetrySettings getGoogleChannelConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGoogleChannelConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getGoogleChannelConfigSettings()
+ .setRetrySettings(getGoogleChannelConfigRetrySettings);
+
+ RetrySettings updateGoogleChannelConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateGoogleChannelConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateGoogleChannelConfigSettings()
+ .setRetrySettings(updateGoogleChannelConfigRetrySettings);
+
+ 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 getTriggerRetry = clientProperties.getGetTriggerRetry();
+ if (getTriggerRetry != null) {
+ RetrySettings getTriggerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTriggerSettings().getRetrySettings(), getTriggerRetry);
+ clientSettingsBuilder.getTriggerSettings().setRetrySettings(getTriggerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTrigger from properties.");
+ }
+ }
+ Retry listTriggersRetry = clientProperties.getListTriggersRetry();
+ if (listTriggersRetry != null) {
+ RetrySettings listTriggersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTriggersSettings().getRetrySettings(), listTriggersRetry);
+ clientSettingsBuilder.listTriggersSettings().setRetrySettings(listTriggersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTriggers from properties.");
+ }
+ }
+ Retry getChannelRetry = clientProperties.getGetChannelRetry();
+ if (getChannelRetry != null) {
+ RetrySettings getChannelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelSettings().getRetrySettings(), getChannelRetry);
+ clientSettingsBuilder.getChannelSettings().setRetrySettings(getChannelRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getChannel from properties.");
+ }
+ }
+ Retry listChannelsRetry = clientProperties.getListChannelsRetry();
+ if (listChannelsRetry != null) {
+ RetrySettings listChannelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelsSettings().getRetrySettings(), listChannelsRetry);
+ clientSettingsBuilder.listChannelsSettings().setRetrySettings(listChannelsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listChannels from properties.");
+ }
+ }
+ Retry getProviderRetry = clientProperties.getGetProviderRetry();
+ if (getProviderRetry != null) {
+ RetrySettings getProviderRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getProviderSettings().getRetrySettings(), getProviderRetry);
+ clientSettingsBuilder.getProviderSettings().setRetrySettings(getProviderRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getProvider from properties.");
+ }
+ }
+ Retry listProvidersRetry = clientProperties.getListProvidersRetry();
+ if (listProvidersRetry != null) {
+ RetrySettings listProvidersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listProvidersSettings().getRetrySettings(), listProvidersRetry);
+ clientSettingsBuilder.listProvidersSettings().setRetrySettings(listProvidersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listProviders from properties.");
+ }
+ }
+ Retry getChannelConnectionRetry = clientProperties.getGetChannelConnectionRetry();
+ if (getChannelConnectionRetry != null) {
+ RetrySettings getChannelConnectionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getChannelConnectionSettings().getRetrySettings(),
+ getChannelConnectionRetry);
+ clientSettingsBuilder
+ .getChannelConnectionSettings()
+ .setRetrySettings(getChannelConnectionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getChannelConnection from properties.");
+ }
+ }
+ Retry listChannelConnectionsRetry = clientProperties.getListChannelConnectionsRetry();
+ if (listChannelConnectionsRetry != null) {
+ RetrySettings listChannelConnectionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listChannelConnectionsSettings().getRetrySettings(),
+ listChannelConnectionsRetry);
+ clientSettingsBuilder
+ .listChannelConnectionsSettings()
+ .setRetrySettings(listChannelConnectionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listChannelConnections from properties.");
+ }
+ }
+ Retry getGoogleChannelConfigRetry = clientProperties.getGetGoogleChannelConfigRetry();
+ if (getGoogleChannelConfigRetry != null) {
+ RetrySettings getGoogleChannelConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGoogleChannelConfigSettings().getRetrySettings(),
+ getGoogleChannelConfigRetry);
+ clientSettingsBuilder
+ .getGoogleChannelConfigSettings()
+ .setRetrySettings(getGoogleChannelConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getGoogleChannelConfig from properties.");
+ }
+ }
+ Retry updateGoogleChannelConfigRetry = clientProperties.getUpdateGoogleChannelConfigRetry();
+ if (updateGoogleChannelConfigRetry != null) {
+ RetrySettings updateGoogleChannelConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateGoogleChannelConfigSettings().getRetrySettings(),
+ updateGoogleChannelConfigRetry);
+ clientSettingsBuilder
+ .updateGoogleChannelConfigSettings()
+ .setRetrySettings(updateGoogleChannelConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateGoogleChannelConfig 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 EventarcClient bean configured with EventarcSettings.
+ *
+ * @param eventarcSettings settings to configure an instance of client bean.
+ * @return a {@link EventarcClient} bean configured with {@link EventarcSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public EventarcClient eventarcClient(EventarcSettings eventarcSettings) throws IOException {
+ return EventarcClient.create(eventarcSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-eventarc";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringProperties.java b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringProperties.java
new file mode 100644
index 0000000000..94787f0a51
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/EventarcSpringProperties.java
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2022 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.eventarc.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 Eventarc client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.eventarc.v1.eventarc")
+public class EventarcSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getTrigger. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTriggerRetry;
+ /**
+ * Allow override of retry settings at method-level for listTriggers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTriggersRetry;
+ /**
+ * Allow override of retry settings at method-level for getChannel. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getChannelRetry;
+ /**
+ * Allow override of retry settings at method-level for listChannels. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listChannelsRetry;
+ /**
+ * Allow override of retry settings at method-level for getProvider. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getProviderRetry;
+ /**
+ * Allow override of retry settings at method-level for listProviders. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listProvidersRetry;
+ /**
+ * Allow override of retry settings at method-level for getChannelConnection. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getChannelConnectionRetry;
+ /**
+ * Allow override of retry settings at method-level for listChannelConnections. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listChannelConnectionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getGoogleChannelConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGoogleChannelConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateGoogleChannelConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateGoogleChannelConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getGetTriggerRetry() {
+ return this.getTriggerRetry;
+ }
+
+ public void setGetTriggerRetry(Retry getTriggerRetry) {
+ this.getTriggerRetry = getTriggerRetry;
+ }
+
+ public Retry getListTriggersRetry() {
+ return this.listTriggersRetry;
+ }
+
+ public void setListTriggersRetry(Retry listTriggersRetry) {
+ this.listTriggersRetry = listTriggersRetry;
+ }
+
+ public Retry getGetChannelRetry() {
+ return this.getChannelRetry;
+ }
+
+ public void setGetChannelRetry(Retry getChannelRetry) {
+ this.getChannelRetry = getChannelRetry;
+ }
+
+ public Retry getListChannelsRetry() {
+ return this.listChannelsRetry;
+ }
+
+ public void setListChannelsRetry(Retry listChannelsRetry) {
+ this.listChannelsRetry = listChannelsRetry;
+ }
+
+ public Retry getGetProviderRetry() {
+ return this.getProviderRetry;
+ }
+
+ public void setGetProviderRetry(Retry getProviderRetry) {
+ this.getProviderRetry = getProviderRetry;
+ }
+
+ public Retry getListProvidersRetry() {
+ return this.listProvidersRetry;
+ }
+
+ public void setListProvidersRetry(Retry listProvidersRetry) {
+ this.listProvidersRetry = listProvidersRetry;
+ }
+
+ public Retry getGetChannelConnectionRetry() {
+ return this.getChannelConnectionRetry;
+ }
+
+ public void setGetChannelConnectionRetry(Retry getChannelConnectionRetry) {
+ this.getChannelConnectionRetry = getChannelConnectionRetry;
+ }
+
+ public Retry getListChannelConnectionsRetry() {
+ return this.listChannelConnectionsRetry;
+ }
+
+ public void setListChannelConnectionsRetry(Retry listChannelConnectionsRetry) {
+ this.listChannelConnectionsRetry = listChannelConnectionsRetry;
+ }
+
+ public Retry getGetGoogleChannelConfigRetry() {
+ return this.getGoogleChannelConfigRetry;
+ }
+
+ public void setGetGoogleChannelConfigRetry(Retry getGoogleChannelConfigRetry) {
+ this.getGoogleChannelConfigRetry = getGoogleChannelConfigRetry;
+ }
+
+ public Retry getUpdateGoogleChannelConfigRetry() {
+ return this.updateGoogleChannelConfigRetry;
+ }
+
+ public void setUpdateGoogleChannelConfigRetry(Retry updateGoogleChannelConfigRetry) {
+ this.updateGoogleChannelConfigRetry = updateGoogleChannelConfigRetry;
+ }
+
+ 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-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/package-info.java
new file mode 100644
index 0000000000..f3150758e1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/java/com/google/cloud/eventarc/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for eventarc. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.eventarc.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..07d5b4a248
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.eventarc.v1.eventarc.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud eventarc/Eventarc components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1adb0355f4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-eventarc-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.eventarc.v1.spring.EventarcSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-filestore-spring-starter/pom.xml
new file mode 100644
index 0000000000..d1553575a6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudFilestoreManagerSpringProperties. 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 CloudFilestoreManagerSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudFilestoreManagerSettings cloudFilestoreManagerSettings(
+ @Qualifier("defaultCloudFilestoreManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudFilestoreManagerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudFilestoreManagerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudFilestoreManagerSettings.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 =
+ CloudFilestoreManagerSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+
+ RetrySettings listBackupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBackupsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listBackupsSettings().setRetrySettings(listBackupsRetrySettings);
+
+ RetrySettings getBackupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBackupSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getBackupSettings().setRetrySettings(getBackupRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listInstancesRetry = clientProperties.getListInstancesRetry();
+ if (listInstancesRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInstances from properties.");
+ }
+ }
+ Retry getInstanceRetry = clientProperties.getGetInstanceRetry();
+ if (getInstanceRetry != null) {
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInstance from properties.");
+ }
+ }
+ Retry listBackupsRetry = clientProperties.getListBackupsRetry();
+ if (listBackupsRetry != null) {
+ RetrySettings listBackupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBackupsSettings().getRetrySettings(), listBackupsRetry);
+ clientSettingsBuilder.listBackupsSettings().setRetrySettings(listBackupsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listBackups from properties.");
+ }
+ }
+ Retry getBackupRetry = clientProperties.getGetBackupRetry();
+ if (getBackupRetry != null) {
+ RetrySettings getBackupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBackupSettings().getRetrySettings(), getBackupRetry);
+ clientSettingsBuilder.getBackupSettings().setRetrySettings(getBackupRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getBackup from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudFilestoreManagerClient bean configured with CloudFilestoreManagerSettings.
+ *
+ * @param cloudFilestoreManagerSettings settings to configure an instance of client bean.
+ * @return a {@link CloudFilestoreManagerClient} bean configured with {@link
+ * CloudFilestoreManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudFilestoreManagerClient cloudFilestoreManagerClient(
+ CloudFilestoreManagerSettings cloudFilestoreManagerSettings) throws IOException {
+ return CloudFilestoreManagerClient.create(cloudFilestoreManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-filestore-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringProperties.java b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringProperties.java
new file mode 100644
index 0000000000..7695a21203
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/CloudFilestoreManagerSpringProperties.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 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.filestore.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 CloudFilestoreManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.filestore.v1.cloud-filestore-manager")
+public class CloudFilestoreManagerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listInstances. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInstancesRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstance. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceRetry;
+ /**
+ * Allow override of retry settings at method-level for listBackups. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBackupsRetry;
+ /**
+ * Allow override of retry settings at method-level for getBackup. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBackupRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListInstancesRetry() {
+ return this.listInstancesRetry;
+ }
+
+ public void setListInstancesRetry(Retry listInstancesRetry) {
+ this.listInstancesRetry = listInstancesRetry;
+ }
+
+ public Retry getGetInstanceRetry() {
+ return this.getInstanceRetry;
+ }
+
+ public void setGetInstanceRetry(Retry getInstanceRetry) {
+ this.getInstanceRetry = getInstanceRetry;
+ }
+
+ public Retry getListBackupsRetry() {
+ return this.listBackupsRetry;
+ }
+
+ public void setListBackupsRetry(Retry listBackupsRetry) {
+ this.listBackupsRetry = listBackupsRetry;
+ }
+
+ public Retry getGetBackupRetry() {
+ return this.getBackupRetry;
+ }
+
+ public void setGetBackupRetry(Retry getBackupRetry) {
+ this.getBackupRetry = getBackupRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/package-info.java
new file mode 100644
index 0000000000..02ed3ea8bc
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/java/com/google/cloud/filestore/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for file. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.filestore.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..8282d96d1f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.filestore.v1.cloud-filestore-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud file/CloudFilestoreManager components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..438623fe5f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-filestore-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.filestore.v1.spring.CloudFilestoreManagerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-functions-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-functions-spring-starter/pom.xml
new file mode 100644
index 0000000000..67e2cb85e5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-functions-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in FunctionServiceSpringProperties. 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 FunctionServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public FunctionServiceSettings functionServiceSettings(
+ @Qualifier("defaultFunctionServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ FunctionServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = FunctionServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = FunctionServiceSettings.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 =
+ FunctionServiceSettings.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 getFunctionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFunctionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getFunctionSettings().setRetrySettings(getFunctionRetrySettings);
+
+ RetrySettings listFunctionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFunctionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFunctionsSettings().setRetrySettings(listFunctionsRetrySettings);
+
+ RetrySettings generateUploadUrlRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateUploadUrlSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .generateUploadUrlSettings()
+ .setRetrySettings(generateUploadUrlRetrySettings);
+
+ RetrySettings generateDownloadUrlRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateDownloadUrlSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .generateDownloadUrlSettings()
+ .setRetrySettings(generateDownloadUrlRetrySettings);
+
+ RetrySettings listRuntimesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRuntimesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listRuntimesSettings().setRetrySettings(listRuntimesRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ 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 getFunctionRetry = clientProperties.getGetFunctionRetry();
+ if (getFunctionRetry != null) {
+ RetrySettings getFunctionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFunctionSettings().getRetrySettings(), getFunctionRetry);
+ clientSettingsBuilder.getFunctionSettings().setRetrySettings(getFunctionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getFunction from properties.");
+ }
+ }
+ Retry listFunctionsRetry = clientProperties.getListFunctionsRetry();
+ if (listFunctionsRetry != null) {
+ RetrySettings listFunctionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFunctionsSettings().getRetrySettings(), listFunctionsRetry);
+ clientSettingsBuilder.listFunctionsSettings().setRetrySettings(listFunctionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFunctions from properties.");
+ }
+ }
+ Retry generateUploadUrlRetry = clientProperties.getGenerateUploadUrlRetry();
+ if (generateUploadUrlRetry != null) {
+ RetrySettings generateUploadUrlRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateUploadUrlSettings().getRetrySettings(),
+ generateUploadUrlRetry);
+ clientSettingsBuilder
+ .generateUploadUrlSettings()
+ .setRetrySettings(generateUploadUrlRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateUploadUrl from properties.");
+ }
+ }
+ Retry generateDownloadUrlRetry = clientProperties.getGenerateDownloadUrlRetry();
+ if (generateDownloadUrlRetry != null) {
+ RetrySettings generateDownloadUrlRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateDownloadUrlSettings().getRetrySettings(),
+ generateDownloadUrlRetry);
+ clientSettingsBuilder
+ .generateDownloadUrlSettings()
+ .setRetrySettings(generateDownloadUrlRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateDownloadUrl from properties.");
+ }
+ }
+ Retry listRuntimesRetry = clientProperties.getListRuntimesRetry();
+ if (listRuntimesRetry != null) {
+ RetrySettings listRuntimesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRuntimesSettings().getRetrySettings(), listRuntimesRetry);
+ clientSettingsBuilder.listRuntimesSettings().setRetrySettings(listRuntimesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRuntimes 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 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 FunctionServiceClient bean configured with FunctionServiceSettings.
+ *
+ * @param functionServiceSettings settings to configure an instance of client bean.
+ * @return a {@link FunctionServiceClient} bean configured with {@link FunctionServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public FunctionServiceClient functionServiceClient(
+ FunctionServiceSettings functionServiceSettings) throws IOException {
+ return FunctionServiceClient.create(functionServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-function-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringProperties.java
new file mode 100644
index 0000000000..729911eea3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/FunctionServiceSpringProperties.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2022 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.functions.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 FunctionService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.functions.v2.function-service")
+public class FunctionServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getFunction. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getFunctionRetry;
+ /**
+ * Allow override of retry settings at method-level for listFunctions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFunctionsRetry;
+ /**
+ * Allow override of retry settings at method-level for generateUploadUrl. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateUploadUrlRetry;
+ /**
+ * Allow override of retry settings at method-level for generateDownloadUrl. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateDownloadUrlRetry;
+ /**
+ * Allow override of retry settings at method-level for listRuntimes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRuntimesRetry;
+ /**
+ * 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 setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getGetFunctionRetry() {
+ return this.getFunctionRetry;
+ }
+
+ public void setGetFunctionRetry(Retry getFunctionRetry) {
+ this.getFunctionRetry = getFunctionRetry;
+ }
+
+ public Retry getListFunctionsRetry() {
+ return this.listFunctionsRetry;
+ }
+
+ public void setListFunctionsRetry(Retry listFunctionsRetry) {
+ this.listFunctionsRetry = listFunctionsRetry;
+ }
+
+ public Retry getGenerateUploadUrlRetry() {
+ return this.generateUploadUrlRetry;
+ }
+
+ public void setGenerateUploadUrlRetry(Retry generateUploadUrlRetry) {
+ this.generateUploadUrlRetry = generateUploadUrlRetry;
+ }
+
+ public Retry getGenerateDownloadUrlRetry() {
+ return this.generateDownloadUrlRetry;
+ }
+
+ public void setGenerateDownloadUrlRetry(Retry generateDownloadUrlRetry) {
+ this.generateDownloadUrlRetry = generateDownloadUrlRetry;
+ }
+
+ public Retry getListRuntimesRetry() {
+ return this.listRuntimesRetry;
+ }
+
+ public void setListRuntimesRetry(Retry listRuntimesRetry) {
+ this.listRuntimesRetry = listRuntimesRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ 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-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/package-info.java
new file mode 100644
index 0000000000..88609c6c95
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/java/com/google/cloud/functions/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudfunctions. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.functions.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..68ba8b249d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.functions.v2.function-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudfunctions/FunctionService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..13d5324b03
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-functions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.functions.v2.spring.FunctionServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-game-servers-spring-starter/pom.xml
new file mode 100644
index 0000000000..1546fdae13
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in GameServerClustersServiceSpringProperties. 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 GameServerClustersServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GameServerClustersServiceSettings gameServerClustersServiceSettings( + @Qualifier("defaultGameServerClustersServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GameServerClustersServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = GameServerClustersServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = GameServerClustersServiceSettings.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 = + GameServerClustersServiceSettings.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 listGameServerClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerClustersSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listGameServerClustersSettings() + .setRetrySettings(listGameServerClustersRetrySettings); + + RetrySettings getGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getGameServerClusterSettings() + .setRetrySettings(getGameServerClusterRetrySettings); + + RetrySettings previewCreateGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewCreateGameServerClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .previewCreateGameServerClusterSettings() + .setRetrySettings(previewCreateGameServerClusterRetrySettings); + + RetrySettings previewDeleteGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewDeleteGameServerClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .previewDeleteGameServerClusterSettings() + .setRetrySettings(previewDeleteGameServerClusterRetrySettings); + + RetrySettings previewUpdateGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewUpdateGameServerClusterSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .previewUpdateGameServerClusterSettings() + .setRetrySettings(previewUpdateGameServerClusterRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listGameServerClustersRetry = clientProperties.getListGameServerClustersRetry(); + if (listGameServerClustersRetry != null) { + RetrySettings listGameServerClustersRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerClustersSettings().getRetrySettings(), + listGameServerClustersRetry); + clientSettingsBuilder + .listGameServerClustersSettings() + .setRetrySettings(listGameServerClustersRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listGameServerClusters from properties."); + } + } + Retry getGameServerClusterRetry = clientProperties.getGetGameServerClusterRetry(); + if (getGameServerClusterRetry != null) { + RetrySettings getGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerClusterSettings().getRetrySettings(), + getGameServerClusterRetry); + clientSettingsBuilder + .getGameServerClusterSettings() + .setRetrySettings(getGameServerClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getGameServerCluster from properties."); + } + } + Retry previewCreateGameServerClusterRetry = + clientProperties.getPreviewCreateGameServerClusterRetry(); + if (previewCreateGameServerClusterRetry != null) { + RetrySettings previewCreateGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewCreateGameServerClusterSettings().getRetrySettings(), + previewCreateGameServerClusterRetry); + clientSettingsBuilder + .previewCreateGameServerClusterSettings() + .setRetrySettings(previewCreateGameServerClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for previewCreateGameServerCluster from properties."); + } + } + Retry previewDeleteGameServerClusterRetry = + clientProperties.getPreviewDeleteGameServerClusterRetry(); + if (previewDeleteGameServerClusterRetry != null) { + RetrySettings previewDeleteGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewDeleteGameServerClusterSettings().getRetrySettings(), + previewDeleteGameServerClusterRetry); + clientSettingsBuilder + .previewDeleteGameServerClusterSettings() + .setRetrySettings(previewDeleteGameServerClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for previewDeleteGameServerCluster from properties."); + } + } + Retry previewUpdateGameServerClusterRetry = + clientProperties.getPreviewUpdateGameServerClusterRetry(); + if (previewUpdateGameServerClusterRetry != null) { + RetrySettings previewUpdateGameServerClusterRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewUpdateGameServerClusterSettings().getRetrySettings(), + previewUpdateGameServerClusterRetry); + clientSettingsBuilder + .previewUpdateGameServerClusterSettings() + .setRetrySettings(previewUpdateGameServerClusterRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for previewUpdateGameServerCluster from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GameServerClustersServiceClient bean configured with + * GameServerClustersServiceSettings. + * + * @param gameServerClustersServiceSettings settings to configure an instance of client bean. + * @return a {@link GameServerClustersServiceClient} bean configured with {@link + * GameServerClustersServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GameServerClustersServiceClient gameServerClustersServiceClient( + GameServerClustersServiceSettings gameServerClustersServiceSettings) throws IOException { + return GameServerClustersServiceClient.create(gameServerClustersServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-game-server-clusters-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerClustersServiceSpringProperties.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerClustersServiceSpringProperties.java new file mode 100644 index 0000000000..5392d55859 --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerClustersServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * Copyright 2022 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.gaming.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 GameServerClustersService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.gaming.v1.game-server-clusters-service") +public class GameServerClustersServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listGameServerClusters. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listGameServerClustersRetry; + /** + * Allow override of retry settings at method-level for getGameServerCluster. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getGameServerClusterRetry; + /** + * Allow override of retry settings at method-level for previewCreateGameServerCluster. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry previewCreateGameServerClusterRetry; + /** + * Allow override of retry settings at method-level for previewDeleteGameServerCluster. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry previewDeleteGameServerClusterRetry; + /** + * Allow override of retry settings at method-level for previewUpdateGameServerCluster. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry previewUpdateGameServerClusterRetry; + + @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 getListGameServerClustersRetry() { + return this.listGameServerClustersRetry; + } + + public void setListGameServerClustersRetry(Retry listGameServerClustersRetry) { + this.listGameServerClustersRetry = listGameServerClustersRetry; + } + + public Retry getGetGameServerClusterRetry() { + return this.getGameServerClusterRetry; + } + + public void setGetGameServerClusterRetry(Retry getGameServerClusterRetry) { + this.getGameServerClusterRetry = getGameServerClusterRetry; + } + + public Retry getPreviewCreateGameServerClusterRetry() { + return this.previewCreateGameServerClusterRetry; + } + + public void setPreviewCreateGameServerClusterRetry(Retry previewCreateGameServerClusterRetry) { + this.previewCreateGameServerClusterRetry = previewCreateGameServerClusterRetry; + } + + public Retry getPreviewDeleteGameServerClusterRetry() { + return this.previewDeleteGameServerClusterRetry; + } + + public void setPreviewDeleteGameServerClusterRetry(Retry previewDeleteGameServerClusterRetry) { + this.previewDeleteGameServerClusterRetry = previewDeleteGameServerClusterRetry; + } + + public Retry getPreviewUpdateGameServerClusterRetry() { + return this.previewUpdateGameServerClusterRetry; + } + + public void setPreviewUpdateGameServerClusterRetry(Retry previewUpdateGameServerClusterRetry) { + this.previewUpdateGameServerClusterRetry = previewUpdateGameServerClusterRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..72cdfae969 --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringAutoConfiguration.java @@ -0,0 +1,233 @@ +/* + * Copyright 2022 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.gaming.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.gaming.v1.GameServerConfigsServiceClient; +import com.google.cloud.gaming.v1.GameServerConfigsServiceSettings; +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 GameServerConfigsServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in GameServerConfigsServiceSpringProperties. 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 GameServerConfigsServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GameServerConfigsServiceSettings gameServerConfigsServiceSettings( + @Qualifier("defaultGameServerConfigsServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GameServerConfigsServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = GameServerConfigsServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = GameServerConfigsServiceSettings.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 = + GameServerConfigsServiceSettings.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 listGameServerConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerConfigsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listGameServerConfigsSettings() + .setRetrySettings(listGameServerConfigsRetrySettings); + + RetrySettings getGameServerConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getGameServerConfigSettings() + .setRetrySettings(getGameServerConfigRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listGameServerConfigsRetry = clientProperties.getListGameServerConfigsRetry(); + if (listGameServerConfigsRetry != null) { + RetrySettings listGameServerConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerConfigsSettings().getRetrySettings(), + listGameServerConfigsRetry); + clientSettingsBuilder + .listGameServerConfigsSettings() + .setRetrySettings(listGameServerConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listGameServerConfigs from properties."); + } + } + Retry getGameServerConfigRetry = clientProperties.getGetGameServerConfigRetry(); + if (getGameServerConfigRetry != null) { + RetrySettings getGameServerConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerConfigSettings().getRetrySettings(), + getGameServerConfigRetry); + clientSettingsBuilder + .getGameServerConfigSettings() + .setRetrySettings(getGameServerConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getGameServerConfig from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GameServerConfigsServiceClient bean configured with + * GameServerConfigsServiceSettings. + * + * @param gameServerConfigsServiceSettings settings to configure an instance of client bean. + * @return a {@link GameServerConfigsServiceClient} bean configured with {@link + * GameServerConfigsServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GameServerConfigsServiceClient gameServerConfigsServiceClient( + GameServerConfigsServiceSettings gameServerConfigsServiceSettings) throws IOException { + return GameServerConfigsServiceClient.create(gameServerConfigsServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-game-server-configs-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringProperties.java new file mode 100644 index 0000000000..2bbdd12f0d --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerConfigsServiceSpringProperties.java @@ -0,0 +1,108 @@ +/* + * Copyright 2022 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.gaming.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 GameServerConfigsService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.gaming.v1.game-server-configs-service") +public class GameServerConfigsServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listGameServerConfigs. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listGameServerConfigsRetry; + /** + * Allow override of retry settings at method-level for getGameServerConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getGameServerConfigRetry; + + @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 getListGameServerConfigsRetry() { + return this.listGameServerConfigsRetry; + } + + public void setListGameServerConfigsRetry(Retry listGameServerConfigsRetry) { + this.listGameServerConfigsRetry = listGameServerConfigsRetry; + } + + public Retry getGetGameServerConfigRetry() { + return this.getGameServerConfigRetry; + } + + public void setGetGameServerConfigRetry(Retry getGameServerConfigRetry) { + this.getGameServerConfigRetry = getGameServerConfigRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..b66cc80bf8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringAutoConfiguration.java @@ -0,0 +1,303 @@ +/* + * Copyright 2022 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.gaming.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.gaming.v1.GameServerDeploymentsServiceClient; +import com.google.cloud.gaming.v1.GameServerDeploymentsServiceSettings; +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 GameServerDeploymentsServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in GameServerDeploymentsServiceSpringProperties. 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 GameServerDeploymentsServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GameServerDeploymentsServiceSettings gameServerDeploymentsServiceSettings( + @Qualifier("defaultGameServerDeploymentsServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GameServerDeploymentsServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = GameServerDeploymentsServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = GameServerDeploymentsServiceSettings.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 = + GameServerDeploymentsServiceSettings.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 listGameServerDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerDeploymentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listGameServerDeploymentsSettings() + .setRetrySettings(listGameServerDeploymentsRetrySettings); + + RetrySettings getGameServerDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getGameServerDeploymentSettings() + .setRetrySettings(getGameServerDeploymentRetrySettings); + + RetrySettings getGameServerDeploymentRolloutRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerDeploymentRolloutSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getGameServerDeploymentRolloutSettings() + .setRetrySettings(getGameServerDeploymentRolloutRetrySettings); + + RetrySettings previewGameServerDeploymentRolloutRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewGameServerDeploymentRolloutSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .previewGameServerDeploymentRolloutSettings() + .setRetrySettings(previewGameServerDeploymentRolloutRetrySettings); + + RetrySettings fetchDeploymentStateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchDeploymentStateSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .fetchDeploymentStateSettings() + .setRetrySettings(fetchDeploymentStateRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listGameServerDeploymentsRetry = clientProperties.getListGameServerDeploymentsRetry(); + if (listGameServerDeploymentsRetry != null) { + RetrySettings listGameServerDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGameServerDeploymentsSettings().getRetrySettings(), + listGameServerDeploymentsRetry); + clientSettingsBuilder + .listGameServerDeploymentsSettings() + .setRetrySettings(listGameServerDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listGameServerDeployments from properties."); + } + } + Retry getGameServerDeploymentRetry = clientProperties.getGetGameServerDeploymentRetry(); + if (getGameServerDeploymentRetry != null) { + RetrySettings getGameServerDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerDeploymentSettings().getRetrySettings(), + getGameServerDeploymentRetry); + clientSettingsBuilder + .getGameServerDeploymentSettings() + .setRetrySettings(getGameServerDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getGameServerDeployment from properties."); + } + } + Retry getGameServerDeploymentRolloutRetry = + clientProperties.getGetGameServerDeploymentRolloutRetry(); + if (getGameServerDeploymentRolloutRetry != null) { + RetrySettings getGameServerDeploymentRolloutRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getGameServerDeploymentRolloutSettings().getRetrySettings(), + getGameServerDeploymentRolloutRetry); + clientSettingsBuilder + .getGameServerDeploymentRolloutSettings() + .setRetrySettings(getGameServerDeploymentRolloutRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getGameServerDeploymentRollout from properties."); + } + } + Retry previewGameServerDeploymentRolloutRetry = + clientProperties.getPreviewGameServerDeploymentRolloutRetry(); + if (previewGameServerDeploymentRolloutRetry != null) { + RetrySettings previewGameServerDeploymentRolloutRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.previewGameServerDeploymentRolloutSettings().getRetrySettings(), + previewGameServerDeploymentRolloutRetry); + clientSettingsBuilder + .previewGameServerDeploymentRolloutSettings() + .setRetrySettings(previewGameServerDeploymentRolloutRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for previewGameServerDeploymentRollout from properties."); + } + } + Retry fetchDeploymentStateRetry = clientProperties.getFetchDeploymentStateRetry(); + if (fetchDeploymentStateRetry != null) { + RetrySettings fetchDeploymentStateRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.fetchDeploymentStateSettings().getRetrySettings(), + fetchDeploymentStateRetry); + clientSettingsBuilder + .fetchDeploymentStateSettings() + .setRetrySettings(fetchDeploymentStateRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for fetchDeploymentState from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GameServerDeploymentsServiceClient bean configured with + * GameServerDeploymentsServiceSettings. + * + * @param gameServerDeploymentsServiceSettings settings to configure an instance of client bean. + * @return a {@link GameServerDeploymentsServiceClient} bean configured with {@link + * GameServerDeploymentsServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GameServerDeploymentsServiceClient gameServerDeploymentsServiceClient( + GameServerDeploymentsServiceSettings gameServerDeploymentsServiceSettings) + throws IOException { + return GameServerDeploymentsServiceClient.create(gameServerDeploymentsServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-game-server-deployments-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringProperties.java new file mode 100644 index 0000000000..3951031dc6 --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/GameServerDeploymentsServiceSpringProperties.java @@ -0,0 +1,148 @@ +/* + * Copyright 2022 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.gaming.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 GameServerDeploymentsService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.gaming.v1.game-server-deployments-service") +public class GameServerDeploymentsServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listGameServerDeployments. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listGameServerDeploymentsRetry; + /** + * Allow override of retry settings at method-level for getGameServerDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getGameServerDeploymentRetry; + /** + * Allow override of retry settings at method-level for getGameServerDeploymentRollout. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getGameServerDeploymentRolloutRetry; + /** + * Allow override of retry settings at method-level for previewGameServerDeploymentRollout. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry previewGameServerDeploymentRolloutRetry; + /** + * Allow override of retry settings at method-level for fetchDeploymentState. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry fetchDeploymentStateRetry; + + @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 getListGameServerDeploymentsRetry() { + return this.listGameServerDeploymentsRetry; + } + + public void setListGameServerDeploymentsRetry(Retry listGameServerDeploymentsRetry) { + this.listGameServerDeploymentsRetry = listGameServerDeploymentsRetry; + } + + public Retry getGetGameServerDeploymentRetry() { + return this.getGameServerDeploymentRetry; + } + + public void setGetGameServerDeploymentRetry(Retry getGameServerDeploymentRetry) { + this.getGameServerDeploymentRetry = getGameServerDeploymentRetry; + } + + public Retry getGetGameServerDeploymentRolloutRetry() { + return this.getGameServerDeploymentRolloutRetry; + } + + public void setGetGameServerDeploymentRolloutRetry(Retry getGameServerDeploymentRolloutRetry) { + this.getGameServerDeploymentRolloutRetry = getGameServerDeploymentRolloutRetry; + } + + public Retry getPreviewGameServerDeploymentRolloutRetry() { + return this.previewGameServerDeploymentRolloutRetry; + } + + public void setPreviewGameServerDeploymentRolloutRetry( + Retry previewGameServerDeploymentRolloutRetry) { + this.previewGameServerDeploymentRolloutRetry = previewGameServerDeploymentRolloutRetry; + } + + public Retry getFetchDeploymentStateRetry() { + return this.fetchDeploymentStateRetry; + } + + public void setFetchDeploymentStateRetry(Retry fetchDeploymentStateRetry) { + this.fetchDeploymentStateRetry = fetchDeploymentStateRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..de7dac8cc7 --- /dev/null +++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringAutoConfiguration.java @@ -0,0 +1,237 @@ +/* + * Copyright 2022 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.gaming.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.gaming.v1.RealmsServiceClient; +import com.google.cloud.gaming.v1.RealmsServiceSettings; +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 RealmsServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in RealmsServiceSpringProperties. 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 RealmsServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RealmsServiceSettings realmsServiceSettings(
+ @Qualifier("defaultRealmsServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ RealmsServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = RealmsServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = RealmsServiceSettings.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 =
+ RealmsServiceSettings.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 listRealmsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRealmsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listRealmsSettings().setRetrySettings(listRealmsRetrySettings);
+
+ RetrySettings getRealmRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRealmSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRealmSettings().setRetrySettings(getRealmRetrySettings);
+
+ RetrySettings previewRealmUpdateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.previewRealmUpdateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .previewRealmUpdateSettings()
+ .setRetrySettings(previewRealmUpdateRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listRealmsRetry = clientProperties.getListRealmsRetry();
+ if (listRealmsRetry != null) {
+ RetrySettings listRealmsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRealmsSettings().getRetrySettings(), listRealmsRetry);
+ clientSettingsBuilder.listRealmsSettings().setRetrySettings(listRealmsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRealms from properties.");
+ }
+ }
+ Retry getRealmRetry = clientProperties.getGetRealmRetry();
+ if (getRealmRetry != null) {
+ RetrySettings getRealmRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRealmSettings().getRetrySettings(), getRealmRetry);
+ clientSettingsBuilder.getRealmSettings().setRetrySettings(getRealmRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRealm from properties.");
+ }
+ }
+ Retry previewRealmUpdateRetry = clientProperties.getPreviewRealmUpdateRetry();
+ if (previewRealmUpdateRetry != null) {
+ RetrySettings previewRealmUpdateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.previewRealmUpdateSettings().getRetrySettings(),
+ previewRealmUpdateRetry);
+ clientSettingsBuilder
+ .previewRealmUpdateSettings()
+ .setRetrySettings(previewRealmUpdateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for previewRealmUpdate from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a RealmsServiceClient bean configured with RealmsServiceSettings.
+ *
+ * @param realmsServiceSettings settings to configure an instance of client bean.
+ * @return a {@link RealmsServiceClient} bean configured with {@link RealmsServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RealmsServiceClient realmsServiceClient(RealmsServiceSettings realmsServiceSettings)
+ throws IOException {
+ return RealmsServiceClient.create(realmsServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-realms-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringProperties.java
new file mode 100644
index 0000000000..ac1ae5a3e5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/RealmsServiceSpringProperties.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2022 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.gaming.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 RealmsService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.gaming.v1.realms-service")
+public class RealmsServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listRealms. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRealmsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRealm. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRealmRetry;
+ /**
+ * Allow override of retry settings at method-level for previewRealmUpdate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry previewRealmUpdateRetry;
+
+ @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 getListRealmsRetry() {
+ return this.listRealmsRetry;
+ }
+
+ public void setListRealmsRetry(Retry listRealmsRetry) {
+ this.listRealmsRetry = listRealmsRetry;
+ }
+
+ public Retry getGetRealmRetry() {
+ return this.getRealmRetry;
+ }
+
+ public void setGetRealmRetry(Retry getRealmRetry) {
+ this.getRealmRetry = getRealmRetry;
+ }
+
+ public Retry getPreviewRealmUpdateRetry() {
+ return this.previewRealmUpdateRetry;
+ }
+
+ public void setPreviewRealmUpdateRetry(Retry previewRealmUpdateRetry) {
+ this.previewRealmUpdateRetry = previewRealmUpdateRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/package-info.java
new file mode 100644
index 0000000000..5240e35245
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/java/com/google/cloud/gaming/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for gameservices. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.gaming.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..7f8e3e874a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,28 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.gaming.v1.game-server-clusters-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gameservices/GameServerClustersService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.gaming.v1.game-server-configs-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gameservices/GameServerConfigsService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.gaming.v1.game-server-deployments-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gameservices/GameServerDeploymentsService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.gaming.v1.realms-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gameservices/RealmsService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..f3b9209320
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-game-servers-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,4 @@
+com.google.cloud.gaming.v1.spring.GameServerClustersServiceSpringAutoConfiguration
+com.google.cloud.gaming.v1.spring.GameServerConfigsServiceSpringAutoConfiguration
+com.google.cloud.gaming.v1.spring.GameServerDeploymentsServiceSpringAutoConfiguration
+com.google.cloud.gaming.v1.spring.RealmsServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-gkehub-spring-starter/pom.xml
new file mode 100644
index 0000000000..8f4b5872ef
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in GkeHubSpringProperties. 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 GkeHubSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public GkeHubSettings gkeHubSettings(
+ @Qualifier("defaultGkeHubTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ GkeHubSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = GkeHubSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = GkeHubSettings.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 =
+ GkeHubSettings.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 listMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMembershipsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listMembershipsSettings()
+ .setRetrySettings(listMembershipsRetrySettings);
+
+ RetrySettings listFeaturesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFeaturesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFeaturesSettings().setRetrySettings(listFeaturesRetrySettings);
+
+ RetrySettings getMembershipRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMembershipSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getMembershipSettings().setRetrySettings(getMembershipRetrySettings);
+
+ RetrySettings getFeatureRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFeatureSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getFeatureSettings().setRetrySettings(getFeatureRetrySettings);
+
+ RetrySettings generateConnectManifestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateConnectManifestSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .generateConnectManifestSettings()
+ .setRetrySettings(generateConnectManifestRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listMembershipsRetry = clientProperties.getListMembershipsRetry();
+ if (listMembershipsRetry != null) {
+ RetrySettings listMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMembershipsSettings().getRetrySettings(),
+ listMembershipsRetry);
+ clientSettingsBuilder
+ .listMembershipsSettings()
+ .setRetrySettings(listMembershipsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listMemberships from properties.");
+ }
+ }
+ Retry listFeaturesRetry = clientProperties.getListFeaturesRetry();
+ if (listFeaturesRetry != null) {
+ RetrySettings listFeaturesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFeaturesSettings().getRetrySettings(), listFeaturesRetry);
+ clientSettingsBuilder.listFeaturesSettings().setRetrySettings(listFeaturesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFeatures from properties.");
+ }
+ }
+ Retry getMembershipRetry = clientProperties.getGetMembershipRetry();
+ if (getMembershipRetry != null) {
+ RetrySettings getMembershipRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMembershipSettings().getRetrySettings(), getMembershipRetry);
+ clientSettingsBuilder.getMembershipSettings().setRetrySettings(getMembershipRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getMembership from properties.");
+ }
+ }
+ Retry getFeatureRetry = clientProperties.getGetFeatureRetry();
+ if (getFeatureRetry != null) {
+ RetrySettings getFeatureRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFeatureSettings().getRetrySettings(), getFeatureRetry);
+ clientSettingsBuilder.getFeatureSettings().setRetrySettings(getFeatureRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getFeature from properties.");
+ }
+ }
+ Retry generateConnectManifestRetry = clientProperties.getGenerateConnectManifestRetry();
+ if (generateConnectManifestRetry != null) {
+ RetrySettings generateConnectManifestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateConnectManifestSettings().getRetrySettings(),
+ generateConnectManifestRetry);
+ clientSettingsBuilder
+ .generateConnectManifestSettings()
+ .setRetrySettings(generateConnectManifestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateConnectManifest from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a GkeHubClient bean configured with GkeHubSettings.
+ *
+ * @param gkeHubSettings settings to configure an instance of client bean.
+ * @return a {@link GkeHubClient} bean configured with {@link GkeHubSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public GkeHubClient gkeHubClient(GkeHubSettings gkeHubSettings) throws IOException {
+ return GkeHubClient.create(gkeHubSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-gke-hub";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringProperties.java b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringProperties.java
new file mode 100644
index 0000000000..9dd06aff4e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/GkeHubSpringProperties.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2022 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.gkehub.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 GkeHub client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.gkehub.v1.gke-hub")
+public class GkeHubSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listMemberships. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listMembershipsRetry;
+ /**
+ * Allow override of retry settings at method-level for listFeatures. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFeaturesRetry;
+ /**
+ * Allow override of retry settings at method-level for getMembership. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMembershipRetry;
+ /**
+ * Allow override of retry settings at method-level for getFeature. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getFeatureRetry;
+ /**
+ * Allow override of retry settings at method-level for generateConnectManifest. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateConnectManifestRetry;
+
+ @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 getListMembershipsRetry() {
+ return this.listMembershipsRetry;
+ }
+
+ public void setListMembershipsRetry(Retry listMembershipsRetry) {
+ this.listMembershipsRetry = listMembershipsRetry;
+ }
+
+ public Retry getListFeaturesRetry() {
+ return this.listFeaturesRetry;
+ }
+
+ public void setListFeaturesRetry(Retry listFeaturesRetry) {
+ this.listFeaturesRetry = listFeaturesRetry;
+ }
+
+ public Retry getGetMembershipRetry() {
+ return this.getMembershipRetry;
+ }
+
+ public void setGetMembershipRetry(Retry getMembershipRetry) {
+ this.getMembershipRetry = getMembershipRetry;
+ }
+
+ public Retry getGetFeatureRetry() {
+ return this.getFeatureRetry;
+ }
+
+ public void setGetFeatureRetry(Retry getFeatureRetry) {
+ this.getFeatureRetry = getFeatureRetry;
+ }
+
+ public Retry getGenerateConnectManifestRetry() {
+ return this.generateConnectManifestRetry;
+ }
+
+ public void setGenerateConnectManifestRetry(Retry generateConnectManifestRetry) {
+ this.generateConnectManifestRetry = generateConnectManifestRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/package-info.java
new file mode 100644
index 0000000000..37e92997f0
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/java/com/google/cloud/gkehub/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for gkehub. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.gkehub.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..f9a0512072
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.gkehub.v1.gke-hub.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gkehub/GkeHub components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..cf25c2d05d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gkehub-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.gkehub.v1.spring.GkeHubSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/pom.xml
new file mode 100644
index 0000000000..81814a527f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in GSuiteAddOnsSpringProperties. 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 GSuiteAddOnsSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public GSuiteAddOnsSettings gSuiteAddOnsSettings(
+ @Qualifier("defaultGSuiteAddOnsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ GSuiteAddOnsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = GSuiteAddOnsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = GSuiteAddOnsSettings.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 =
+ GSuiteAddOnsSettings.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 getAuthorizationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAuthorizationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getAuthorizationSettings()
+ .setRetrySettings(getAuthorizationRetrySettings);
+
+ RetrySettings createDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createDeploymentSettings()
+ .setRetrySettings(createDeploymentRetrySettings);
+
+ RetrySettings replaceDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.replaceDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .replaceDeploymentSettings()
+ .setRetrySettings(replaceDeploymentRetrySettings);
+
+ RetrySettings getDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings);
+
+ RetrySettings listDeploymentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listDeploymentsSettings()
+ .setRetrySettings(listDeploymentsRetrySettings);
+
+ RetrySettings deleteDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteDeploymentSettings()
+ .setRetrySettings(deleteDeploymentRetrySettings);
+
+ RetrySettings installDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.installDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .installDeploymentSettings()
+ .setRetrySettings(installDeploymentRetrySettings);
+
+ RetrySettings uninstallDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.uninstallDeploymentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .uninstallDeploymentSettings()
+ .setRetrySettings(uninstallDeploymentRetrySettings);
+
+ RetrySettings getInstallStatusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstallStatusSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getInstallStatusSettings()
+ .setRetrySettings(getInstallStatusRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getAuthorizationRetry = clientProperties.getGetAuthorizationRetry();
+ if (getAuthorizationRetry != null) {
+ RetrySettings getAuthorizationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAuthorizationSettings().getRetrySettings(),
+ getAuthorizationRetry);
+ clientSettingsBuilder
+ .getAuthorizationSettings()
+ .setRetrySettings(getAuthorizationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getAuthorization from properties.");
+ }
+ }
+ Retry createDeploymentRetry = clientProperties.getCreateDeploymentRetry();
+ if (createDeploymentRetry != null) {
+ RetrySettings createDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeploymentSettings().getRetrySettings(),
+ createDeploymentRetry);
+ clientSettingsBuilder
+ .createDeploymentSettings()
+ .setRetrySettings(createDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createDeployment from properties.");
+ }
+ }
+ Retry replaceDeploymentRetry = clientProperties.getReplaceDeploymentRetry();
+ if (replaceDeploymentRetry != null) {
+ RetrySettings replaceDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.replaceDeploymentSettings().getRetrySettings(),
+ replaceDeploymentRetry);
+ clientSettingsBuilder
+ .replaceDeploymentSettings()
+ .setRetrySettings(replaceDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for replaceDeployment from properties.");
+ }
+ }
+ Retry getDeploymentRetry = clientProperties.getGetDeploymentRetry();
+ if (getDeploymentRetry != null) {
+ RetrySettings getDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeploymentSettings().getRetrySettings(), getDeploymentRetry);
+ clientSettingsBuilder.getDeploymentSettings().setRetrySettings(getDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDeployment from properties.");
+ }
+ }
+ Retry listDeploymentsRetry = clientProperties.getListDeploymentsRetry();
+ if (listDeploymentsRetry != null) {
+ RetrySettings listDeploymentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeploymentsSettings().getRetrySettings(),
+ listDeploymentsRetry);
+ clientSettingsBuilder
+ .listDeploymentsSettings()
+ .setRetrySettings(listDeploymentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDeployments from properties.");
+ }
+ }
+ Retry deleteDeploymentRetry = clientProperties.getDeleteDeploymentRetry();
+ if (deleteDeploymentRetry != null) {
+ RetrySettings deleteDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeploymentSettings().getRetrySettings(),
+ deleteDeploymentRetry);
+ clientSettingsBuilder
+ .deleteDeploymentSettings()
+ .setRetrySettings(deleteDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteDeployment from properties.");
+ }
+ }
+ Retry installDeploymentRetry = clientProperties.getInstallDeploymentRetry();
+ if (installDeploymentRetry != null) {
+ RetrySettings installDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.installDeploymentSettings().getRetrySettings(),
+ installDeploymentRetry);
+ clientSettingsBuilder
+ .installDeploymentSettings()
+ .setRetrySettings(installDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for installDeployment from properties.");
+ }
+ }
+ Retry uninstallDeploymentRetry = clientProperties.getUninstallDeploymentRetry();
+ if (uninstallDeploymentRetry != null) {
+ RetrySettings uninstallDeploymentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.uninstallDeploymentSettings().getRetrySettings(),
+ uninstallDeploymentRetry);
+ clientSettingsBuilder
+ .uninstallDeploymentSettings()
+ .setRetrySettings(uninstallDeploymentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for uninstallDeployment from properties.");
+ }
+ }
+ Retry getInstallStatusRetry = clientProperties.getGetInstallStatusRetry();
+ if (getInstallStatusRetry != null) {
+ RetrySettings getInstallStatusRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstallStatusSettings().getRetrySettings(),
+ getInstallStatusRetry);
+ clientSettingsBuilder
+ .getInstallStatusSettings()
+ .setRetrySettings(getInstallStatusRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getInstallStatus from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a GSuiteAddOnsClient bean configured with GSuiteAddOnsSettings.
+ *
+ * @param gSuiteAddOnsSettings settings to configure an instance of client bean.
+ * @return a {@link GSuiteAddOnsClient} bean configured with {@link GSuiteAddOnsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public GSuiteAddOnsClient gSuiteAddOnsClient(GSuiteAddOnsSettings gSuiteAddOnsSettings)
+ throws IOException {
+ return GSuiteAddOnsClient.create(gSuiteAddOnsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-g-suite-add-ons";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringProperties.java b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringProperties.java
new file mode 100644
index 0000000000..ddcee99ca7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/GSuiteAddOnsSpringProperties.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2022 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.gsuiteaddons.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 GSuiteAddOns client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.gsuiteaddons.v1.g-suite-add-ons")
+public class GSuiteAddOnsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getAuthorization. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAuthorizationRetry;
+ /**
+ * Allow override of retry settings at method-level for createDeployment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for replaceDeployment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry replaceDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for getDeployment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for listDeployments. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeploymentsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDeployment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for installDeployment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry installDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for uninstallDeployment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry uninstallDeploymentRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstallStatus. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstallStatusRetry;
+
+ @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 getGetAuthorizationRetry() {
+ return this.getAuthorizationRetry;
+ }
+
+ public void setGetAuthorizationRetry(Retry getAuthorizationRetry) {
+ this.getAuthorizationRetry = getAuthorizationRetry;
+ }
+
+ public Retry getCreateDeploymentRetry() {
+ return this.createDeploymentRetry;
+ }
+
+ public void setCreateDeploymentRetry(Retry createDeploymentRetry) {
+ this.createDeploymentRetry = createDeploymentRetry;
+ }
+
+ public Retry getReplaceDeploymentRetry() {
+ return this.replaceDeploymentRetry;
+ }
+
+ public void setReplaceDeploymentRetry(Retry replaceDeploymentRetry) {
+ this.replaceDeploymentRetry = replaceDeploymentRetry;
+ }
+
+ public Retry getGetDeploymentRetry() {
+ return this.getDeploymentRetry;
+ }
+
+ public void setGetDeploymentRetry(Retry getDeploymentRetry) {
+ this.getDeploymentRetry = getDeploymentRetry;
+ }
+
+ public Retry getListDeploymentsRetry() {
+ return this.listDeploymentsRetry;
+ }
+
+ public void setListDeploymentsRetry(Retry listDeploymentsRetry) {
+ this.listDeploymentsRetry = listDeploymentsRetry;
+ }
+
+ public Retry getDeleteDeploymentRetry() {
+ return this.deleteDeploymentRetry;
+ }
+
+ public void setDeleteDeploymentRetry(Retry deleteDeploymentRetry) {
+ this.deleteDeploymentRetry = deleteDeploymentRetry;
+ }
+
+ public Retry getInstallDeploymentRetry() {
+ return this.installDeploymentRetry;
+ }
+
+ public void setInstallDeploymentRetry(Retry installDeploymentRetry) {
+ this.installDeploymentRetry = installDeploymentRetry;
+ }
+
+ public Retry getUninstallDeploymentRetry() {
+ return this.uninstallDeploymentRetry;
+ }
+
+ public void setUninstallDeploymentRetry(Retry uninstallDeploymentRetry) {
+ this.uninstallDeploymentRetry = uninstallDeploymentRetry;
+ }
+
+ public Retry getGetInstallStatusRetry() {
+ return this.getInstallStatusRetry;
+ }
+
+ public void setGetInstallStatusRetry(Retry getInstallStatusRetry) {
+ this.getInstallStatusRetry = getInstallStatusRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/package-info.java
new file mode 100644
index 0000000000..9d3d311026
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/java/com/google/cloud/gsuiteaddons/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for gsuiteaddons. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.gsuiteaddons.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..d6eb7e8222
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.gsuiteaddons.v1.g-suite-add-ons.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud gsuiteaddons/GSuiteAddOns components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..cd75502c7b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-gsuite-addons-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.gsuiteaddons.v1.spring.GSuiteAddOnsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/pom.xml
new file mode 100644
index 0000000000..de281bd971
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in IAMCredentialsSpringProperties. 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 IAMCredentialsSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IamCredentialsSettings iAMCredentialsSettings(
+ @Qualifier("defaultIAMCredentialsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ IamCredentialsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = IamCredentialsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = IamCredentialsSettings.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 =
+ IamCredentialsSettings.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 generateAccessTokenRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .generateAccessTokenSettings()
+ .setRetrySettings(generateAccessTokenRetrySettings);
+
+ RetrySettings generateIdTokenRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateIdTokenSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .generateIdTokenSettings()
+ .setRetrySettings(generateIdTokenRetrySettings);
+
+ RetrySettings signBlobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signBlobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.signBlobSettings().setRetrySettings(signBlobRetrySettings);
+
+ RetrySettings signJwtRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signJwtSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.signJwtSettings().setRetrySettings(signJwtRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry generateAccessTokenRetry = clientProperties.getGenerateAccessTokenRetry();
+ if (generateAccessTokenRetry != null) {
+ RetrySettings generateAccessTokenRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateAccessTokenSettings().getRetrySettings(),
+ generateAccessTokenRetry);
+ clientSettingsBuilder
+ .generateAccessTokenSettings()
+ .setRetrySettings(generateAccessTokenRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateAccessToken from properties.");
+ }
+ }
+ Retry generateIdTokenRetry = clientProperties.getGenerateIdTokenRetry();
+ if (generateIdTokenRetry != null) {
+ RetrySettings generateIdTokenRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateIdTokenSettings().getRetrySettings(),
+ generateIdTokenRetry);
+ clientSettingsBuilder
+ .generateIdTokenSettings()
+ .setRetrySettings(generateIdTokenRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for generateIdToken from properties.");
+ }
+ }
+ Retry signBlobRetry = clientProperties.getSignBlobRetry();
+ if (signBlobRetry != null) {
+ RetrySettings signBlobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signBlobSettings().getRetrySettings(), signBlobRetry);
+ clientSettingsBuilder.signBlobSettings().setRetrySettings(signBlobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for signBlob from properties.");
+ }
+ }
+ Retry signJwtRetry = clientProperties.getSignJwtRetry();
+ if (signJwtRetry != null) {
+ RetrySettings signJwtRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signJwtSettings().getRetrySettings(), signJwtRetry);
+ clientSettingsBuilder.signJwtSettings().setRetrySettings(signJwtRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for signJwt from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a IAMCredentialsClient bean configured with IAMCredentialsSettings.
+ *
+ * @param iAMCredentialsSettings settings to configure an instance of client bean.
+ * @return a {@link IAMCredentialsClient} bean configured with {@link IAMCredentialsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IamCredentialsClient iAMCredentialsClient(IamCredentialsSettings iAMCredentialsSettings)
+ throws IOException {
+ return IamCredentialsClient.create(iAMCredentialsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-i-a-m-credentials";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringProperties.java b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringProperties.java
new file mode 100644
index 0000000000..d4335dbf61
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/IAMCredentialsSpringProperties.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 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.iam.credentials.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 IAMCredentials client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.iam.credentials.v1.i-a-m-credentials")
+public class IAMCredentialsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for generateAccessToken. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateAccessTokenRetry;
+ /**
+ * Allow override of retry settings at method-level for generateIdToken. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateIdTokenRetry;
+ /**
+ * Allow override of retry settings at method-level for signBlob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry signBlobRetry;
+ /**
+ * Allow override of retry settings at method-level for signJwt. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry signJwtRetry;
+
+ @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 getGenerateAccessTokenRetry() {
+ return this.generateAccessTokenRetry;
+ }
+
+ public void setGenerateAccessTokenRetry(Retry generateAccessTokenRetry) {
+ this.generateAccessTokenRetry = generateAccessTokenRetry;
+ }
+
+ public Retry getGenerateIdTokenRetry() {
+ return this.generateIdTokenRetry;
+ }
+
+ public void setGenerateIdTokenRetry(Retry generateIdTokenRetry) {
+ this.generateIdTokenRetry = generateIdTokenRetry;
+ }
+
+ public Retry getSignBlobRetry() {
+ return this.signBlobRetry;
+ }
+
+ public void setSignBlobRetry(Retry signBlobRetry) {
+ this.signBlobRetry = signBlobRetry;
+ }
+
+ public Retry getSignJwtRetry() {
+ return this.signJwtRetry;
+ }
+
+ public void setSignJwtRetry(Retry signJwtRetry) {
+ this.signJwtRetry = signJwtRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/package-info.java
new file mode 100644
index 0000000000..01f5d5dd79
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/java/com/google/cloud/iam/credentials/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for iamcredentials. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.iam.credentials.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..615721c5b8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.iam.credentials.v1.i-a-m-credentials.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud iamcredentials/IAMCredentials components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..c765a2259b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iamcredentials-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.iam.credentials.v1.spring.IAMCredentialsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-ids-spring-starter/pom.xml
new file mode 100644
index 0000000000..ce6ac9d41a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-ids-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in IDSSpringProperties. 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 IDSSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IDSSettings iDSSettings(
+ @Qualifier("defaultIDSTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ IDSSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = IDSSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = IDSSettings.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 =
+ IDSSettings.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 listEndpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings);
+
+ RetrySettings getEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEndpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listEndpointsRetry = clientProperties.getListEndpointsRetry();
+ if (listEndpointsRetry != null) {
+ RetrySettings listEndpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), listEndpointsRetry);
+ clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listEndpoints from properties.");
+ }
+ }
+ Retry getEndpointRetry = clientProperties.getGetEndpointRetry();
+ if (getEndpointRetry != null) {
+ RetrySettings getEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEndpointSettings().getRetrySettings(), getEndpointRetry);
+ clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEndpoint from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a IDSClient bean configured with IDSSettings.
+ *
+ * @param iDSSettings settings to configure an instance of client bean.
+ * @return a {@link IDSClient} bean configured with {@link IDSSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IDSClient iDSClient(IDSSettings iDSSettings) throws IOException {
+ return IDSClient.create(iDSSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-i-d-s";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringProperties.java b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringProperties.java
new file mode 100644
index 0000000000..e68c2a4be7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/IDSSpringProperties.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2022 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.ids.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 IDS client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.ids.v1.i-d-s")
+public class IDSSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listEndpoints. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listEndpointsRetry;
+ /**
+ * Allow override of retry settings at method-level for getEndpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEndpointRetry;
+
+ @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 getListEndpointsRetry() {
+ return this.listEndpointsRetry;
+ }
+
+ public void setListEndpointsRetry(Retry listEndpointsRetry) {
+ this.listEndpointsRetry = listEndpointsRetry;
+ }
+
+ public Retry getGetEndpointRetry() {
+ return this.getEndpointRetry;
+ }
+
+ public void setGetEndpointRetry(Retry getEndpointRetry) {
+ this.getEndpointRetry = getEndpointRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/package-info.java
new file mode 100644
index 0000000000..59bf7f698e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/java/com/google/cloud/ids/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for ids. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.ids.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..bbbfe1626e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.ids.v1.i-d-s.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud ids/IDS components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..b61c0a4f09
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-ids-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.ids.v1.spring.IDSSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-iot-spring-starter/pom.xml
new file mode 100644
index 0000000000..e8c58271f6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iot-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DeviceManagerSpringProperties. 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 DeviceManagerSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DeviceManagerSettings deviceManagerSettings(
+ @Qualifier("defaultDeviceManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DeviceManagerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DeviceManagerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DeviceManagerSettings.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 =
+ DeviceManagerSettings.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 createDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeviceRegistrySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createDeviceRegistrySettings()
+ .setRetrySettings(createDeviceRegistryRetrySettings);
+
+ RetrySettings getDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeviceRegistrySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getDeviceRegistrySettings()
+ .setRetrySettings(getDeviceRegistryRetrySettings);
+
+ RetrySettings updateDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeviceRegistrySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateDeviceRegistrySettings()
+ .setRetrySettings(updateDeviceRegistryRetrySettings);
+
+ RetrySettings deleteDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeviceRegistrySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteDeviceRegistrySettings()
+ .setRetrySettings(deleteDeviceRegistryRetrySettings);
+
+ RetrySettings listDeviceRegistriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceRegistriesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listDeviceRegistriesSettings()
+ .setRetrySettings(listDeviceRegistriesRetrySettings);
+
+ RetrySettings createDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeviceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createDeviceSettings().setRetrySettings(createDeviceRetrySettings);
+
+ RetrySettings getDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeviceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDeviceSettings().setRetrySettings(getDeviceRetrySettings);
+
+ RetrySettings updateDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeviceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateDeviceSettings().setRetrySettings(updateDeviceRetrySettings);
+
+ RetrySettings deleteDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeviceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteDeviceSettings().setRetrySettings(deleteDeviceRetrySettings);
+
+ RetrySettings listDevicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDevicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listDevicesSettings().setRetrySettings(listDevicesRetrySettings);
+
+ RetrySettings modifyCloudToDeviceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.modifyCloudToDeviceConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .modifyCloudToDeviceConfigSettings()
+ .setRetrySettings(modifyCloudToDeviceConfigRetrySettings);
+
+ RetrySettings listDeviceConfigVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceConfigVersionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listDeviceConfigVersionsSettings()
+ .setRetrySettings(listDeviceConfigVersionsRetrySettings);
+
+ RetrySettings listDeviceStatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceStatesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listDeviceStatesSettings()
+ .setRetrySettings(listDeviceStatesRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings sendCommandToDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.sendCommandToDeviceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .sendCommandToDeviceSettings()
+ .setRetrySettings(sendCommandToDeviceRetrySettings);
+
+ RetrySettings bindDeviceToGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.bindDeviceToGatewaySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .bindDeviceToGatewaySettings()
+ .setRetrySettings(bindDeviceToGatewayRetrySettings);
+
+ RetrySettings unbindDeviceFromGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.unbindDeviceFromGatewaySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .unbindDeviceFromGatewaySettings()
+ .setRetrySettings(unbindDeviceFromGatewayRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createDeviceRegistryRetry = clientProperties.getCreateDeviceRegistryRetry();
+ if (createDeviceRegistryRetry != null) {
+ RetrySettings createDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeviceRegistrySettings().getRetrySettings(),
+ createDeviceRegistryRetry);
+ clientSettingsBuilder
+ .createDeviceRegistrySettings()
+ .setRetrySettings(createDeviceRegistryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createDeviceRegistry from properties.");
+ }
+ }
+ Retry getDeviceRegistryRetry = clientProperties.getGetDeviceRegistryRetry();
+ if (getDeviceRegistryRetry != null) {
+ RetrySettings getDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeviceRegistrySettings().getRetrySettings(),
+ getDeviceRegistryRetry);
+ clientSettingsBuilder
+ .getDeviceRegistrySettings()
+ .setRetrySettings(getDeviceRegistryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getDeviceRegistry from properties.");
+ }
+ }
+ Retry updateDeviceRegistryRetry = clientProperties.getUpdateDeviceRegistryRetry();
+ if (updateDeviceRegistryRetry != null) {
+ RetrySettings updateDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeviceRegistrySettings().getRetrySettings(),
+ updateDeviceRegistryRetry);
+ clientSettingsBuilder
+ .updateDeviceRegistrySettings()
+ .setRetrySettings(updateDeviceRegistryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateDeviceRegistry from properties.");
+ }
+ }
+ Retry deleteDeviceRegistryRetry = clientProperties.getDeleteDeviceRegistryRetry();
+ if (deleteDeviceRegistryRetry != null) {
+ RetrySettings deleteDeviceRegistryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeviceRegistrySettings().getRetrySettings(),
+ deleteDeviceRegistryRetry);
+ clientSettingsBuilder
+ .deleteDeviceRegistrySettings()
+ .setRetrySettings(deleteDeviceRegistryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteDeviceRegistry from properties.");
+ }
+ }
+ Retry listDeviceRegistriesRetry = clientProperties.getListDeviceRegistriesRetry();
+ if (listDeviceRegistriesRetry != null) {
+ RetrySettings listDeviceRegistriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceRegistriesSettings().getRetrySettings(),
+ listDeviceRegistriesRetry);
+ clientSettingsBuilder
+ .listDeviceRegistriesSettings()
+ .setRetrySettings(listDeviceRegistriesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDeviceRegistries from properties.");
+ }
+ }
+ Retry createDeviceRetry = clientProperties.getCreateDeviceRetry();
+ if (createDeviceRetry != null) {
+ RetrySettings createDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDeviceSettings().getRetrySettings(), createDeviceRetry);
+ clientSettingsBuilder.createDeviceSettings().setRetrySettings(createDeviceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createDevice from properties.");
+ }
+ }
+ Retry getDeviceRetry = clientProperties.getGetDeviceRetry();
+ if (getDeviceRetry != null) {
+ RetrySettings getDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDeviceSettings().getRetrySettings(), getDeviceRetry);
+ clientSettingsBuilder.getDeviceSettings().setRetrySettings(getDeviceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDevice from properties.");
+ }
+ }
+ Retry updateDeviceRetry = clientProperties.getUpdateDeviceRetry();
+ if (updateDeviceRetry != null) {
+ RetrySettings updateDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDeviceSettings().getRetrySettings(), updateDeviceRetry);
+ clientSettingsBuilder.updateDeviceSettings().setRetrySettings(updateDeviceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateDevice from properties.");
+ }
+ }
+ Retry deleteDeviceRetry = clientProperties.getDeleteDeviceRetry();
+ if (deleteDeviceRetry != null) {
+ RetrySettings deleteDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDeviceSettings().getRetrySettings(), deleteDeviceRetry);
+ clientSettingsBuilder.deleteDeviceSettings().setRetrySettings(deleteDeviceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteDevice from properties.");
+ }
+ }
+ Retry listDevicesRetry = clientProperties.getListDevicesRetry();
+ if (listDevicesRetry != null) {
+ RetrySettings listDevicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDevicesSettings().getRetrySettings(), listDevicesRetry);
+ clientSettingsBuilder.listDevicesSettings().setRetrySettings(listDevicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDevices from properties.");
+ }
+ }
+ Retry modifyCloudToDeviceConfigRetry = clientProperties.getModifyCloudToDeviceConfigRetry();
+ if (modifyCloudToDeviceConfigRetry != null) {
+ RetrySettings modifyCloudToDeviceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.modifyCloudToDeviceConfigSettings().getRetrySettings(),
+ modifyCloudToDeviceConfigRetry);
+ clientSettingsBuilder
+ .modifyCloudToDeviceConfigSettings()
+ .setRetrySettings(modifyCloudToDeviceConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for modifyCloudToDeviceConfig from properties.");
+ }
+ }
+ Retry listDeviceConfigVersionsRetry = clientProperties.getListDeviceConfigVersionsRetry();
+ if (listDeviceConfigVersionsRetry != null) {
+ RetrySettings listDeviceConfigVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceConfigVersionsSettings().getRetrySettings(),
+ listDeviceConfigVersionsRetry);
+ clientSettingsBuilder
+ .listDeviceConfigVersionsSettings()
+ .setRetrySettings(listDeviceConfigVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDeviceConfigVersions from properties.");
+ }
+ }
+ Retry listDeviceStatesRetry = clientProperties.getListDeviceStatesRetry();
+ if (listDeviceStatesRetry != null) {
+ RetrySettings listDeviceStatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDeviceStatesSettings().getRetrySettings(),
+ listDeviceStatesRetry);
+ clientSettingsBuilder
+ .listDeviceStatesSettings()
+ .setRetrySettings(listDeviceStatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDeviceStates from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ Retry sendCommandToDeviceRetry = clientProperties.getSendCommandToDeviceRetry();
+ if (sendCommandToDeviceRetry != null) {
+ RetrySettings sendCommandToDeviceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.sendCommandToDeviceSettings().getRetrySettings(),
+ sendCommandToDeviceRetry);
+ clientSettingsBuilder
+ .sendCommandToDeviceSettings()
+ .setRetrySettings(sendCommandToDeviceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for sendCommandToDevice from properties.");
+ }
+ }
+ Retry bindDeviceToGatewayRetry = clientProperties.getBindDeviceToGatewayRetry();
+ if (bindDeviceToGatewayRetry != null) {
+ RetrySettings bindDeviceToGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.bindDeviceToGatewaySettings().getRetrySettings(),
+ bindDeviceToGatewayRetry);
+ clientSettingsBuilder
+ .bindDeviceToGatewaySettings()
+ .setRetrySettings(bindDeviceToGatewayRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for bindDeviceToGateway from properties.");
+ }
+ }
+ Retry unbindDeviceFromGatewayRetry = clientProperties.getUnbindDeviceFromGatewayRetry();
+ if (unbindDeviceFromGatewayRetry != null) {
+ RetrySettings unbindDeviceFromGatewayRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.unbindDeviceFromGatewaySettings().getRetrySettings(),
+ unbindDeviceFromGatewayRetry);
+ clientSettingsBuilder
+ .unbindDeviceFromGatewaySettings()
+ .setRetrySettings(unbindDeviceFromGatewayRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for unbindDeviceFromGateway from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DeviceManagerClient bean configured with DeviceManagerSettings.
+ *
+ * @param deviceManagerSettings settings to configure an instance of client bean.
+ * @return a {@link DeviceManagerClient} bean configured with {@link DeviceManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DeviceManagerClient deviceManagerClient(DeviceManagerSettings deviceManagerSettings)
+ throws IOException {
+ return DeviceManagerClient.create(deviceManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-device-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringProperties.java b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringProperties.java
new file mode 100644
index 0000000000..28b05a4246
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/DeviceManagerSpringProperties.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2022 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.iot.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 DeviceManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.iot.v1.device-manager")
+public class DeviceManagerSpringProperties 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/cloudiot");
+ /** 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 createDeviceRegistry. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDeviceRegistryRetry;
+ /**
+ * Allow override of retry settings at method-level for getDeviceRegistry. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDeviceRegistryRetry;
+ /**
+ * Allow override of retry settings at method-level for updateDeviceRegistry. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateDeviceRegistryRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDeviceRegistry. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDeviceRegistryRetry;
+ /**
+ * Allow override of retry settings at method-level for listDeviceRegistries. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeviceRegistriesRetry;
+ /**
+ * Allow override of retry settings at method-level for createDevice. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDeviceRetry;
+ /**
+ * Allow override of retry settings at method-level for getDevice. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDeviceRetry;
+ /**
+ * Allow override of retry settings at method-level for updateDevice. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateDeviceRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDevice. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDeviceRetry;
+ /**
+ * Allow override of retry settings at method-level for listDevices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDevicesRetry;
+ /**
+ * Allow override of retry settings at method-level for modifyCloudToDeviceConfig. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry modifyCloudToDeviceConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listDeviceConfigVersions. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeviceConfigVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for listDeviceStates. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDeviceStatesRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for sendCommandToDevice. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry sendCommandToDeviceRetry;
+ /**
+ * Allow override of retry settings at method-level for bindDeviceToGateway. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry bindDeviceToGatewayRetry;
+ /**
+ * Allow override of retry settings at method-level for unbindDeviceFromGateway. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry unbindDeviceFromGatewayRetry;
+
+ @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 getCreateDeviceRegistryRetry() {
+ return this.createDeviceRegistryRetry;
+ }
+
+ public void setCreateDeviceRegistryRetry(Retry createDeviceRegistryRetry) {
+ this.createDeviceRegistryRetry = createDeviceRegistryRetry;
+ }
+
+ public Retry getGetDeviceRegistryRetry() {
+ return this.getDeviceRegistryRetry;
+ }
+
+ public void setGetDeviceRegistryRetry(Retry getDeviceRegistryRetry) {
+ this.getDeviceRegistryRetry = getDeviceRegistryRetry;
+ }
+
+ public Retry getUpdateDeviceRegistryRetry() {
+ return this.updateDeviceRegistryRetry;
+ }
+
+ public void setUpdateDeviceRegistryRetry(Retry updateDeviceRegistryRetry) {
+ this.updateDeviceRegistryRetry = updateDeviceRegistryRetry;
+ }
+
+ public Retry getDeleteDeviceRegistryRetry() {
+ return this.deleteDeviceRegistryRetry;
+ }
+
+ public void setDeleteDeviceRegistryRetry(Retry deleteDeviceRegistryRetry) {
+ this.deleteDeviceRegistryRetry = deleteDeviceRegistryRetry;
+ }
+
+ public Retry getListDeviceRegistriesRetry() {
+ return this.listDeviceRegistriesRetry;
+ }
+
+ public void setListDeviceRegistriesRetry(Retry listDeviceRegistriesRetry) {
+ this.listDeviceRegistriesRetry = listDeviceRegistriesRetry;
+ }
+
+ public Retry getCreateDeviceRetry() {
+ return this.createDeviceRetry;
+ }
+
+ public void setCreateDeviceRetry(Retry createDeviceRetry) {
+ this.createDeviceRetry = createDeviceRetry;
+ }
+
+ public Retry getGetDeviceRetry() {
+ return this.getDeviceRetry;
+ }
+
+ public void setGetDeviceRetry(Retry getDeviceRetry) {
+ this.getDeviceRetry = getDeviceRetry;
+ }
+
+ public Retry getUpdateDeviceRetry() {
+ return this.updateDeviceRetry;
+ }
+
+ public void setUpdateDeviceRetry(Retry updateDeviceRetry) {
+ this.updateDeviceRetry = updateDeviceRetry;
+ }
+
+ public Retry getDeleteDeviceRetry() {
+ return this.deleteDeviceRetry;
+ }
+
+ public void setDeleteDeviceRetry(Retry deleteDeviceRetry) {
+ this.deleteDeviceRetry = deleteDeviceRetry;
+ }
+
+ public Retry getListDevicesRetry() {
+ return this.listDevicesRetry;
+ }
+
+ public void setListDevicesRetry(Retry listDevicesRetry) {
+ this.listDevicesRetry = listDevicesRetry;
+ }
+
+ public Retry getModifyCloudToDeviceConfigRetry() {
+ return this.modifyCloudToDeviceConfigRetry;
+ }
+
+ public void setModifyCloudToDeviceConfigRetry(Retry modifyCloudToDeviceConfigRetry) {
+ this.modifyCloudToDeviceConfigRetry = modifyCloudToDeviceConfigRetry;
+ }
+
+ public Retry getListDeviceConfigVersionsRetry() {
+ return this.listDeviceConfigVersionsRetry;
+ }
+
+ public void setListDeviceConfigVersionsRetry(Retry listDeviceConfigVersionsRetry) {
+ this.listDeviceConfigVersionsRetry = listDeviceConfigVersionsRetry;
+ }
+
+ public Retry getListDeviceStatesRetry() {
+ return this.listDeviceStatesRetry;
+ }
+
+ public void setListDeviceStatesRetry(Retry listDeviceStatesRetry) {
+ this.listDeviceStatesRetry = listDeviceStatesRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+
+ public Retry getSendCommandToDeviceRetry() {
+ return this.sendCommandToDeviceRetry;
+ }
+
+ public void setSendCommandToDeviceRetry(Retry sendCommandToDeviceRetry) {
+ this.sendCommandToDeviceRetry = sendCommandToDeviceRetry;
+ }
+
+ public Retry getBindDeviceToGatewayRetry() {
+ return this.bindDeviceToGatewayRetry;
+ }
+
+ public void setBindDeviceToGatewayRetry(Retry bindDeviceToGatewayRetry) {
+ this.bindDeviceToGatewayRetry = bindDeviceToGatewayRetry;
+ }
+
+ public Retry getUnbindDeviceFromGatewayRetry() {
+ return this.unbindDeviceFromGatewayRetry;
+ }
+
+ public void setUnbindDeviceFromGatewayRetry(Retry unbindDeviceFromGatewayRetry) {
+ this.unbindDeviceFromGatewayRetry = unbindDeviceFromGatewayRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/package-info.java
new file mode 100644
index 0000000000..dbb5f115fa
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/java/com/google/cloud/iot/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudiot. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.iot.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..2e66991ea1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.iot.v1.device-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudiot/DeviceManager components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..0b351ff336
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-iot-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.iot.v1.spring.DeviceManagerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-language-spring-starter/pom.xml
new file mode 100644
index 0000000000..9daa951035
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-language-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in LanguageServiceSpringProperties. 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 LanguageServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public LanguageServiceSettings languageServiceSettings(
+ @Qualifier("defaultLanguageServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ LanguageServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = LanguageServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = LanguageServiceSettings.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 =
+ LanguageServiceSettings.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 analyzeSentimentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeSentimentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .analyzeSentimentSettings()
+ .setRetrySettings(analyzeSentimentRetrySettings);
+
+ RetrySettings analyzeEntitiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeEntitiesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .analyzeEntitiesSettings()
+ .setRetrySettings(analyzeEntitiesRetrySettings);
+
+ RetrySettings analyzeEntitySentimentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeEntitySentimentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .analyzeEntitySentimentSettings()
+ .setRetrySettings(analyzeEntitySentimentRetrySettings);
+
+ RetrySettings analyzeSyntaxRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeSyntaxSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.analyzeSyntaxSettings().setRetrySettings(analyzeSyntaxRetrySettings);
+
+ RetrySettings classifyTextRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.classifyTextSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.classifyTextSettings().setRetrySettings(classifyTextRetrySettings);
+
+ RetrySettings annotateTextRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.annotateTextSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.annotateTextSettings().setRetrySettings(annotateTextRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry analyzeSentimentRetry = clientProperties.getAnalyzeSentimentRetry();
+ if (analyzeSentimentRetry != null) {
+ RetrySettings analyzeSentimentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeSentimentSettings().getRetrySettings(),
+ analyzeSentimentRetry);
+ clientSettingsBuilder
+ .analyzeSentimentSettings()
+ .setRetrySettings(analyzeSentimentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for analyzeSentiment from properties.");
+ }
+ }
+ Retry analyzeEntitiesRetry = clientProperties.getAnalyzeEntitiesRetry();
+ if (analyzeEntitiesRetry != null) {
+ RetrySettings analyzeEntitiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeEntitiesSettings().getRetrySettings(),
+ analyzeEntitiesRetry);
+ clientSettingsBuilder
+ .analyzeEntitiesSettings()
+ .setRetrySettings(analyzeEntitiesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for analyzeEntities from properties.");
+ }
+ }
+ Retry analyzeEntitySentimentRetry = clientProperties.getAnalyzeEntitySentimentRetry();
+ if (analyzeEntitySentimentRetry != null) {
+ RetrySettings analyzeEntitySentimentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeEntitySentimentSettings().getRetrySettings(),
+ analyzeEntitySentimentRetry);
+ clientSettingsBuilder
+ .analyzeEntitySentimentSettings()
+ .setRetrySettings(analyzeEntitySentimentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for analyzeEntitySentiment from properties.");
+ }
+ }
+ Retry analyzeSyntaxRetry = clientProperties.getAnalyzeSyntaxRetry();
+ if (analyzeSyntaxRetry != null) {
+ RetrySettings analyzeSyntaxRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.analyzeSyntaxSettings().getRetrySettings(), analyzeSyntaxRetry);
+ clientSettingsBuilder.analyzeSyntaxSettings().setRetrySettings(analyzeSyntaxRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for analyzeSyntax from properties.");
+ }
+ }
+ Retry classifyTextRetry = clientProperties.getClassifyTextRetry();
+ if (classifyTextRetry != null) {
+ RetrySettings classifyTextRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.classifyTextSettings().getRetrySettings(), classifyTextRetry);
+ clientSettingsBuilder.classifyTextSettings().setRetrySettings(classifyTextRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for classifyText from properties.");
+ }
+ }
+ Retry annotateTextRetry = clientProperties.getAnnotateTextRetry();
+ if (annotateTextRetry != null) {
+ RetrySettings annotateTextRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.annotateTextSettings().getRetrySettings(), annotateTextRetry);
+ clientSettingsBuilder.annotateTextSettings().setRetrySettings(annotateTextRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for annotateText from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a LanguageServiceClient bean configured with LanguageServiceSettings.
+ *
+ * @param languageServiceSettings settings to configure an instance of client bean.
+ * @return a {@link LanguageServiceClient} bean configured with {@link LanguageServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public LanguageServiceClient languageServiceClient(
+ LanguageServiceSettings languageServiceSettings) throws IOException {
+ return LanguageServiceClient.create(languageServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-language-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/LanguageServiceSpringProperties.java b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/LanguageServiceSpringProperties.java
new file mode 100644
index 0000000000..2dc3ba178f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/LanguageServiceSpringProperties.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2022 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.language.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 LanguageService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.language.v1.language-service")
+public class LanguageServiceSpringProperties 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-language",
+ "https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for analyzeSentiment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeSentimentRetry;
+ /**
+ * Allow override of retry settings at method-level for analyzeEntities. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeEntitiesRetry;
+ /**
+ * Allow override of retry settings at method-level for analyzeEntitySentiment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeEntitySentimentRetry;
+ /**
+ * Allow override of retry settings at method-level for analyzeSyntax. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry analyzeSyntaxRetry;
+ /**
+ * Allow override of retry settings at method-level for classifyText. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry classifyTextRetry;
+ /**
+ * Allow override of retry settings at method-level for annotateText. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry annotateTextRetry;
+
+ @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 getAnalyzeSentimentRetry() {
+ return this.analyzeSentimentRetry;
+ }
+
+ public void setAnalyzeSentimentRetry(Retry analyzeSentimentRetry) {
+ this.analyzeSentimentRetry = analyzeSentimentRetry;
+ }
+
+ public Retry getAnalyzeEntitiesRetry() {
+ return this.analyzeEntitiesRetry;
+ }
+
+ public void setAnalyzeEntitiesRetry(Retry analyzeEntitiesRetry) {
+ this.analyzeEntitiesRetry = analyzeEntitiesRetry;
+ }
+
+ public Retry getAnalyzeEntitySentimentRetry() {
+ return this.analyzeEntitySentimentRetry;
+ }
+
+ public void setAnalyzeEntitySentimentRetry(Retry analyzeEntitySentimentRetry) {
+ this.analyzeEntitySentimentRetry = analyzeEntitySentimentRetry;
+ }
+
+ public Retry getAnalyzeSyntaxRetry() {
+ return this.analyzeSyntaxRetry;
+ }
+
+ public void setAnalyzeSyntaxRetry(Retry analyzeSyntaxRetry) {
+ this.analyzeSyntaxRetry = analyzeSyntaxRetry;
+ }
+
+ public Retry getClassifyTextRetry() {
+ return this.classifyTextRetry;
+ }
+
+ public void setClassifyTextRetry(Retry classifyTextRetry) {
+ this.classifyTextRetry = classifyTextRetry;
+ }
+
+ public Retry getAnnotateTextRetry() {
+ return this.annotateTextRetry;
+ }
+
+ public void setAnnotateTextRetry(Retry annotateTextRetry) {
+ this.annotateTextRetry = annotateTextRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/package-info.java
new file mode 100644
index 0000000000..b7f4ba555b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/java/com/google/cloud/language/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for language. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.language.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..acc42817a7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.language.v1.language-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud language/LanguageService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..42037b3ef7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.language.v1.spring.LanguageServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/pom.xml
new file mode 100644
index 0000000000..ed14064fdc
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ManagedIdentitiesServiceSpringProperties. 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 ManagedIdentitiesServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ManagedIdentitiesServiceSettings managedIdentitiesServiceSettings(
+ @Qualifier("defaultManagedIdentitiesServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ManagedIdentitiesServiceSettings.Builder clientSettingsBuilder =
+ ManagedIdentitiesServiceSettings.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 =
+ ManagedIdentitiesServiceSettings.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 resetAdminPasswordRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resetAdminPasswordSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .resetAdminPasswordSettings()
+ .setRetrySettings(resetAdminPasswordRetrySettings);
+
+ RetrySettings listDomainsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDomainsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listDomainsSettings().setRetrySettings(listDomainsRetrySettings);
+
+ RetrySettings getDomainRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDomainSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDomainSettings().setRetrySettings(getDomainRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry resetAdminPasswordRetry = clientProperties.getResetAdminPasswordRetry();
+ if (resetAdminPasswordRetry != null) {
+ RetrySettings resetAdminPasswordRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resetAdminPasswordSettings().getRetrySettings(),
+ resetAdminPasswordRetry);
+ clientSettingsBuilder
+ .resetAdminPasswordSettings()
+ .setRetrySettings(resetAdminPasswordRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for resetAdminPassword from properties.");
+ }
+ }
+ Retry listDomainsRetry = clientProperties.getListDomainsRetry();
+ if (listDomainsRetry != null) {
+ RetrySettings listDomainsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDomainsSettings().getRetrySettings(), listDomainsRetry);
+ clientSettingsBuilder.listDomainsSettings().setRetrySettings(listDomainsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDomains from properties.");
+ }
+ }
+ Retry getDomainRetry = clientProperties.getGetDomainRetry();
+ if (getDomainRetry != null) {
+ RetrySettings getDomainRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDomainSettings().getRetrySettings(), getDomainRetry);
+ clientSettingsBuilder.getDomainSettings().setRetrySettings(getDomainRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDomain from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ManagedIdentitiesServiceClient bean configured with
+ * ManagedIdentitiesServiceSettings.
+ *
+ * @param managedIdentitiesServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ManagedIdentitiesServiceClient} bean configured with {@link
+ * ManagedIdentitiesServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ManagedIdentitiesServiceClient managedIdentitiesServiceClient(
+ ManagedIdentitiesServiceSettings managedIdentitiesServiceSettings) throws IOException {
+ return ManagedIdentitiesServiceClient.create(managedIdentitiesServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-managed-identities-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringProperties.java b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringProperties.java
new file mode 100644
index 0000000000..a824920ea6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/ManagedIdentitiesServiceSpringProperties.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2022 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.managedidentities.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 ManagedIdentitiesService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.managedidentities.v1.managed-identities-service")
+public class ManagedIdentitiesServiceSpringProperties 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 resetAdminPassword. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry resetAdminPasswordRetry;
+ /**
+ * Allow override of retry settings at method-level for listDomains. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDomainsRetry;
+ /**
+ * Allow override of retry settings at method-level for getDomain. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDomainRetry;
+
+ @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 getResetAdminPasswordRetry() {
+ return this.resetAdminPasswordRetry;
+ }
+
+ public void setResetAdminPasswordRetry(Retry resetAdminPasswordRetry) {
+ this.resetAdminPasswordRetry = resetAdminPasswordRetry;
+ }
+
+ public Retry getListDomainsRetry() {
+ return this.listDomainsRetry;
+ }
+
+ public void setListDomainsRetry(Retry listDomainsRetry) {
+ this.listDomainsRetry = listDomainsRetry;
+ }
+
+ public Retry getGetDomainRetry() {
+ return this.getDomainRetry;
+ }
+
+ public void setGetDomainRetry(Retry getDomainRetry) {
+ this.getDomainRetry = getDomainRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/package-info.java
new file mode 100644
index 0000000000..bdffd589a3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/java/com/google/cloud/managedidentities/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for managedidentities. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.managedidentities.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..37d6343cde
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.managedidentities.v1.managed-identities-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud managedidentities/ManagedIdentitiesService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..315e8fbdc6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-managed-identities-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.managedidentities.v1.spring.ManagedIdentitiesServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-memcache-spring-starter/pom.xml
new file mode 100644
index 0000000000..2b49bcf2de
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudMemcacheSpringProperties. 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 CloudMemcacheSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudMemcacheSettings cloudMemcacheSettings(
+ @Qualifier("defaultCloudMemcacheTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudMemcacheSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudMemcacheSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudMemcacheSettings.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 =
+ CloudMemcacheSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listInstancesRetry = clientProperties.getListInstancesRetry();
+ if (listInstancesRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInstances from properties.");
+ }
+ }
+ Retry getInstanceRetry = clientProperties.getGetInstanceRetry();
+ if (getInstanceRetry != null) {
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInstance from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudMemcacheClient bean configured with CloudMemcacheSettings.
+ *
+ * @param cloudMemcacheSettings settings to configure an instance of client bean.
+ * @return a {@link CloudMemcacheClient} bean configured with {@link CloudMemcacheSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudMemcacheClient cloudMemcacheClient(CloudMemcacheSettings cloudMemcacheSettings)
+ throws IOException {
+ return CloudMemcacheClient.create(cloudMemcacheSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-memcache";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringProperties.java b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringProperties.java
new file mode 100644
index 0000000000..fe0d3bdfe3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/CloudMemcacheSpringProperties.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 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.memcache.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 CloudMemcache client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.memcache.v1.cloud-memcache")
+public class CloudMemcacheSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listInstances. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInstancesRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstance. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListInstancesRetry() {
+ return this.listInstancesRetry;
+ }
+
+ public void setListInstancesRetry(Retry listInstancesRetry) {
+ this.listInstancesRetry = listInstancesRetry;
+ }
+
+ public Retry getGetInstanceRetry() {
+ return this.getInstanceRetry;
+ }
+
+ public void setGetInstanceRetry(Retry getInstanceRetry) {
+ this.getInstanceRetry = getInstanceRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/package-info.java
new file mode 100644
index 0000000000..c294894029
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/java/com/google/cloud/memcache/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for memcache. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.memcache.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..507cd76b9a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.memcache.v1.cloud-memcache.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud memcache/CloudMemcache components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..9cdc00166e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-memcache-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.memcache.v1.spring.CloudMemcacheSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/pom.xml
new file mode 100644
index 0000000000..4d7c577f35
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in DashboardsServiceSpringProperties. 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 DashboardsServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DashboardsServiceSettings dashboardsServiceSettings(
+ @Qualifier("defaultDashboardsServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ DashboardsServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = DashboardsServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = DashboardsServiceSettings.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 =
+ DashboardsServiceSettings.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 createDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDashboardSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createDashboardSettings()
+ .setRetrySettings(createDashboardRetrySettings);
+
+ RetrySettings listDashboardsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDashboardsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listDashboardsSettings().setRetrySettings(listDashboardsRetrySettings);
+
+ RetrySettings getDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDashboardSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getDashboardSettings().setRetrySettings(getDashboardRetrySettings);
+
+ RetrySettings deleteDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDashboardSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteDashboardSettings()
+ .setRetrySettings(deleteDashboardRetrySettings);
+
+ RetrySettings updateDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDashboardSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateDashboardSettings()
+ .setRetrySettings(updateDashboardRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createDashboardRetry = clientProperties.getCreateDashboardRetry();
+ if (createDashboardRetry != null) {
+ RetrySettings createDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createDashboardSettings().getRetrySettings(),
+ createDashboardRetry);
+ clientSettingsBuilder
+ .createDashboardSettings()
+ .setRetrySettings(createDashboardRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createDashboard from properties.");
+ }
+ }
+ Retry listDashboardsRetry = clientProperties.getListDashboardsRetry();
+ if (listDashboardsRetry != null) {
+ RetrySettings listDashboardsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDashboardsSettings().getRetrySettings(),
+ listDashboardsRetry);
+ clientSettingsBuilder.listDashboardsSettings().setRetrySettings(listDashboardsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listDashboards from properties.");
+ }
+ }
+ Retry getDashboardRetry = clientProperties.getGetDashboardRetry();
+ if (getDashboardRetry != null) {
+ RetrySettings getDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDashboardSettings().getRetrySettings(), getDashboardRetry);
+ clientSettingsBuilder.getDashboardSettings().setRetrySettings(getDashboardRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getDashboard from properties.");
+ }
+ }
+ Retry deleteDashboardRetry = clientProperties.getDeleteDashboardRetry();
+ if (deleteDashboardRetry != null) {
+ RetrySettings deleteDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteDashboardSettings().getRetrySettings(),
+ deleteDashboardRetry);
+ clientSettingsBuilder
+ .deleteDashboardSettings()
+ .setRetrySettings(deleteDashboardRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteDashboard from properties.");
+ }
+ }
+ Retry updateDashboardRetry = clientProperties.getUpdateDashboardRetry();
+ if (updateDashboardRetry != null) {
+ RetrySettings updateDashboardRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateDashboardSettings().getRetrySettings(),
+ updateDashboardRetry);
+ clientSettingsBuilder
+ .updateDashboardSettings()
+ .setRetrySettings(updateDashboardRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateDashboard from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a DashboardsServiceClient bean configured with DashboardsServiceSettings.
+ *
+ * @param dashboardsServiceSettings settings to configure an instance of client bean.
+ * @return a {@link DashboardsServiceClient} bean configured with {@link
+ * DashboardsServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public DashboardsServiceClient dashboardsServiceClient(
+ DashboardsServiceSettings dashboardsServiceSettings) throws IOException {
+ return DashboardsServiceClient.create(dashboardsServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-dashboards-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringProperties.java
new file mode 100644
index 0000000000..f6b3c1d7ee
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/DashboardsServiceSpringProperties.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2022 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.monitoring.dashboard.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 DashboardsService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.monitoring.dashboard.v1.dashboards-service")
+public class DashboardsServiceSpringProperties 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.read",
+ "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 createDashboard. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createDashboardRetry;
+ /**
+ * Allow override of retry settings at method-level for listDashboards. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDashboardsRetry;
+ /**
+ * Allow override of retry settings at method-level for getDashboard. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDashboardRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteDashboard. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteDashboardRetry;
+ /**
+ * Allow override of retry settings at method-level for updateDashboard. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateDashboardRetry;
+
+ @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 getCreateDashboardRetry() {
+ return this.createDashboardRetry;
+ }
+
+ public void setCreateDashboardRetry(Retry createDashboardRetry) {
+ this.createDashboardRetry = createDashboardRetry;
+ }
+
+ public Retry getListDashboardsRetry() {
+ return this.listDashboardsRetry;
+ }
+
+ public void setListDashboardsRetry(Retry listDashboardsRetry) {
+ this.listDashboardsRetry = listDashboardsRetry;
+ }
+
+ public Retry getGetDashboardRetry() {
+ return this.getDashboardRetry;
+ }
+
+ public void setGetDashboardRetry(Retry getDashboardRetry) {
+ this.getDashboardRetry = getDashboardRetry;
+ }
+
+ public Retry getDeleteDashboardRetry() {
+ return this.deleteDashboardRetry;
+ }
+
+ public void setDeleteDashboardRetry(Retry deleteDashboardRetry) {
+ this.deleteDashboardRetry = deleteDashboardRetry;
+ }
+
+ public Retry getUpdateDashboardRetry() {
+ return this.updateDashboardRetry;
+ }
+
+ public void setUpdateDashboardRetry(Retry updateDashboardRetry) {
+ this.updateDashboardRetry = updateDashboardRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/package-info.java
new file mode 100644
index 0000000000..4269255458
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/java/com/google/cloud/monitoring/dashboard/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for monitoring. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.monitoring.dashboard.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..2684c8e89a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.monitoring.dashboard.v1.dashboards-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud monitoring/DashboardsService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..de9b656393
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-monitoring-dashboard-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.monitoring.dashboard.v1.spring.DashboardsServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-network-management-spring-starter/pom.xml
new file mode 100644
index 0000000000..179f69e000
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ReachabilityServiceSpringProperties. 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 ReachabilityServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ReachabilityServiceSettings reachabilityServiceSettings(
+ @Qualifier("defaultReachabilityServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ReachabilityServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ReachabilityServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ReachabilityServiceSettings.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 =
+ ReachabilityServiceSettings.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 listConnectivityTestsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectivityTestsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listConnectivityTestsSettings()
+ .setRetrySettings(listConnectivityTestsRetrySettings);
+
+ RetrySettings getConnectivityTestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectivityTestSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getConnectivityTestSettings()
+ .setRetrySettings(getConnectivityTestRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listConnectivityTestsRetry = clientProperties.getListConnectivityTestsRetry();
+ if (listConnectivityTestsRetry != null) {
+ RetrySettings listConnectivityTestsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectivityTestsSettings().getRetrySettings(),
+ listConnectivityTestsRetry);
+ clientSettingsBuilder
+ .listConnectivityTestsSettings()
+ .setRetrySettings(listConnectivityTestsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listConnectivityTests from properties.");
+ }
+ }
+ Retry getConnectivityTestRetry = clientProperties.getGetConnectivityTestRetry();
+ if (getConnectivityTestRetry != null) {
+ RetrySettings getConnectivityTestRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectivityTestSettings().getRetrySettings(),
+ getConnectivityTestRetry);
+ clientSettingsBuilder
+ .getConnectivityTestSettings()
+ .setRetrySettings(getConnectivityTestRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getConnectivityTest from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ReachabilityServiceClient bean configured with ReachabilityServiceSettings.
+ *
+ * @param reachabilityServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ReachabilityServiceClient} bean configured with {@link
+ * ReachabilityServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ReachabilityServiceClient reachabilityServiceClient(
+ ReachabilityServiceSettings reachabilityServiceSettings) throws IOException {
+ return ReachabilityServiceClient.create(reachabilityServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-reachability-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringProperties.java b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringProperties.java
new file mode 100644
index 0000000000..1c835e9b75
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/ReachabilityServiceSpringProperties.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2022 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.networkmanagement.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 ReachabilityService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.networkmanagement.v1.reachability-service")
+public class ReachabilityServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listConnectivityTests. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConnectivityTestsRetry;
+ /**
+ * Allow override of retry settings at method-level for getConnectivityTest. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConnectivityTestRetry;
+
+ @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 getListConnectivityTestsRetry() {
+ return this.listConnectivityTestsRetry;
+ }
+
+ public void setListConnectivityTestsRetry(Retry listConnectivityTestsRetry) {
+ this.listConnectivityTestsRetry = listConnectivityTestsRetry;
+ }
+
+ public Retry getGetConnectivityTestRetry() {
+ return this.getConnectivityTestRetry;
+ }
+
+ public void setGetConnectivityTestRetry(Retry getConnectivityTestRetry) {
+ this.getConnectivityTestRetry = getConnectivityTestRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/package-info.java
new file mode 100644
index 0000000000..14b45e87df
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/java/com/google/cloud/networkmanagement/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for networkmanagement. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.networkmanagement.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..4a541fbc07
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.networkmanagement.v1.reachability-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud networkmanagement/ReachabilityService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..7fe69cee66
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-network-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.networkmanagement.v1.spring.ReachabilityServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/pom.xml
new file mode 100644
index 0000000000..73c5e827eb
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in HubServiceSpringProperties. 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 HubServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public HubServiceSettings hubServiceSettings( + @Qualifier("defaultHubServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + HubServiceSettings.Builder clientSettingsBuilder = HubServiceSettings.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 = + HubServiceSettings.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 listHubsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHubsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listHubsSettings().setRetrySettings(listHubsRetrySettings); + + RetrySettings getHubRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHubSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getHubSettings().setRetrySettings(getHubRetrySettings); + + RetrySettings listSpokesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSpokesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listSpokesSettings().setRetrySettings(listSpokesRetrySettings); + + RetrySettings getSpokeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSpokeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getSpokeSettings().setRetrySettings(getSpokeRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listHubsRetry = clientProperties.getListHubsRetry(); + if (listHubsRetry != null) { + RetrySettings listHubsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listHubsSettings().getRetrySettings(), listHubsRetry); + clientSettingsBuilder.listHubsSettings().setRetrySettings(listHubsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listHubs from properties."); + } + } + Retry getHubRetry = clientProperties.getGetHubRetry(); + if (getHubRetry != null) { + RetrySettings getHubRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getHubSettings().getRetrySettings(), getHubRetry); + clientSettingsBuilder.getHubSettings().setRetrySettings(getHubRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getHub from properties."); + } + } + Retry listSpokesRetry = clientProperties.getListSpokesRetry(); + if (listSpokesRetry != null) { + RetrySettings listSpokesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listSpokesSettings().getRetrySettings(), listSpokesRetry); + clientSettingsBuilder.listSpokesSettings().setRetrySettings(listSpokesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listSpokes from properties."); + } + } + Retry getSpokeRetry = clientProperties.getGetSpokeRetry(); + if (getSpokeRetry != null) { + RetrySettings getSpokeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getSpokeSettings().getRetrySettings(), getSpokeRetry); + clientSettingsBuilder.getSpokeSettings().setRetrySettings(getSpokeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getSpoke from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a HubServiceClient bean configured with HubServiceSettings. + * + * @param hubServiceSettings settings to configure an instance of client bean. + * @return a {@link HubServiceClient} bean configured with {@link HubServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public HubServiceClient hubServiceClient(HubServiceSettings hubServiceSettings) + throws IOException { + return HubServiceClient.create(hubServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-hub-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java new file mode 100644 index 0000000000..756a45bf54 --- /dev/null +++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/HubServiceSpringProperties.java @@ -0,0 +1,124 @@ +/* + * Copyright 2022 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.networkconnectivity.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 HubService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.networkconnectivity.v1.hub-service") +public class HubServiceSpringProperties 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 listHubs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listHubsRetry; + /** + * Allow override of retry settings at method-level for getHub. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getHubRetry; + /** + * Allow override of retry settings at method-level for listSpokes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listSpokesRetry; + /** + * Allow override of retry settings at method-level for getSpoke. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getSpokeRetry; + + @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 getListHubsRetry() { + return this.listHubsRetry; + } + + public void setListHubsRetry(Retry listHubsRetry) { + this.listHubsRetry = listHubsRetry; + } + + public Retry getGetHubRetry() { + return this.getHubRetry; + } + + public void setGetHubRetry(Retry getHubRetry) { + this.getHubRetry = getHubRetry; + } + + public Retry getListSpokesRetry() { + return this.listSpokesRetry; + } + + public void setListSpokesRetry(Retry listSpokesRetry) { + this.listSpokesRetry = listSpokesRetry; + } + + public Retry getGetSpokeRetry() { + return this.getSpokeRetry; + } + + public void setGetSpokeRetry(Retry getSpokeRetry) { + this.getSpokeRetry = getSpokeRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..04db084187 --- /dev/null +++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringAutoConfiguration.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 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.networkconnectivity.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.networkconnectivity.v1.PolicyBasedRoutingServiceClient; +import com.google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceSettings; +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 PolicyBasedRoutingServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in PolicyBasedRoutingServiceSpringProperties. 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 PolicyBasedRoutingServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PolicyBasedRoutingServiceSettings policyBasedRoutingServiceSettings(
+ @Qualifier("defaultPolicyBasedRoutingServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ PolicyBasedRoutingServiceSettings.Builder clientSettingsBuilder =
+ PolicyBasedRoutingServiceSettings.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 =
+ PolicyBasedRoutingServiceSettings.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 listPolicyBasedRoutesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPolicyBasedRoutesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listPolicyBasedRoutesSettings()
+ .setRetrySettings(listPolicyBasedRoutesRetrySettings);
+
+ RetrySettings getPolicyBasedRouteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicyBasedRouteSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getPolicyBasedRouteSettings()
+ .setRetrySettings(getPolicyBasedRouteRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listPolicyBasedRoutesRetry = clientProperties.getListPolicyBasedRoutesRetry();
+ if (listPolicyBasedRoutesRetry != null) {
+ RetrySettings listPolicyBasedRoutesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPolicyBasedRoutesSettings().getRetrySettings(),
+ listPolicyBasedRoutesRetry);
+ clientSettingsBuilder
+ .listPolicyBasedRoutesSettings()
+ .setRetrySettings(listPolicyBasedRoutesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listPolicyBasedRoutes from properties.");
+ }
+ }
+ Retry getPolicyBasedRouteRetry = clientProperties.getGetPolicyBasedRouteRetry();
+ if (getPolicyBasedRouteRetry != null) {
+ RetrySettings getPolicyBasedRouteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicyBasedRouteSettings().getRetrySettings(),
+ getPolicyBasedRouteRetry);
+ clientSettingsBuilder
+ .getPolicyBasedRouteSettings()
+ .setRetrySettings(getPolicyBasedRouteRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getPolicyBasedRoute from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a PolicyBasedRoutingServiceClient bean configured with
+ * PolicyBasedRoutingServiceSettings.
+ *
+ * @param policyBasedRoutingServiceSettings settings to configure an instance of client bean.
+ * @return a {@link PolicyBasedRoutingServiceClient} bean configured with {@link
+ * PolicyBasedRoutingServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient(
+ PolicyBasedRoutingServiceSettings policyBasedRoutingServiceSettings) throws IOException {
+ return PolicyBasedRoutingServiceClient.create(policyBasedRoutingServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-policy-based-routing-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringProperties.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringProperties.java
new file mode 100644
index 0000000000..73f5e370ff
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/PolicyBasedRoutingServiceSpringProperties.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2022 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.networkconnectivity.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 PolicyBasedRoutingService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.networkconnectivity.v1.policy-based-routing-service")
+public class PolicyBasedRoutingServiceSpringProperties 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 listPolicyBasedRoutes. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPolicyBasedRoutesRetry;
+ /**
+ * Allow override of retry settings at method-level for getPolicyBasedRoute. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPolicyBasedRouteRetry;
+
+ @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 getListPolicyBasedRoutesRetry() {
+ return this.listPolicyBasedRoutesRetry;
+ }
+
+ public void setListPolicyBasedRoutesRetry(Retry listPolicyBasedRoutesRetry) {
+ this.listPolicyBasedRoutesRetry = listPolicyBasedRoutesRetry;
+ }
+
+ public Retry getGetPolicyBasedRouteRetry() {
+ return this.getPolicyBasedRouteRetry;
+ }
+
+ public void setGetPolicyBasedRouteRetry(Retry getPolicyBasedRouteRetry) {
+ this.getPolicyBasedRouteRetry = getPolicyBasedRouteRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/package-info.java
new file mode 100644
index 0000000000..1ab80a5b73
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/java/com/google/cloud/networkconnectivity/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for networkconnectivity. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.networkconnectivity.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..52636bd122
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.networkconnectivity.v1.hub-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud networkconnectivity/HubService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.networkconnectivity.v1.policy-based-routing-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud networkconnectivity/PolicyBasedRoutingService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..67785acb21
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-networkconnectivity-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.networkconnectivity.v1.spring.HubServiceSpringAutoConfiguration
+com.google.cloud.networkconnectivity.v1.spring.PolicyBasedRoutingServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-notebooks-spring-starter/pom.xml
new file mode 100644
index 0000000000..4cf38ab198
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ManagedNotebookServiceSpringProperties. 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 ManagedNotebookServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ManagedNotebookServiceSettings managedNotebookServiceSettings( + @Qualifier("defaultManagedNotebookServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ManagedNotebookServiceSettings.Builder clientSettingsBuilder = + ManagedNotebookServiceSettings.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 = + ManagedNotebookServiceSettings.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 listRuntimesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRuntimesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listRuntimesSettings().setRetrySettings(listRuntimesRetrySettings); + + RetrySettings getRuntimeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRuntimeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getRuntimeSettings().setRetrySettings(getRuntimeRetrySettings); + + RetrySettings refreshRuntimeTokenInternalRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.refreshRuntimeTokenInternalSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .refreshRuntimeTokenInternalSettings() + .setRetrySettings(refreshRuntimeTokenInternalRetrySettings); + + 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 listRuntimesRetry = clientProperties.getListRuntimesRetry(); + if (listRuntimesRetry != null) { + RetrySettings listRuntimesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listRuntimesSettings().getRetrySettings(), listRuntimesRetry); + clientSettingsBuilder.listRuntimesSettings().setRetrySettings(listRuntimesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listRuntimes from properties."); + } + } + Retry getRuntimeRetry = clientProperties.getGetRuntimeRetry(); + if (getRuntimeRetry != null) { + RetrySettings getRuntimeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getRuntimeSettings().getRetrySettings(), getRuntimeRetry); + clientSettingsBuilder.getRuntimeSettings().setRetrySettings(getRuntimeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getRuntime from properties."); + } + } + Retry refreshRuntimeTokenInternalRetry = clientProperties.getRefreshRuntimeTokenInternalRetry(); + if (refreshRuntimeTokenInternalRetry != null) { + RetrySettings refreshRuntimeTokenInternalRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.refreshRuntimeTokenInternalSettings().getRetrySettings(), + refreshRuntimeTokenInternalRetry); + clientSettingsBuilder + .refreshRuntimeTokenInternalSettings() + .setRetrySettings(refreshRuntimeTokenInternalRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for refreshRuntimeTokenInternal 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 ManagedNotebookServiceClient bean configured with ManagedNotebookServiceSettings. + * + * @param managedNotebookServiceSettings settings to configure an instance of client bean. + * @return a {@link ManagedNotebookServiceClient} bean configured with {@link + * ManagedNotebookServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ManagedNotebookServiceClient managedNotebookServiceClient( + ManagedNotebookServiceSettings managedNotebookServiceSettings) throws IOException { + return ManagedNotebookServiceClient.create(managedNotebookServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-managed-notebook-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/ManagedNotebookServiceSpringProperties.java b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/ManagedNotebookServiceSpringProperties.java new file mode 100644 index 0000000000..cfac94184d --- /dev/null +++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/ManagedNotebookServiceSpringProperties.java @@ -0,0 +1,176 @@ +/* + * Copyright 2022 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.notebooks.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 ManagedNotebookService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.notebooks.v1.managed-notebook-service") +public class ManagedNotebookServiceSpringProperties 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 listRuntimes. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listRuntimesRetry; + /** + * Allow override of retry settings at method-level for getRuntime. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getRuntimeRetry; + /** + * Allow override of retry settings at method-level for refreshRuntimeTokenInternal. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry refreshRuntimeTokenInternalRetry; + /** + * 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 getListRuntimesRetry() { + return this.listRuntimesRetry; + } + + public void setListRuntimesRetry(Retry listRuntimesRetry) { + this.listRuntimesRetry = listRuntimesRetry; + } + + public Retry getGetRuntimeRetry() { + return this.getRuntimeRetry; + } + + public void setGetRuntimeRetry(Retry getRuntimeRetry) { + this.getRuntimeRetry = getRuntimeRetry; + } + + public Retry getRefreshRuntimeTokenInternalRetry() { + return this.refreshRuntimeTokenInternalRetry; + } + + public void setRefreshRuntimeTokenInternalRetry(Retry refreshRuntimeTokenInternalRetry) { + this.refreshRuntimeTokenInternalRetry = refreshRuntimeTokenInternalRetry; + } + + 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-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..bd040371df --- /dev/null +++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringAutoConfiguration.java @@ -0,0 +1,449 @@ +/* + * Copyright 2022 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.notebooks.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.notebooks.v1.NotebookServiceClient; +import com.google.cloud.notebooks.v1.NotebookServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link NotebookServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in NotebookServiceSpringProperties. Method-level properties will take precedence over
+ * service-level properties if available, and client library defaults will be used if neither are
+ * specified.
+ *
+ * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings.
+ * @return a {@link NotebookServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public NotebookServiceSettings notebookServiceSettings(
+ @Qualifier("defaultNotebookServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ NotebookServiceSettings.Builder clientSettingsBuilder = NotebookServiceSettings.newBuilder();
+ clientSettingsBuilder
+ .setCredentialsProvider(this.credentialsProvider)
+ .setTransportChannelProvider(defaultTransportChannelProvider)
+ .setHeaderProvider(this.userAgentHeaderProvider());
+ if (this.clientProperties.getQuotaProjectId() != null) {
+ clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId());
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Quota project id set to "
+ + this.clientProperties.getQuotaProjectId()
+ + ", this overrides project id from credentials.");
+ }
+ }
+ if (this.clientProperties.getExecutorThreadCount() != null) {
+ ExecutorProvider executorProvider =
+ NotebookServiceSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+
+ RetrySettings updateInstanceMetadataItemsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInstanceMetadataItemsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateInstanceMetadataItemsSettings()
+ .setRetrySettings(updateInstanceMetadataItemsRetrySettings);
+
+ RetrySettings isInstanceUpgradeableRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.isInstanceUpgradeableSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .isInstanceUpgradeableSettings()
+ .setRetrySettings(isInstanceUpgradeableRetrySettings);
+
+ RetrySettings getInstanceHealthRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceHealthSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getInstanceHealthSettings()
+ .setRetrySettings(getInstanceHealthRetrySettings);
+
+ RetrySettings listEnvironmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listEnvironmentsSettings()
+ .setRetrySettings(listEnvironmentsRetrySettings);
+
+ RetrySettings getEnvironmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings);
+
+ RetrySettings listSchedulesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSchedulesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSchedulesSettings().setRetrySettings(listSchedulesRetrySettings);
+
+ RetrySettings getScheduleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScheduleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getScheduleSettings().setRetrySettings(getScheduleRetrySettings);
+
+ RetrySettings listExecutionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listExecutionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings);
+
+ RetrySettings getExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getExecutionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listInstancesRetry = clientProperties.getListInstancesRetry();
+ if (listInstancesRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInstances from properties.");
+ }
+ }
+ Retry getInstanceRetry = clientProperties.getGetInstanceRetry();
+ if (getInstanceRetry != null) {
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInstance from properties.");
+ }
+ }
+ Retry updateInstanceMetadataItemsRetry = clientProperties.getUpdateInstanceMetadataItemsRetry();
+ if (updateInstanceMetadataItemsRetry != null) {
+ RetrySettings updateInstanceMetadataItemsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInstanceMetadataItemsSettings().getRetrySettings(),
+ updateInstanceMetadataItemsRetry);
+ clientSettingsBuilder
+ .updateInstanceMetadataItemsSettings()
+ .setRetrySettings(updateInstanceMetadataItemsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateInstanceMetadataItems from properties.");
+ }
+ }
+ Retry isInstanceUpgradeableRetry = clientProperties.getIsInstanceUpgradeableRetry();
+ if (isInstanceUpgradeableRetry != null) {
+ RetrySettings isInstanceUpgradeableRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.isInstanceUpgradeableSettings().getRetrySettings(),
+ isInstanceUpgradeableRetry);
+ clientSettingsBuilder
+ .isInstanceUpgradeableSettings()
+ .setRetrySettings(isInstanceUpgradeableRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for isInstanceUpgradeable from properties.");
+ }
+ }
+ Retry getInstanceHealthRetry = clientProperties.getGetInstanceHealthRetry();
+ if (getInstanceHealthRetry != null) {
+ RetrySettings getInstanceHealthRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceHealthSettings().getRetrySettings(),
+ getInstanceHealthRetry);
+ clientSettingsBuilder
+ .getInstanceHealthSettings()
+ .setRetrySettings(getInstanceHealthRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getInstanceHealth from properties.");
+ }
+ }
+ Retry listEnvironmentsRetry = clientProperties.getListEnvironmentsRetry();
+ if (listEnvironmentsRetry != null) {
+ RetrySettings listEnvironmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(),
+ listEnvironmentsRetry);
+ clientSettingsBuilder
+ .listEnvironmentsSettings()
+ .setRetrySettings(listEnvironmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listEnvironments from properties.");
+ }
+ }
+ Retry getEnvironmentRetry = clientProperties.getGetEnvironmentRetry();
+ if (getEnvironmentRetry != null) {
+ RetrySettings getEnvironmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(),
+ getEnvironmentRetry);
+ clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEnvironment from properties.");
+ }
+ }
+ Retry listSchedulesRetry = clientProperties.getListSchedulesRetry();
+ if (listSchedulesRetry != null) {
+ RetrySettings listSchedulesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSchedulesSettings().getRetrySettings(), listSchedulesRetry);
+ clientSettingsBuilder.listSchedulesSettings().setRetrySettings(listSchedulesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSchedules from properties.");
+ }
+ }
+ Retry getScheduleRetry = clientProperties.getGetScheduleRetry();
+ if (getScheduleRetry != null) {
+ RetrySettings getScheduleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScheduleSettings().getRetrySettings(), getScheduleRetry);
+ clientSettingsBuilder.getScheduleSettings().setRetrySettings(getScheduleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSchedule from properties.");
+ }
+ }
+ Retry listExecutionsRetry = clientProperties.getListExecutionsRetry();
+ if (listExecutionsRetry != null) {
+ RetrySettings listExecutionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listExecutionsSettings().getRetrySettings(),
+ listExecutionsRetry);
+ clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listExecutions from properties.");
+ }
+ }
+ Retry getExecutionRetry = clientProperties.getGetExecutionRetry();
+ if (getExecutionRetry != null) {
+ RetrySettings getExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getExecutionSettings().getRetrySettings(), getExecutionRetry);
+ clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getExecution from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a NotebookServiceClient bean configured with NotebookServiceSettings.
+ *
+ * @param notebookServiceSettings settings to configure an instance of client bean.
+ * @return a {@link NotebookServiceClient} bean configured with {@link NotebookServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public NotebookServiceClient notebookServiceClient(
+ NotebookServiceSettings notebookServiceSettings) throws IOException {
+ return NotebookServiceClient.create(notebookServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-notebook-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringProperties.java b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringProperties.java
new file mode 100644
index 0000000000..a5a99c2aea
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/NotebookServiceSpringProperties.java
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2022 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.notebooks.v1.spring;
+
+import com.google.api.core.BetaApi;
+import com.google.cloud.spring.core.Credentials;
+import com.google.cloud.spring.core.CredentialsSupplier;
+import com.google.cloud.spring.core.Retry;
+import javax.annotation.Generated;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.NestedConfigurationProperty;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/** Provides default property values for NotebookService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.notebooks.v1.notebook-service")
+public class NotebookServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listInstances. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInstancesRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstance. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceRetry;
+ /**
+ * Allow override of retry settings at method-level for updateInstanceMetadataItems. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateInstanceMetadataItemsRetry;
+ /**
+ * Allow override of retry settings at method-level for isInstanceUpgradeable. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry isInstanceUpgradeableRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstanceHealth. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceHealthRetry;
+ /**
+ * Allow override of retry settings at method-level for listEnvironments. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listEnvironmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for getEnvironment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEnvironmentRetry;
+ /**
+ * Allow override of retry settings at method-level for listSchedules. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSchedulesRetry;
+ /**
+ * Allow override of retry settings at method-level for getSchedule. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getScheduleRetry;
+ /**
+ * Allow override of retry settings at method-level for listExecutions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listExecutionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getExecution. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getExecutionRetry;
+ /**
+ * 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 getListInstancesRetry() {
+ return this.listInstancesRetry;
+ }
+
+ public void setListInstancesRetry(Retry listInstancesRetry) {
+ this.listInstancesRetry = listInstancesRetry;
+ }
+
+ public Retry getGetInstanceRetry() {
+ return this.getInstanceRetry;
+ }
+
+ public void setGetInstanceRetry(Retry getInstanceRetry) {
+ this.getInstanceRetry = getInstanceRetry;
+ }
+
+ public Retry getUpdateInstanceMetadataItemsRetry() {
+ return this.updateInstanceMetadataItemsRetry;
+ }
+
+ public void setUpdateInstanceMetadataItemsRetry(Retry updateInstanceMetadataItemsRetry) {
+ this.updateInstanceMetadataItemsRetry = updateInstanceMetadataItemsRetry;
+ }
+
+ public Retry getIsInstanceUpgradeableRetry() {
+ return this.isInstanceUpgradeableRetry;
+ }
+
+ public void setIsInstanceUpgradeableRetry(Retry isInstanceUpgradeableRetry) {
+ this.isInstanceUpgradeableRetry = isInstanceUpgradeableRetry;
+ }
+
+ public Retry getGetInstanceHealthRetry() {
+ return this.getInstanceHealthRetry;
+ }
+
+ public void setGetInstanceHealthRetry(Retry getInstanceHealthRetry) {
+ this.getInstanceHealthRetry = getInstanceHealthRetry;
+ }
+
+ public Retry getListEnvironmentsRetry() {
+ return this.listEnvironmentsRetry;
+ }
+
+ public void setListEnvironmentsRetry(Retry listEnvironmentsRetry) {
+ this.listEnvironmentsRetry = listEnvironmentsRetry;
+ }
+
+ public Retry getGetEnvironmentRetry() {
+ return this.getEnvironmentRetry;
+ }
+
+ public void setGetEnvironmentRetry(Retry getEnvironmentRetry) {
+ this.getEnvironmentRetry = getEnvironmentRetry;
+ }
+
+ public Retry getListSchedulesRetry() {
+ return this.listSchedulesRetry;
+ }
+
+ public void setListSchedulesRetry(Retry listSchedulesRetry) {
+ this.listSchedulesRetry = listSchedulesRetry;
+ }
+
+ public Retry getGetScheduleRetry() {
+ return this.getScheduleRetry;
+ }
+
+ public void setGetScheduleRetry(Retry getScheduleRetry) {
+ this.getScheduleRetry = getScheduleRetry;
+ }
+
+ public Retry getListExecutionsRetry() {
+ return this.listExecutionsRetry;
+ }
+
+ public void setListExecutionsRetry(Retry listExecutionsRetry) {
+ this.listExecutionsRetry = listExecutionsRetry;
+ }
+
+ public Retry getGetExecutionRetry() {
+ return this.getExecutionRetry;
+ }
+
+ public void setGetExecutionRetry(Retry getExecutionRetry) {
+ this.getExecutionRetry = getExecutionRetry;
+ }
+
+ 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-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/package-info.java
new file mode 100644
index 0000000000..8fa73cba30
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/java/com/google/cloud/notebooks/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for notebooks. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.notebooks.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..bb6a8986fa
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.notebooks.v1.managed-notebook-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud notebooks/ManagedNotebookService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.notebooks.v1.notebook-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud notebooks/NotebookService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..2b361ee74a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-notebooks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.notebooks.v1.spring.ManagedNotebookServiceSpringAutoConfiguration
+com.google.cloud.notebooks.v1.spring.NotebookServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-optimization-spring-starter/pom.xml
new file mode 100644
index 0000000000..372070688d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in FleetRoutingSpringProperties. 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 FleetRoutingSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public FleetRoutingSettings fleetRoutingSettings(
+ @Qualifier("defaultFleetRoutingTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ FleetRoutingSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = FleetRoutingSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = FleetRoutingSettings.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 =
+ FleetRoutingSettings.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 optimizeToursRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.optimizeToursSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.optimizeToursSettings().setRetrySettings(optimizeToursRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry optimizeToursRetry = clientProperties.getOptimizeToursRetry();
+ if (optimizeToursRetry != null) {
+ RetrySettings optimizeToursRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.optimizeToursSettings().getRetrySettings(), optimizeToursRetry);
+ clientSettingsBuilder.optimizeToursSettings().setRetrySettings(optimizeToursRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for optimizeTours from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a FleetRoutingClient bean configured with FleetRoutingSettings.
+ *
+ * @param fleetRoutingSettings settings to configure an instance of client bean.
+ * @return a {@link FleetRoutingClient} bean configured with {@link FleetRoutingSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public FleetRoutingClient fleetRoutingClient(FleetRoutingSettings fleetRoutingSettings)
+ throws IOException {
+ return FleetRoutingClient.create(fleetRoutingSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-fleet-routing";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringProperties.java b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringProperties.java
new file mode 100644
index 0000000000..55ef5b2441
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/FleetRoutingSpringProperties.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2022 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.optimization.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 FleetRouting client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.optimization.v1.fleet-routing")
+public class FleetRoutingSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for optimizeTours. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry optimizeToursRetry;
+
+ @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 getOptimizeToursRetry() {
+ return this.optimizeToursRetry;
+ }
+
+ public void setOptimizeToursRetry(Retry optimizeToursRetry) {
+ this.optimizeToursRetry = optimizeToursRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/package-info.java
new file mode 100644
index 0000000000..85f1d496a2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/java/com/google/cloud/optimization/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudoptimization. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.optimization.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..9ca37aed79
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.optimization.v1.fleet-routing.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudoptimization/FleetRouting components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..ab5a815ebe
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-optimization-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.optimization.v1.spring.FleetRoutingSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/pom.xml
new file mode 100644
index 0000000000..88cbde5d38
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in EnvironmentsSpringProperties. 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 EnvironmentsSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EnvironmentsSettings environmentsSettings( + @Qualifier("defaultEnvironmentsTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EnvironmentsSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EnvironmentsSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EnvironmentsSettings.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 = + EnvironmentsSettings.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 getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + + RetrySettings listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry getEnvironmentRetry = clientProperties.getGetEnvironmentRetry(); + if (getEnvironmentRetry != null) { + RetrySettings getEnvironmentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), + getEnvironmentRetry); + clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getEnvironment from properties."); + } + } + Retry listEnvironmentsRetry = clientProperties.getListEnvironmentsRetry(); + if (listEnvironmentsRetry != null) { + RetrySettings listEnvironmentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listEnvironmentsSettings().getRetrySettings(), + listEnvironmentsRetry); + clientSettingsBuilder + .listEnvironmentsSettings() + .setRetrySettings(listEnvironmentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listEnvironments from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a EnvironmentsClient bean configured with EnvironmentsSettings. + * + * @param environmentsSettings settings to configure an instance of client bean. + * @return a {@link EnvironmentsClient} bean configured with {@link EnvironmentsSettings} + */ + @Bean + @ConditionalOnMissingBean + public EnvironmentsClient environmentsClient(EnvironmentsSettings environmentsSettings) + throws IOException { + return EnvironmentsClient.create(environmentsSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-environments"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringProperties.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringProperties.java new file mode 100644 index 0000000000..f71a571dad --- /dev/null +++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/EnvironmentsSpringProperties.java @@ -0,0 +1,108 @@ +/* + * Copyright 2022 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.orchestration.airflow.service.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 Environments client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.orchestration.airflow.service.v1.environments") +public class EnvironmentsSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for getEnvironment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEnvironmentRetry; + /** + * Allow override of retry settings at method-level for listEnvironments. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listEnvironmentsRetry; + + @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 getGetEnvironmentRetry() { + return this.getEnvironmentRetry; + } + + public void setGetEnvironmentRetry(Retry getEnvironmentRetry) { + this.getEnvironmentRetry = getEnvironmentRetry; + } + + public Retry getListEnvironmentsRetry() { + return this.listEnvironmentsRetry; + } + + public void setListEnvironmentsRetry(Retry listEnvironmentsRetry) { + this.listEnvironmentsRetry = listEnvironmentsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java new file mode 100644 index 0000000000..def1a55ac2 --- /dev/null +++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringAutoConfiguration.java @@ -0,0 +1,207 @@ +/* + * Copyright 2022 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.orchestration.airflow.service.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.orchestration.airflow.service.v1.ImageVersionsClient; +import com.google.cloud.orchestration.airflow.service.v1.ImageVersionsSettings; +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 ImageVersionsClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ImageVersionsSpringProperties. 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 ImageVersionsSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ImageVersionsSettings imageVersionsSettings(
+ @Qualifier("defaultImageVersionsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ImageVersionsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ImageVersionsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ImageVersionsSettings.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 =
+ ImageVersionsSettings.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 listImageVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listImageVersionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listImageVersionsSettings()
+ .setRetrySettings(listImageVersionsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listImageVersionsRetry = clientProperties.getListImageVersionsRetry();
+ if (listImageVersionsRetry != null) {
+ RetrySettings listImageVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listImageVersionsSettings().getRetrySettings(),
+ listImageVersionsRetry);
+ clientSettingsBuilder
+ .listImageVersionsSettings()
+ .setRetrySettings(listImageVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listImageVersions from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ImageVersionsClient bean configured with ImageVersionsSettings.
+ *
+ * @param imageVersionsSettings settings to configure an instance of client bean.
+ * @return a {@link ImageVersionsClient} bean configured with {@link ImageVersionsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ImageVersionsClient imageVersionsClient(ImageVersionsSettings imageVersionsSettings)
+ throws IOException {
+ return ImageVersionsClient.create(imageVersionsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-image-versions";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringProperties.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringProperties.java
new file mode 100644
index 0000000000..d2c4180479
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/ImageVersionsSpringProperties.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2022 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.orchestration.airflow.service.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 ImageVersions client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.orchestration.airflow.service.v1.image-versions")
+public class ImageVersionsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listImageVersions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listImageVersionsRetry;
+
+ @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 getListImageVersionsRetry() {
+ return this.listImageVersionsRetry;
+ }
+
+ public void setListImageVersionsRetry(Retry listImageVersionsRetry) {
+ this.listImageVersionsRetry = listImageVersionsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/package-info.java
new file mode 100644
index 0000000000..19220adb3a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/java/com/google/cloud/orchestration/airflow/service/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for composer. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.orchestration.airflow.service.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..0b467b9e97
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.orchestration.airflow.service.v1.environments.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud composer/Environments components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.orchestration.airflow.service.v1.image-versions.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud composer/ImageVersions components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..012d6877c2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orchestration-airflow-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.orchestration.airflow.service.v1.spring.EnvironmentsSpringAutoConfiguration
+com.google.cloud.orchestration.airflow.service.v1.spring.ImageVersionsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/pom.xml
new file mode 100644
index 0000000000..09d476a751
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in OrgPolicySpringProperties. 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 OrgPolicySettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OrgPolicySettings orgPolicySettings(
+ @Qualifier("defaultOrgPolicyTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ OrgPolicySettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = OrgPolicySettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = OrgPolicySettings.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 =
+ OrgPolicySettings.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 listConstraintsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConstraintsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listConstraintsSettings()
+ .setRetrySettings(listConstraintsRetrySettings);
+
+ RetrySettings listPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPoliciesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listPoliciesSettings().setRetrySettings(listPoliciesRetrySettings);
+
+ RetrySettings getPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getPolicySettings().setRetrySettings(getPolicyRetrySettings);
+
+ RetrySettings getEffectivePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEffectivePolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getEffectivePolicySettings()
+ .setRetrySettings(getEffectivePolicyRetrySettings);
+
+ RetrySettings createPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createPolicySettings().setRetrySettings(createPolicyRetrySettings);
+
+ RetrySettings updatePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updatePolicySettings().setRetrySettings(updatePolicyRetrySettings);
+
+ RetrySettings deletePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deletePolicySettings().setRetrySettings(deletePolicyRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listConstraintsRetry = clientProperties.getListConstraintsRetry();
+ if (listConstraintsRetry != null) {
+ RetrySettings listConstraintsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConstraintsSettings().getRetrySettings(),
+ listConstraintsRetry);
+ clientSettingsBuilder
+ .listConstraintsSettings()
+ .setRetrySettings(listConstraintsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listConstraints from properties.");
+ }
+ }
+ Retry listPoliciesRetry = clientProperties.getListPoliciesRetry();
+ if (listPoliciesRetry != null) {
+ RetrySettings listPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPoliciesSettings().getRetrySettings(), listPoliciesRetry);
+ clientSettingsBuilder.listPoliciesSettings().setRetrySettings(listPoliciesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listPolicies from properties.");
+ }
+ }
+ Retry getPolicyRetry = clientProperties.getGetPolicyRetry();
+ if (getPolicyRetry != null) {
+ RetrySettings getPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPolicySettings().getRetrySettings(), getPolicyRetry);
+ clientSettingsBuilder.getPolicySettings().setRetrySettings(getPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getPolicy from properties.");
+ }
+ }
+ Retry getEffectivePolicyRetry = clientProperties.getGetEffectivePolicyRetry();
+ if (getEffectivePolicyRetry != null) {
+ RetrySettings getEffectivePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEffectivePolicySettings().getRetrySettings(),
+ getEffectivePolicyRetry);
+ clientSettingsBuilder
+ .getEffectivePolicySettings()
+ .setRetrySettings(getEffectivePolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getEffectivePolicy from properties.");
+ }
+ }
+ Retry createPolicyRetry = clientProperties.getCreatePolicyRetry();
+ if (createPolicyRetry != null) {
+ RetrySettings createPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createPolicySettings().getRetrySettings(), createPolicyRetry);
+ clientSettingsBuilder.createPolicySettings().setRetrySettings(createPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createPolicy from properties.");
+ }
+ }
+ Retry updatePolicyRetry = clientProperties.getUpdatePolicyRetry();
+ if (updatePolicyRetry != null) {
+ RetrySettings updatePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updatePolicySettings().getRetrySettings(), updatePolicyRetry);
+ clientSettingsBuilder.updatePolicySettings().setRetrySettings(updatePolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updatePolicy from properties.");
+ }
+ }
+ Retry deletePolicyRetry = clientProperties.getDeletePolicyRetry();
+ if (deletePolicyRetry != null) {
+ RetrySettings deletePolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePolicySettings().getRetrySettings(), deletePolicyRetry);
+ clientSettingsBuilder.deletePolicySettings().setRetrySettings(deletePolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deletePolicy from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a OrgPolicyClient bean configured with OrgPolicySettings.
+ *
+ * @param orgPolicySettings settings to configure an instance of client bean.
+ * @return a {@link OrgPolicyClient} bean configured with {@link OrgPolicySettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OrgPolicyClient orgPolicyClient(OrgPolicySettings orgPolicySettings) throws IOException {
+ return OrgPolicyClient.create(orgPolicySettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-org-policy";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
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
new file mode 100644
index 0000000000..592df0275e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/OrgPolicySpringProperties.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2022 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.orgpolicy.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 OrgPolicy client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.orgpolicy.v2.org-policy")
+public class OrgPolicySpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listConstraints. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConstraintsRetry;
+ /**
+ * Allow override of retry settings at method-level for listPolicies. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPoliciesRetry;
+ /**
+ * Allow override of retry settings at method-level for getPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getEffectivePolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEffectivePolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for createPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for updatePolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updatePolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for deletePolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deletePolicyRetry;
+
+ @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 getListConstraintsRetry() {
+ return this.listConstraintsRetry;
+ }
+
+ public void setListConstraintsRetry(Retry listConstraintsRetry) {
+ this.listConstraintsRetry = listConstraintsRetry;
+ }
+
+ public Retry getListPoliciesRetry() {
+ return this.listPoliciesRetry;
+ }
+
+ public void setListPoliciesRetry(Retry listPoliciesRetry) {
+ this.listPoliciesRetry = listPoliciesRetry;
+ }
+
+ public Retry getGetPolicyRetry() {
+ return this.getPolicyRetry;
+ }
+
+ public void setGetPolicyRetry(Retry getPolicyRetry) {
+ this.getPolicyRetry = getPolicyRetry;
+ }
+
+ public Retry getGetEffectivePolicyRetry() {
+ return this.getEffectivePolicyRetry;
+ }
+
+ public void setGetEffectivePolicyRetry(Retry getEffectivePolicyRetry) {
+ this.getEffectivePolicyRetry = getEffectivePolicyRetry;
+ }
+
+ public Retry getCreatePolicyRetry() {
+ return this.createPolicyRetry;
+ }
+
+ public void setCreatePolicyRetry(Retry createPolicyRetry) {
+ this.createPolicyRetry = createPolicyRetry;
+ }
+
+ public Retry getUpdatePolicyRetry() {
+ return this.updatePolicyRetry;
+ }
+
+ public void setUpdatePolicyRetry(Retry updatePolicyRetry) {
+ this.updatePolicyRetry = updatePolicyRetry;
+ }
+
+ public Retry getDeletePolicyRetry() {
+ return this.deletePolicyRetry;
+ }
+
+ public void setDeletePolicyRetry(Retry deletePolicyRetry) {
+ this.deletePolicyRetry = deletePolicyRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/package-info.java
new file mode 100644
index 0000000000..57cace2fea
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/java/com/google/cloud/orgpolicy/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for orgpolicy. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.orgpolicy.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..82fe887281
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.orgpolicy.v2.org-policy.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud orgpolicy/OrgPolicy components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1024414d4c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-orgpolicy-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.orgpolicy.v2.spring.OrgPolicySpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-os-config-spring-starter/pom.xml
new file mode 100644
index 0000000000..3a41d0132e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in OsConfigServiceSpringProperties. 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 OsConfigServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public OsConfigServiceSettings osConfigServiceSettings( + @Qualifier("defaultOsConfigServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + OsConfigServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = OsConfigServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = OsConfigServiceSettings.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 = + OsConfigServiceSettings.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 executePatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.executePatchJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .executePatchJobSettings() + .setRetrySettings(executePatchJobRetrySettings); + + RetrySettings getPatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPatchJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getPatchJobSettings().setRetrySettings(getPatchJobRetrySettings); + + RetrySettings cancelPatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelPatchJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.cancelPatchJobSettings().setRetrySettings(cancelPatchJobRetrySettings); + + RetrySettings listPatchJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listPatchJobsSettings().setRetrySettings(listPatchJobsRetrySettings); + + RetrySettings listPatchJobInstanceDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchJobInstanceDetailsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPatchJobInstanceDetailsSettings() + .setRetrySettings(listPatchJobInstanceDetailsRetrySettings); + + RetrySettings createPatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createPatchDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .createPatchDeploymentSettings() + .setRetrySettings(createPatchDeploymentRetrySettings); + + RetrySettings getPatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPatchDeploymentSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getPatchDeploymentSettings() + .setRetrySettings(getPatchDeploymentRetrySettings); + + RetrySettings listPatchDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchDeploymentsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listPatchDeploymentsSettings() + .setRetrySettings(listPatchDeploymentsRetrySettings); + + RetrySettings deletePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deletePatchDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .deletePatchDeploymentSettings() + .setRetrySettings(deletePatchDeploymentRetrySettings); + + RetrySettings updatePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updatePatchDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updatePatchDeploymentSettings() + .setRetrySettings(updatePatchDeploymentRetrySettings); + + RetrySettings pausePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.pausePatchDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .pausePatchDeploymentSettings() + .setRetrySettings(pausePatchDeploymentRetrySettings); + + RetrySettings resumePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resumePatchDeploymentSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .resumePatchDeploymentSettings() + .setRetrySettings(resumePatchDeploymentRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry executePatchJobRetry = clientProperties.getExecutePatchJobRetry(); + if (executePatchJobRetry != null) { + RetrySettings executePatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.executePatchJobSettings().getRetrySettings(), + executePatchJobRetry); + clientSettingsBuilder + .executePatchJobSettings() + .setRetrySettings(executePatchJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for executePatchJob from properties."); + } + } + Retry getPatchJobRetry = clientProperties.getGetPatchJobRetry(); + if (getPatchJobRetry != null) { + RetrySettings getPatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPatchJobSettings().getRetrySettings(), getPatchJobRetry); + clientSettingsBuilder.getPatchJobSettings().setRetrySettings(getPatchJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getPatchJob from properties."); + } + } + Retry cancelPatchJobRetry = clientProperties.getCancelPatchJobRetry(); + if (cancelPatchJobRetry != null) { + RetrySettings cancelPatchJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.cancelPatchJobSettings().getRetrySettings(), + cancelPatchJobRetry); + clientSettingsBuilder.cancelPatchJobSettings().setRetrySettings(cancelPatchJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for cancelPatchJob from properties."); + } + } + Retry listPatchJobsRetry = clientProperties.getListPatchJobsRetry(); + if (listPatchJobsRetry != null) { + RetrySettings listPatchJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchJobsSettings().getRetrySettings(), listPatchJobsRetry); + clientSettingsBuilder.listPatchJobsSettings().setRetrySettings(listPatchJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listPatchJobs from properties."); + } + } + Retry listPatchJobInstanceDetailsRetry = clientProperties.getListPatchJobInstanceDetailsRetry(); + if (listPatchJobInstanceDetailsRetry != null) { + RetrySettings listPatchJobInstanceDetailsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchJobInstanceDetailsSettings().getRetrySettings(), + listPatchJobInstanceDetailsRetry); + clientSettingsBuilder + .listPatchJobInstanceDetailsSettings() + .setRetrySettings(listPatchJobInstanceDetailsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPatchJobInstanceDetails from properties."); + } + } + Retry createPatchDeploymentRetry = clientProperties.getCreatePatchDeploymentRetry(); + if (createPatchDeploymentRetry != null) { + RetrySettings createPatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createPatchDeploymentSettings().getRetrySettings(), + createPatchDeploymentRetry); + clientSettingsBuilder + .createPatchDeploymentSettings() + .setRetrySettings(createPatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createPatchDeployment from properties."); + } + } + Retry getPatchDeploymentRetry = clientProperties.getGetPatchDeploymentRetry(); + if (getPatchDeploymentRetry != null) { + RetrySettings getPatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getPatchDeploymentSettings().getRetrySettings(), + getPatchDeploymentRetry); + clientSettingsBuilder + .getPatchDeploymentSettings() + .setRetrySettings(getPatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getPatchDeployment from properties."); + } + } + Retry listPatchDeploymentsRetry = clientProperties.getListPatchDeploymentsRetry(); + if (listPatchDeploymentsRetry != null) { + RetrySettings listPatchDeploymentsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listPatchDeploymentsSettings().getRetrySettings(), + listPatchDeploymentsRetry); + clientSettingsBuilder + .listPatchDeploymentsSettings() + .setRetrySettings(listPatchDeploymentsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listPatchDeployments from properties."); + } + } + Retry deletePatchDeploymentRetry = clientProperties.getDeletePatchDeploymentRetry(); + if (deletePatchDeploymentRetry != null) { + RetrySettings deletePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deletePatchDeploymentSettings().getRetrySettings(), + deletePatchDeploymentRetry); + clientSettingsBuilder + .deletePatchDeploymentSettings() + .setRetrySettings(deletePatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deletePatchDeployment from properties."); + } + } + Retry updatePatchDeploymentRetry = clientProperties.getUpdatePatchDeploymentRetry(); + if (updatePatchDeploymentRetry != null) { + RetrySettings updatePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updatePatchDeploymentSettings().getRetrySettings(), + updatePatchDeploymentRetry); + clientSettingsBuilder + .updatePatchDeploymentSettings() + .setRetrySettings(updatePatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updatePatchDeployment from properties."); + } + } + Retry pausePatchDeploymentRetry = clientProperties.getPausePatchDeploymentRetry(); + if (pausePatchDeploymentRetry != null) { + RetrySettings pausePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.pausePatchDeploymentSettings().getRetrySettings(), + pausePatchDeploymentRetry); + clientSettingsBuilder + .pausePatchDeploymentSettings() + .setRetrySettings(pausePatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for pausePatchDeployment from properties."); + } + } + Retry resumePatchDeploymentRetry = clientProperties.getResumePatchDeploymentRetry(); + if (resumePatchDeploymentRetry != null) { + RetrySettings resumePatchDeploymentRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resumePatchDeploymentSettings().getRetrySettings(), + resumePatchDeploymentRetry); + clientSettingsBuilder + .resumePatchDeploymentSettings() + .setRetrySettings(resumePatchDeploymentRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for resumePatchDeployment from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a OsConfigServiceClient bean configured with OsConfigServiceSettings. + * + * @param osConfigServiceSettings settings to configure an instance of client bean. + * @return a {@link OsConfigServiceClient} bean configured with {@link OsConfigServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public OsConfigServiceClient osConfigServiceClient( + OsConfigServiceSettings osConfigServiceSettings) throws IOException { + return OsConfigServiceClient.create(osConfigServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-os-config-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringProperties.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringProperties.java new file mode 100644 index 0000000000..224c329774 --- /dev/null +++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigServiceSpringProperties.java @@ -0,0 +1,238 @@ +/* + * Copyright 2022 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.osconfig.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 OsConfigService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.osconfig.v1.os-config-service") +public class OsConfigServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for executePatchJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry executePatchJobRetry; + /** + * Allow override of retry settings at method-level for getPatchJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPatchJobRetry; + /** + * Allow override of retry settings at method-level for cancelPatchJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry cancelPatchJobRetry; + /** + * Allow override of retry settings at method-level for listPatchJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPatchJobsRetry; + /** + * Allow override of retry settings at method-level for listPatchJobInstanceDetails. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPatchJobInstanceDetailsRetry; + /** + * Allow override of retry settings at method-level for createPatchDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createPatchDeploymentRetry; + /** + * Allow override of retry settings at method-level for getPatchDeployment. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getPatchDeploymentRetry; + /** + * Allow override of retry settings at method-level for listPatchDeployments. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listPatchDeploymentsRetry; + /** + * Allow override of retry settings at method-level for deletePatchDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deletePatchDeploymentRetry; + /** + * Allow override of retry settings at method-level for updatePatchDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updatePatchDeploymentRetry; + /** + * Allow override of retry settings at method-level for pausePatchDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry pausePatchDeploymentRetry; + /** + * Allow override of retry settings at method-level for resumePatchDeployment. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry resumePatchDeploymentRetry; + + @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 getExecutePatchJobRetry() { + return this.executePatchJobRetry; + } + + public void setExecutePatchJobRetry(Retry executePatchJobRetry) { + this.executePatchJobRetry = executePatchJobRetry; + } + + public Retry getGetPatchJobRetry() { + return this.getPatchJobRetry; + } + + public void setGetPatchJobRetry(Retry getPatchJobRetry) { + this.getPatchJobRetry = getPatchJobRetry; + } + + public Retry getCancelPatchJobRetry() { + return this.cancelPatchJobRetry; + } + + public void setCancelPatchJobRetry(Retry cancelPatchJobRetry) { + this.cancelPatchJobRetry = cancelPatchJobRetry; + } + + public Retry getListPatchJobsRetry() { + return this.listPatchJobsRetry; + } + + public void setListPatchJobsRetry(Retry listPatchJobsRetry) { + this.listPatchJobsRetry = listPatchJobsRetry; + } + + public Retry getListPatchJobInstanceDetailsRetry() { + return this.listPatchJobInstanceDetailsRetry; + } + + public void setListPatchJobInstanceDetailsRetry(Retry listPatchJobInstanceDetailsRetry) { + this.listPatchJobInstanceDetailsRetry = listPatchJobInstanceDetailsRetry; + } + + public Retry getCreatePatchDeploymentRetry() { + return this.createPatchDeploymentRetry; + } + + public void setCreatePatchDeploymentRetry(Retry createPatchDeploymentRetry) { + this.createPatchDeploymentRetry = createPatchDeploymentRetry; + } + + public Retry getGetPatchDeploymentRetry() { + return this.getPatchDeploymentRetry; + } + + public void setGetPatchDeploymentRetry(Retry getPatchDeploymentRetry) { + this.getPatchDeploymentRetry = getPatchDeploymentRetry; + } + + public Retry getListPatchDeploymentsRetry() { + return this.listPatchDeploymentsRetry; + } + + public void setListPatchDeploymentsRetry(Retry listPatchDeploymentsRetry) { + this.listPatchDeploymentsRetry = listPatchDeploymentsRetry; + } + + public Retry getDeletePatchDeploymentRetry() { + return this.deletePatchDeploymentRetry; + } + + public void setDeletePatchDeploymentRetry(Retry deletePatchDeploymentRetry) { + this.deletePatchDeploymentRetry = deletePatchDeploymentRetry; + } + + public Retry getUpdatePatchDeploymentRetry() { + return this.updatePatchDeploymentRetry; + } + + public void setUpdatePatchDeploymentRetry(Retry updatePatchDeploymentRetry) { + this.updatePatchDeploymentRetry = updatePatchDeploymentRetry; + } + + public Retry getPausePatchDeploymentRetry() { + return this.pausePatchDeploymentRetry; + } + + public void setPausePatchDeploymentRetry(Retry pausePatchDeploymentRetry) { + this.pausePatchDeploymentRetry = pausePatchDeploymentRetry; + } + + public Retry getResumePatchDeploymentRetry() { + return this.resumePatchDeploymentRetry; + } + + public void setResumePatchDeploymentRetry(Retry resumePatchDeploymentRetry) { + this.resumePatchDeploymentRetry = resumePatchDeploymentRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..b3320ceae8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringAutoConfiguration.java @@ -0,0 +1,380 @@ +/* + * Copyright 2022 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.osconfig.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.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceSettings; +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 OsConfigZonalServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in OsConfigZonalServiceSpringProperties. 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 OsConfigZonalServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OsConfigZonalServiceSettings osConfigZonalServiceSettings(
+ @Qualifier("defaultOsConfigZonalServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ OsConfigZonalServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = OsConfigZonalServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = OsConfigZonalServiceSettings.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 =
+ OsConfigZonalServiceSettings.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 getOSPolicyAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOSPolicyAssignmentSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getOSPolicyAssignmentSettings()
+ .setRetrySettings(getOSPolicyAssignmentRetrySettings);
+
+ RetrySettings listOSPolicyAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentsSettings()
+ .setRetrySettings(listOSPolicyAssignmentsRetrySettings);
+
+ RetrySettings listOSPolicyAssignmentRevisionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentRevisionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentRevisionsSettings()
+ .setRetrySettings(listOSPolicyAssignmentRevisionsRetrySettings);
+
+ RetrySettings getOSPolicyAssignmentReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOSPolicyAssignmentReportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getOSPolicyAssignmentReportSettings()
+ .setRetrySettings(getOSPolicyAssignmentReportRetrySettings);
+
+ RetrySettings listOSPolicyAssignmentReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentReportsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentReportsSettings()
+ .setRetrySettings(listOSPolicyAssignmentReportsRetrySettings);
+
+ RetrySettings getInventoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInventorySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInventorySettings().setRetrySettings(getInventoryRetrySettings);
+
+ RetrySettings listInventoriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInventoriesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listInventoriesSettings()
+ .setRetrySettings(listInventoriesRetrySettings);
+
+ RetrySettings getVulnerabilityReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVulnerabilityReportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getVulnerabilityReportSettings()
+ .setRetrySettings(getVulnerabilityReportRetrySettings);
+
+ RetrySettings listVulnerabilityReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVulnerabilityReportsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listVulnerabilityReportsSettings()
+ .setRetrySettings(listVulnerabilityReportsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getOSPolicyAssignmentRetry = clientProperties.getGetOSPolicyAssignmentRetry();
+ if (getOSPolicyAssignmentRetry != null) {
+ RetrySettings getOSPolicyAssignmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOSPolicyAssignmentSettings().getRetrySettings(),
+ getOSPolicyAssignmentRetry);
+ clientSettingsBuilder
+ .getOSPolicyAssignmentSettings()
+ .setRetrySettings(getOSPolicyAssignmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getOSPolicyAssignment from properties.");
+ }
+ }
+ Retry listOSPolicyAssignmentsRetry = clientProperties.getListOSPolicyAssignmentsRetry();
+ if (listOSPolicyAssignmentsRetry != null) {
+ RetrySettings listOSPolicyAssignmentsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentsSettings().getRetrySettings(),
+ listOSPolicyAssignmentsRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentsSettings()
+ .setRetrySettings(listOSPolicyAssignmentsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listOSPolicyAssignments from properties.");
+ }
+ }
+ Retry listOSPolicyAssignmentRevisionsRetry =
+ clientProperties.getListOSPolicyAssignmentRevisionsRetry();
+ if (listOSPolicyAssignmentRevisionsRetry != null) {
+ RetrySettings listOSPolicyAssignmentRevisionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentRevisionsSettings().getRetrySettings(),
+ listOSPolicyAssignmentRevisionsRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentRevisionsSettings()
+ .setRetrySettings(listOSPolicyAssignmentRevisionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listOSPolicyAssignmentRevisions from properties.");
+ }
+ }
+ Retry getOSPolicyAssignmentReportRetry = clientProperties.getGetOSPolicyAssignmentReportRetry();
+ if (getOSPolicyAssignmentReportRetry != null) {
+ RetrySettings getOSPolicyAssignmentReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOSPolicyAssignmentReportSettings().getRetrySettings(),
+ getOSPolicyAssignmentReportRetry);
+ clientSettingsBuilder
+ .getOSPolicyAssignmentReportSettings()
+ .setRetrySettings(getOSPolicyAssignmentReportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getOSPolicyAssignmentReport from properties.");
+ }
+ }
+ Retry listOSPolicyAssignmentReportsRetry =
+ clientProperties.getListOSPolicyAssignmentReportsRetry();
+ if (listOSPolicyAssignmentReportsRetry != null) {
+ RetrySettings listOSPolicyAssignmentReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listOSPolicyAssignmentReportsSettings().getRetrySettings(),
+ listOSPolicyAssignmentReportsRetry);
+ clientSettingsBuilder
+ .listOSPolicyAssignmentReportsSettings()
+ .setRetrySettings(listOSPolicyAssignmentReportsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listOSPolicyAssignmentReports from properties.");
+ }
+ }
+ Retry getInventoryRetry = clientProperties.getGetInventoryRetry();
+ if (getInventoryRetry != null) {
+ RetrySettings getInventoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInventorySettings().getRetrySettings(), getInventoryRetry);
+ clientSettingsBuilder.getInventorySettings().setRetrySettings(getInventoryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInventory from properties.");
+ }
+ }
+ Retry listInventoriesRetry = clientProperties.getListInventoriesRetry();
+ if (listInventoriesRetry != null) {
+ RetrySettings listInventoriesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInventoriesSettings().getRetrySettings(),
+ listInventoriesRetry);
+ clientSettingsBuilder
+ .listInventoriesSettings()
+ .setRetrySettings(listInventoriesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInventories from properties.");
+ }
+ }
+ Retry getVulnerabilityReportRetry = clientProperties.getGetVulnerabilityReportRetry();
+ if (getVulnerabilityReportRetry != null) {
+ RetrySettings getVulnerabilityReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getVulnerabilityReportSettings().getRetrySettings(),
+ getVulnerabilityReportRetry);
+ clientSettingsBuilder
+ .getVulnerabilityReportSettings()
+ .setRetrySettings(getVulnerabilityReportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getVulnerabilityReport from properties.");
+ }
+ }
+ Retry listVulnerabilityReportsRetry = clientProperties.getListVulnerabilityReportsRetry();
+ if (listVulnerabilityReportsRetry != null) {
+ RetrySettings listVulnerabilityReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVulnerabilityReportsSettings().getRetrySettings(),
+ listVulnerabilityReportsRetry);
+ clientSettingsBuilder
+ .listVulnerabilityReportsSettings()
+ .setRetrySettings(listVulnerabilityReportsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listVulnerabilityReports from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a OsConfigZonalServiceClient bean configured with OsConfigZonalServiceSettings.
+ *
+ * @param osConfigZonalServiceSettings settings to configure an instance of client bean.
+ * @return a {@link OsConfigZonalServiceClient} bean configured with {@link
+ * OsConfigZonalServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OsConfigZonalServiceClient osConfigZonalServiceClient(
+ OsConfigZonalServiceSettings osConfigZonalServiceSettings) throws IOException {
+ return OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-os-config-zonal-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringProperties.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringProperties.java
new file mode 100644
index 0000000000..fc064b0f6a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/OsConfigZonalServiceSpringProperties.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2022 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.osconfig.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 OsConfigZonalService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.osconfig.v1.os-config-zonal-service")
+public class OsConfigZonalServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getOSPolicyAssignment. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getOSPolicyAssignmentRetry;
+ /**
+ * Allow override of retry settings at method-level for listOSPolicyAssignments. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOSPolicyAssignmentsRetry;
+ /**
+ * Allow override of retry settings at method-level for listOSPolicyAssignmentRevisions. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOSPolicyAssignmentRevisionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getOSPolicyAssignmentReport. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getOSPolicyAssignmentReportRetry;
+ /**
+ * Allow override of retry settings at method-level for listOSPolicyAssignmentReports. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listOSPolicyAssignmentReportsRetry;
+ /**
+ * Allow override of retry settings at method-level for getInventory. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInventoryRetry;
+ /**
+ * Allow override of retry settings at method-level for listInventories. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInventoriesRetry;
+ /**
+ * Allow override of retry settings at method-level for getVulnerabilityReport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getVulnerabilityReportRetry;
+ /**
+ * Allow override of retry settings at method-level for listVulnerabilityReports. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listVulnerabilityReportsRetry;
+
+ @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 getGetOSPolicyAssignmentRetry() {
+ return this.getOSPolicyAssignmentRetry;
+ }
+
+ public void setGetOSPolicyAssignmentRetry(Retry getOSPolicyAssignmentRetry) {
+ this.getOSPolicyAssignmentRetry = getOSPolicyAssignmentRetry;
+ }
+
+ public Retry getListOSPolicyAssignmentsRetry() {
+ return this.listOSPolicyAssignmentsRetry;
+ }
+
+ public void setListOSPolicyAssignmentsRetry(Retry listOSPolicyAssignmentsRetry) {
+ this.listOSPolicyAssignmentsRetry = listOSPolicyAssignmentsRetry;
+ }
+
+ public Retry getListOSPolicyAssignmentRevisionsRetry() {
+ return this.listOSPolicyAssignmentRevisionsRetry;
+ }
+
+ public void setListOSPolicyAssignmentRevisionsRetry(Retry listOSPolicyAssignmentRevisionsRetry) {
+ this.listOSPolicyAssignmentRevisionsRetry = listOSPolicyAssignmentRevisionsRetry;
+ }
+
+ public Retry getGetOSPolicyAssignmentReportRetry() {
+ return this.getOSPolicyAssignmentReportRetry;
+ }
+
+ public void setGetOSPolicyAssignmentReportRetry(Retry getOSPolicyAssignmentReportRetry) {
+ this.getOSPolicyAssignmentReportRetry = getOSPolicyAssignmentReportRetry;
+ }
+
+ public Retry getListOSPolicyAssignmentReportsRetry() {
+ return this.listOSPolicyAssignmentReportsRetry;
+ }
+
+ public void setListOSPolicyAssignmentReportsRetry(Retry listOSPolicyAssignmentReportsRetry) {
+ this.listOSPolicyAssignmentReportsRetry = listOSPolicyAssignmentReportsRetry;
+ }
+
+ public Retry getGetInventoryRetry() {
+ return this.getInventoryRetry;
+ }
+
+ public void setGetInventoryRetry(Retry getInventoryRetry) {
+ this.getInventoryRetry = getInventoryRetry;
+ }
+
+ public Retry getListInventoriesRetry() {
+ return this.listInventoriesRetry;
+ }
+
+ public void setListInventoriesRetry(Retry listInventoriesRetry) {
+ this.listInventoriesRetry = listInventoriesRetry;
+ }
+
+ public Retry getGetVulnerabilityReportRetry() {
+ return this.getVulnerabilityReportRetry;
+ }
+
+ public void setGetVulnerabilityReportRetry(Retry getVulnerabilityReportRetry) {
+ this.getVulnerabilityReportRetry = getVulnerabilityReportRetry;
+ }
+
+ public Retry getListVulnerabilityReportsRetry() {
+ return this.listVulnerabilityReportsRetry;
+ }
+
+ public void setListVulnerabilityReportsRetry(Retry listVulnerabilityReportsRetry) {
+ this.listVulnerabilityReportsRetry = listVulnerabilityReportsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/package-info.java
new file mode 100644
index 0000000000..a1856e2048
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/java/com/google/cloud/osconfig/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for osconfig. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.osconfig.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..913bb1a372
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.osconfig.v1.os-config-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud osconfig/OsConfigService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.osconfig.v1.os-config-zonal-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud osconfig/OsConfigZonalService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..f5c6f1b961
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-config-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.osconfig.v1.spring.OsConfigServiceSpringAutoConfiguration
+com.google.cloud.osconfig.v1.spring.OsConfigZonalServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-os-login-spring-starter/pom.xml
new file mode 100644
index 0000000000..eaa8d89e22
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in OsLoginServiceSpringProperties. 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 OsLoginServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OsLoginServiceSettings osLoginServiceSettings(
+ @Qualifier("defaultOsLoginServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ OsLoginServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = OsLoginServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = OsLoginServiceSettings.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 =
+ OsLoginServiceSettings.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 createSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSshPublicKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createSshPublicKeySettings()
+ .setRetrySettings(createSshPublicKeyRetrySettings);
+
+ RetrySettings deletePosixAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePosixAccountSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deletePosixAccountSettings()
+ .setRetrySettings(deletePosixAccountRetrySettings);
+
+ RetrySettings deleteSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteSshPublicKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteSshPublicKeySettings()
+ .setRetrySettings(deleteSshPublicKeyRetrySettings);
+
+ RetrySettings getLoginProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLoginProfileSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getLoginProfileSettings()
+ .setRetrySettings(getLoginProfileRetrySettings);
+
+ RetrySettings getSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSshPublicKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getSshPublicKeySettings()
+ .setRetrySettings(getSshPublicKeyRetrySettings);
+
+ RetrySettings importSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.importSshPublicKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .importSshPublicKeySettings()
+ .setRetrySettings(importSshPublicKeyRetrySettings);
+
+ RetrySettings updateSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSshPublicKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateSshPublicKeySettings()
+ .setRetrySettings(updateSshPublicKeyRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createSshPublicKeyRetry = clientProperties.getCreateSshPublicKeyRetry();
+ if (createSshPublicKeyRetry != null) {
+ RetrySettings createSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSshPublicKeySettings().getRetrySettings(),
+ createSshPublicKeyRetry);
+ clientSettingsBuilder
+ .createSshPublicKeySettings()
+ .setRetrySettings(createSshPublicKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createSshPublicKey from properties.");
+ }
+ }
+ Retry deletePosixAccountRetry = clientProperties.getDeletePosixAccountRetry();
+ if (deletePosixAccountRetry != null) {
+ RetrySettings deletePosixAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deletePosixAccountSettings().getRetrySettings(),
+ deletePosixAccountRetry);
+ clientSettingsBuilder
+ .deletePosixAccountSettings()
+ .setRetrySettings(deletePosixAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deletePosixAccount from properties.");
+ }
+ }
+ Retry deleteSshPublicKeyRetry = clientProperties.getDeleteSshPublicKeyRetry();
+ if (deleteSshPublicKeyRetry != null) {
+ RetrySettings deleteSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteSshPublicKeySettings().getRetrySettings(),
+ deleteSshPublicKeyRetry);
+ clientSettingsBuilder
+ .deleteSshPublicKeySettings()
+ .setRetrySettings(deleteSshPublicKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteSshPublicKey from properties.");
+ }
+ }
+ Retry getLoginProfileRetry = clientProperties.getGetLoginProfileRetry();
+ if (getLoginProfileRetry != null) {
+ RetrySettings getLoginProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLoginProfileSettings().getRetrySettings(),
+ getLoginProfileRetry);
+ clientSettingsBuilder
+ .getLoginProfileSettings()
+ .setRetrySettings(getLoginProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLoginProfile from properties.");
+ }
+ }
+ Retry getSshPublicKeyRetry = clientProperties.getGetSshPublicKeyRetry();
+ if (getSshPublicKeyRetry != null) {
+ RetrySettings getSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSshPublicKeySettings().getRetrySettings(),
+ getSshPublicKeyRetry);
+ clientSettingsBuilder
+ .getSshPublicKeySettings()
+ .setRetrySettings(getSshPublicKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSshPublicKey from properties.");
+ }
+ }
+ Retry importSshPublicKeyRetry = clientProperties.getImportSshPublicKeyRetry();
+ if (importSshPublicKeyRetry != null) {
+ RetrySettings importSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.importSshPublicKeySettings().getRetrySettings(),
+ importSshPublicKeyRetry);
+ clientSettingsBuilder
+ .importSshPublicKeySettings()
+ .setRetrySettings(importSshPublicKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for importSshPublicKey from properties.");
+ }
+ }
+ Retry updateSshPublicKeyRetry = clientProperties.getUpdateSshPublicKeyRetry();
+ if (updateSshPublicKeyRetry != null) {
+ RetrySettings updateSshPublicKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSshPublicKeySettings().getRetrySettings(),
+ updateSshPublicKeyRetry);
+ clientSettingsBuilder
+ .updateSshPublicKeySettings()
+ .setRetrySettings(updateSshPublicKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateSshPublicKey from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a OsLoginServiceClient bean configured with OsLoginServiceSettings.
+ *
+ * @param osLoginServiceSettings settings to configure an instance of client bean.
+ * @return a {@link OsLoginServiceClient} bean configured with {@link OsLoginServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public OsLoginServiceClient osLoginServiceClient(OsLoginServiceSettings osLoginServiceSettings)
+ throws IOException {
+ return OsLoginServiceClient.create(osLoginServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-os-login-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringProperties.java b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringProperties.java
new file mode 100644
index 0000000000..0b4a3570d8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/OsLoginServiceSpringProperties.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2022 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.oslogin.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 OsLoginService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.oslogin.v1.os-login-service")
+public class OsLoginServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/compute",
+ "https://www.googleapis.com/auth/compute.readonly");
+ /** 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 createSshPublicKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createSshPublicKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for deletePosixAccount. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deletePosixAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteSshPublicKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteSshPublicKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for getLoginProfile. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLoginProfileRetry;
+ /**
+ * Allow override of retry settings at method-level for getSshPublicKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSshPublicKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for importSshPublicKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry importSshPublicKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSshPublicKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSshPublicKeyRetry;
+
+ @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 getCreateSshPublicKeyRetry() {
+ return this.createSshPublicKeyRetry;
+ }
+
+ public void setCreateSshPublicKeyRetry(Retry createSshPublicKeyRetry) {
+ this.createSshPublicKeyRetry = createSshPublicKeyRetry;
+ }
+
+ public Retry getDeletePosixAccountRetry() {
+ return this.deletePosixAccountRetry;
+ }
+
+ public void setDeletePosixAccountRetry(Retry deletePosixAccountRetry) {
+ this.deletePosixAccountRetry = deletePosixAccountRetry;
+ }
+
+ public Retry getDeleteSshPublicKeyRetry() {
+ return this.deleteSshPublicKeyRetry;
+ }
+
+ public void setDeleteSshPublicKeyRetry(Retry deleteSshPublicKeyRetry) {
+ this.deleteSshPublicKeyRetry = deleteSshPublicKeyRetry;
+ }
+
+ public Retry getGetLoginProfileRetry() {
+ return this.getLoginProfileRetry;
+ }
+
+ public void setGetLoginProfileRetry(Retry getLoginProfileRetry) {
+ this.getLoginProfileRetry = getLoginProfileRetry;
+ }
+
+ public Retry getGetSshPublicKeyRetry() {
+ return this.getSshPublicKeyRetry;
+ }
+
+ public void setGetSshPublicKeyRetry(Retry getSshPublicKeyRetry) {
+ this.getSshPublicKeyRetry = getSshPublicKeyRetry;
+ }
+
+ public Retry getImportSshPublicKeyRetry() {
+ return this.importSshPublicKeyRetry;
+ }
+
+ public void setImportSshPublicKeyRetry(Retry importSshPublicKeyRetry) {
+ this.importSshPublicKeyRetry = importSshPublicKeyRetry;
+ }
+
+ public Retry getUpdateSshPublicKeyRetry() {
+ return this.updateSshPublicKeyRetry;
+ }
+
+ public void setUpdateSshPublicKeyRetry(Retry updateSshPublicKeyRetry) {
+ this.updateSshPublicKeyRetry = updateSshPublicKeyRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/package-info.java
new file mode 100644
index 0000000000..ba7d12213a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/java/com/google/cloud/oslogin/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for oslogin. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.oslogin.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..11c74a7f74
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.oslogin.v1.os-login-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud oslogin/OsLoginService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a61e7ca468
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-os-login-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.oslogin.v1.spring.OsLoginServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/pom.xml
new file mode 100644
index 0000000000..fc2607c277
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in IamCheckerSpringProperties. 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 IamCheckerSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IamCheckerSettings iamCheckerSettings(
+ @Qualifier("defaultIamCheckerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ IamCheckerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = IamCheckerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = IamCheckerSettings.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 =
+ IamCheckerSettings.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 troubleshootIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.troubleshootIamPolicySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .troubleshootIamPolicySettings()
+ .setRetrySettings(troubleshootIamPolicyRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry troubleshootIamPolicyRetry = clientProperties.getTroubleshootIamPolicyRetry();
+ if (troubleshootIamPolicyRetry != null) {
+ RetrySettings troubleshootIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.troubleshootIamPolicySettings().getRetrySettings(),
+ troubleshootIamPolicyRetry);
+ clientSettingsBuilder
+ .troubleshootIamPolicySettings()
+ .setRetrySettings(troubleshootIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for troubleshootIamPolicy from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a IamCheckerClient bean configured with IamCheckerSettings.
+ *
+ * @param iamCheckerSettings settings to configure an instance of client bean.
+ * @return a {@link IamCheckerClient} bean configured with {@link IamCheckerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IamCheckerClient iamCheckerClient(IamCheckerSettings iamCheckerSettings)
+ throws IOException {
+ return IamCheckerClient.create(iamCheckerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-iam-checker";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringProperties.java b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringProperties.java
new file mode 100644
index 0000000000..0f945cd34b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/IamCheckerSpringProperties.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2022 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.policytroubleshooter.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 IamChecker client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.policytroubleshooter.v1.iam-checker")
+public class IamCheckerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for troubleshootIamPolicy. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry troubleshootIamPolicyRetry;
+
+ @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 getTroubleshootIamPolicyRetry() {
+ return this.troubleshootIamPolicyRetry;
+ }
+
+ public void setTroubleshootIamPolicyRetry(Retry troubleshootIamPolicyRetry) {
+ this.troubleshootIamPolicyRetry = troubleshootIamPolicyRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/package-info.java
new file mode 100644
index 0000000000..caaed3f6cf
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/java/com/google/cloud/policytroubleshooter/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for policytroubleshooter. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.policytroubleshooter.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..036039e8fe
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.policytroubleshooter.v1.iam-checker.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud policytroubleshooter/IamChecker components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a81520811c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-policy-troubleshooter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.policytroubleshooter.v1.spring.IamCheckerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-profiler-spring-starter/pom.xml
new file mode 100644
index 0000000000..449d6c4985
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ProfilerServiceSpringProperties. 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 ProfilerServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ProfilerServiceSettings profilerServiceSettings(
+ @Qualifier("defaultProfilerServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ProfilerServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ProfilerServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ProfilerServiceSettings.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 =
+ ProfilerServiceSettings.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 createProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createProfileSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createProfileSettings().setRetrySettings(createProfileRetrySettings);
+
+ RetrySettings createOfflineProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createOfflineProfileSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createOfflineProfileSettings()
+ .setRetrySettings(createOfflineProfileRetrySettings);
+
+ RetrySettings updateProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateProfileSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateProfileSettings().setRetrySettings(updateProfileRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createProfileRetry = clientProperties.getCreateProfileRetry();
+ if (createProfileRetry != null) {
+ RetrySettings createProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createProfileSettings().getRetrySettings(), createProfileRetry);
+ clientSettingsBuilder.createProfileSettings().setRetrySettings(createProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createProfile from properties.");
+ }
+ }
+ Retry createOfflineProfileRetry = clientProperties.getCreateOfflineProfileRetry();
+ if (createOfflineProfileRetry != null) {
+ RetrySettings createOfflineProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createOfflineProfileSettings().getRetrySettings(),
+ createOfflineProfileRetry);
+ clientSettingsBuilder
+ .createOfflineProfileSettings()
+ .setRetrySettings(createOfflineProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createOfflineProfile from properties.");
+ }
+ }
+ Retry updateProfileRetry = clientProperties.getUpdateProfileRetry();
+ if (updateProfileRetry != null) {
+ RetrySettings updateProfileRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateProfileSettings().getRetrySettings(), updateProfileRetry);
+ clientSettingsBuilder.updateProfileSettings().setRetrySettings(updateProfileRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateProfile from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ProfilerServiceClient bean configured with ProfilerServiceSettings.
+ *
+ * @param profilerServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ProfilerServiceClient} bean configured with {@link ProfilerServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ProfilerServiceClient profilerServiceClient(
+ ProfilerServiceSettings profilerServiceSettings) throws IOException {
+ return ProfilerServiceClient.create(profilerServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-profiler-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/ProfilerServiceSpringProperties.java b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringProperties.java
new file mode 100644
index 0000000000..3b2f571ec0
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/ProfilerServiceSpringProperties.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2022 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 ProfilerService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.devtools.cloudprofiler.v2.profiler-service")
+public class ProfilerServiceSpringProperties 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 createProfile. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createProfileRetry;
+ /**
+ * Allow override of retry settings at method-level for createOfflineProfile. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createOfflineProfileRetry;
+ /**
+ * Allow override of retry settings at method-level for updateProfile. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateProfileRetry;
+
+ @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 getCreateProfileRetry() {
+ return this.createProfileRetry;
+ }
+
+ public void setCreateProfileRetry(Retry createProfileRetry) {
+ this.createProfileRetry = createProfileRetry;
+ }
+
+ public Retry getCreateOfflineProfileRetry() {
+ return this.createOfflineProfileRetry;
+ }
+
+ public void setCreateOfflineProfileRetry(Retry createOfflineProfileRetry) {
+ this.createOfflineProfileRetry = createOfflineProfileRetry;
+ }
+
+ public Retry getUpdateProfileRetry() {
+ return this.updateProfileRetry;
+ }
+
+ public void setUpdateProfileRetry(Retry updateProfileRetry) {
+ this.updateProfileRetry = updateProfileRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/package-info.java
new file mode 100644
index 0000000000..00e2e19f35
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/java/com/google/devtools/cloudprofiler/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudprofiler. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.devtools.cloudprofiler.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
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
new file mode 100644
index 0000000000..a18ecd0f38
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.devtools.cloudprofiler.v2.profiler-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudprofiler/ProfilerService 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
new file mode 100644
index 0000000000..0c01f6b367
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-profiler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.devtools.cloudprofiler.v2.spring.ProfilerServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/pom.xml
new file mode 100644
index 0000000000..6323e6f264
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in RecaptchaEnterpriseServiceSpringProperties. 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 RecaptchaEnterpriseServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings(
+ @Qualifier("defaultRecaptchaEnterpriseServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ RecaptchaEnterpriseServiceSettings.Builder clientSettingsBuilder =
+ RecaptchaEnterpriseServiceSettings.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 =
+ RecaptchaEnterpriseServiceSettings.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 createAssessmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAssessmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createAssessmentSettings()
+ .setRetrySettings(createAssessmentRetrySettings);
+
+ RetrySettings annotateAssessmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.annotateAssessmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .annotateAssessmentSettings()
+ .setRetrySettings(annotateAssessmentRetrySettings);
+
+ RetrySettings createKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createKeySettings().setRetrySettings(createKeyRetrySettings);
+
+ RetrySettings listKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listKeysSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listKeysSettings().setRetrySettings(listKeysRetrySettings);
+
+ RetrySettings retrieveLegacySecretKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveLegacySecretKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .retrieveLegacySecretKeySettings()
+ .setRetrySettings(retrieveLegacySecretKeyRetrySettings);
+
+ RetrySettings getKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getKeySettings().setRetrySettings(getKeyRetrySettings);
+
+ RetrySettings updateKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateKeySettings().setRetrySettings(updateKeyRetrySettings);
+
+ RetrySettings deleteKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteKeySettings().setRetrySettings(deleteKeyRetrySettings);
+
+ RetrySettings migrateKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.migrateKeySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.migrateKeySettings().setRetrySettings(migrateKeyRetrySettings);
+
+ RetrySettings getMetricsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMetricsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getMetricsSettings().setRetrySettings(getMetricsRetrySettings);
+
+ RetrySettings listRelatedAccountGroupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRelatedAccountGroupsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listRelatedAccountGroupsSettings()
+ .setRetrySettings(listRelatedAccountGroupsRetrySettings);
+
+ RetrySettings listRelatedAccountGroupMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRelatedAccountGroupMembershipsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listRelatedAccountGroupMembershipsSettings()
+ .setRetrySettings(listRelatedAccountGroupMembershipsRetrySettings);
+
+ RetrySettings searchRelatedAccountGroupMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .searchRelatedAccountGroupMembershipsSettings()
+ .getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .searchRelatedAccountGroupMembershipsSettings()
+ .setRetrySettings(searchRelatedAccountGroupMembershipsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createAssessmentRetry = clientProperties.getCreateAssessmentRetry();
+ if (createAssessmentRetry != null) {
+ RetrySettings createAssessmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAssessmentSettings().getRetrySettings(),
+ createAssessmentRetry);
+ clientSettingsBuilder
+ .createAssessmentSettings()
+ .setRetrySettings(createAssessmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createAssessment from properties.");
+ }
+ }
+ Retry annotateAssessmentRetry = clientProperties.getAnnotateAssessmentRetry();
+ if (annotateAssessmentRetry != null) {
+ RetrySettings annotateAssessmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.annotateAssessmentSettings().getRetrySettings(),
+ annotateAssessmentRetry);
+ clientSettingsBuilder
+ .annotateAssessmentSettings()
+ .setRetrySettings(annotateAssessmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for annotateAssessment from properties.");
+ }
+ }
+ Retry createKeyRetry = clientProperties.getCreateKeyRetry();
+ if (createKeyRetry != null) {
+ RetrySettings createKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createKeySettings().getRetrySettings(), createKeyRetry);
+ clientSettingsBuilder.createKeySettings().setRetrySettings(createKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createKey from properties.");
+ }
+ }
+ Retry listKeysRetry = clientProperties.getListKeysRetry();
+ if (listKeysRetry != null) {
+ RetrySettings listKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listKeysSettings().getRetrySettings(), listKeysRetry);
+ clientSettingsBuilder.listKeysSettings().setRetrySettings(listKeysRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listKeys from properties.");
+ }
+ }
+ Retry retrieveLegacySecretKeyRetry = clientProperties.getRetrieveLegacySecretKeyRetry();
+ if (retrieveLegacySecretKeyRetry != null) {
+ RetrySettings retrieveLegacySecretKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.retrieveLegacySecretKeySettings().getRetrySettings(),
+ retrieveLegacySecretKeyRetry);
+ clientSettingsBuilder
+ .retrieveLegacySecretKeySettings()
+ .setRetrySettings(retrieveLegacySecretKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for retrieveLegacySecretKey from properties.");
+ }
+ }
+ Retry getKeyRetry = clientProperties.getGetKeyRetry();
+ if (getKeyRetry != null) {
+ RetrySettings getKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getKeySettings().getRetrySettings(), getKeyRetry);
+ clientSettingsBuilder.getKeySettings().setRetrySettings(getKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getKey from properties.");
+ }
+ }
+ Retry updateKeyRetry = clientProperties.getUpdateKeyRetry();
+ if (updateKeyRetry != null) {
+ RetrySettings updateKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateKeySettings().getRetrySettings(), updateKeyRetry);
+ clientSettingsBuilder.updateKeySettings().setRetrySettings(updateKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateKey from properties.");
+ }
+ }
+ Retry deleteKeyRetry = clientProperties.getDeleteKeyRetry();
+ if (deleteKeyRetry != null) {
+ RetrySettings deleteKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteKeySettings().getRetrySettings(), deleteKeyRetry);
+ clientSettingsBuilder.deleteKeySettings().setRetrySettings(deleteKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteKey from properties.");
+ }
+ }
+ Retry migrateKeyRetry = clientProperties.getMigrateKeyRetry();
+ if (migrateKeyRetry != null) {
+ RetrySettings migrateKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.migrateKeySettings().getRetrySettings(), migrateKeyRetry);
+ clientSettingsBuilder.migrateKeySettings().setRetrySettings(migrateKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for migrateKey from properties.");
+ }
+ }
+ Retry getMetricsRetry = clientProperties.getGetMetricsRetry();
+ if (getMetricsRetry != null) {
+ RetrySettings getMetricsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMetricsSettings().getRetrySettings(), getMetricsRetry);
+ clientSettingsBuilder.getMetricsSettings().setRetrySettings(getMetricsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getMetrics from properties.");
+ }
+ }
+ Retry listRelatedAccountGroupsRetry = clientProperties.getListRelatedAccountGroupsRetry();
+ if (listRelatedAccountGroupsRetry != null) {
+ RetrySettings listRelatedAccountGroupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRelatedAccountGroupsSettings().getRetrySettings(),
+ listRelatedAccountGroupsRetry);
+ clientSettingsBuilder
+ .listRelatedAccountGroupsSettings()
+ .setRetrySettings(listRelatedAccountGroupsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRelatedAccountGroups from properties.");
+ }
+ }
+ Retry listRelatedAccountGroupMembershipsRetry =
+ clientProperties.getListRelatedAccountGroupMembershipsRetry();
+ if (listRelatedAccountGroupMembershipsRetry != null) {
+ RetrySettings listRelatedAccountGroupMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRelatedAccountGroupMembershipsSettings().getRetrySettings(),
+ listRelatedAccountGroupMembershipsRetry);
+ clientSettingsBuilder
+ .listRelatedAccountGroupMembershipsSettings()
+ .setRetrySettings(listRelatedAccountGroupMembershipsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRelatedAccountGroupMemberships from properties.");
+ }
+ }
+ Retry searchRelatedAccountGroupMembershipsRetry =
+ clientProperties.getSearchRelatedAccountGroupMembershipsRetry();
+ if (searchRelatedAccountGroupMembershipsRetry != null) {
+ RetrySettings searchRelatedAccountGroupMembershipsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder
+ .searchRelatedAccountGroupMembershipsSettings()
+ .getRetrySettings(),
+ searchRelatedAccountGroupMembershipsRetry);
+ clientSettingsBuilder
+ .searchRelatedAccountGroupMembershipsSettings()
+ .setRetrySettings(searchRelatedAccountGroupMembershipsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for searchRelatedAccountGroupMemberships from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a RecaptchaEnterpriseServiceClient bean configured with
+ * RecaptchaEnterpriseServiceSettings.
+ *
+ * @param recaptchaEnterpriseServiceSettings settings to configure an instance of client bean.
+ * @return a {@link RecaptchaEnterpriseServiceClient} bean configured with {@link
+ * RecaptchaEnterpriseServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient(
+ RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings) throws IOException {
+ return RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-recaptcha-enterprise-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringProperties.java b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringProperties.java
new file mode 100644
index 0000000000..cddcd6931e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/RecaptchaEnterpriseServiceSpringProperties.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2022 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.recaptchaenterprise.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 RecaptchaEnterpriseService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.recaptchaenterprise.v1.recaptcha-enterprise-service")
+public class RecaptchaEnterpriseServiceSpringProperties 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 createAssessment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createAssessmentRetry;
+ /**
+ * Allow override of retry settings at method-level for annotateAssessment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry annotateAssessmentRetry;
+ /**
+ * Allow override of retry settings at method-level for createKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for listKeys. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listKeysRetry;
+ /**
+ * Allow override of retry settings at method-level for retrieveLegacySecretKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry retrieveLegacySecretKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for getKey. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for updateKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for migrateKey. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry migrateKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for getMetrics. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMetricsRetry;
+ /**
+ * Allow override of retry settings at method-level for listRelatedAccountGroups. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRelatedAccountGroupsRetry;
+ /**
+ * Allow override of retry settings at method-level for listRelatedAccountGroupMemberships. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRelatedAccountGroupMembershipsRetry;
+ /**
+ * Allow override of retry settings at method-level for searchRelatedAccountGroupMemberships. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchRelatedAccountGroupMembershipsRetry;
+
+ @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 getCreateAssessmentRetry() {
+ return this.createAssessmentRetry;
+ }
+
+ public void setCreateAssessmentRetry(Retry createAssessmentRetry) {
+ this.createAssessmentRetry = createAssessmentRetry;
+ }
+
+ public Retry getAnnotateAssessmentRetry() {
+ return this.annotateAssessmentRetry;
+ }
+
+ public void setAnnotateAssessmentRetry(Retry annotateAssessmentRetry) {
+ this.annotateAssessmentRetry = annotateAssessmentRetry;
+ }
+
+ public Retry getCreateKeyRetry() {
+ return this.createKeyRetry;
+ }
+
+ public void setCreateKeyRetry(Retry createKeyRetry) {
+ this.createKeyRetry = createKeyRetry;
+ }
+
+ public Retry getListKeysRetry() {
+ return this.listKeysRetry;
+ }
+
+ public void setListKeysRetry(Retry listKeysRetry) {
+ this.listKeysRetry = listKeysRetry;
+ }
+
+ public Retry getRetrieveLegacySecretKeyRetry() {
+ return this.retrieveLegacySecretKeyRetry;
+ }
+
+ public void setRetrieveLegacySecretKeyRetry(Retry retrieveLegacySecretKeyRetry) {
+ this.retrieveLegacySecretKeyRetry = retrieveLegacySecretKeyRetry;
+ }
+
+ public Retry getGetKeyRetry() {
+ return this.getKeyRetry;
+ }
+
+ public void setGetKeyRetry(Retry getKeyRetry) {
+ this.getKeyRetry = getKeyRetry;
+ }
+
+ public Retry getUpdateKeyRetry() {
+ return this.updateKeyRetry;
+ }
+
+ public void setUpdateKeyRetry(Retry updateKeyRetry) {
+ this.updateKeyRetry = updateKeyRetry;
+ }
+
+ public Retry getDeleteKeyRetry() {
+ return this.deleteKeyRetry;
+ }
+
+ public void setDeleteKeyRetry(Retry deleteKeyRetry) {
+ this.deleteKeyRetry = deleteKeyRetry;
+ }
+
+ public Retry getMigrateKeyRetry() {
+ return this.migrateKeyRetry;
+ }
+
+ public void setMigrateKeyRetry(Retry migrateKeyRetry) {
+ this.migrateKeyRetry = migrateKeyRetry;
+ }
+
+ public Retry getGetMetricsRetry() {
+ return this.getMetricsRetry;
+ }
+
+ public void setGetMetricsRetry(Retry getMetricsRetry) {
+ this.getMetricsRetry = getMetricsRetry;
+ }
+
+ public Retry getListRelatedAccountGroupsRetry() {
+ return this.listRelatedAccountGroupsRetry;
+ }
+
+ public void setListRelatedAccountGroupsRetry(Retry listRelatedAccountGroupsRetry) {
+ this.listRelatedAccountGroupsRetry = listRelatedAccountGroupsRetry;
+ }
+
+ public Retry getListRelatedAccountGroupMembershipsRetry() {
+ return this.listRelatedAccountGroupMembershipsRetry;
+ }
+
+ public void setListRelatedAccountGroupMembershipsRetry(
+ Retry listRelatedAccountGroupMembershipsRetry) {
+ this.listRelatedAccountGroupMembershipsRetry = listRelatedAccountGroupMembershipsRetry;
+ }
+
+ public Retry getSearchRelatedAccountGroupMembershipsRetry() {
+ return this.searchRelatedAccountGroupMembershipsRetry;
+ }
+
+ public void setSearchRelatedAccountGroupMembershipsRetry(
+ Retry searchRelatedAccountGroupMembershipsRetry) {
+ this.searchRelatedAccountGroupMembershipsRetry = searchRelatedAccountGroupMembershipsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/package-info.java
new file mode 100644
index 0000000000..441912903e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/java/com/google/cloud/recaptchaenterprise/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for recaptchaenterprise. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.recaptchaenterprise.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..e649c4ae91
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.recaptchaenterprise.v1.recaptcha-enterprise-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud recaptchaenterprise/RecaptchaEnterpriseService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..9c02bbe7ea
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recaptchaenterprise-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.recaptchaenterprise.v1.spring.RecaptchaEnterpriseServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-recommender-spring-starter/pom.xml
new file mode 100644
index 0000000000..bb6e71a161
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in RecommenderSpringProperties. 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 RecommenderSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RecommenderSettings recommenderSettings(
+ @Qualifier("defaultRecommenderTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ RecommenderSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = RecommenderSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = RecommenderSettings.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 =
+ RecommenderSettings.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 listInsightsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInsightsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInsightsSettings().setRetrySettings(listInsightsRetrySettings);
+
+ RetrySettings getInsightRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInsightSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInsightSettings().setRetrySettings(getInsightRetrySettings);
+
+ RetrySettings markInsightAcceptedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markInsightAcceptedSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .markInsightAcceptedSettings()
+ .setRetrySettings(markInsightAcceptedRetrySettings);
+
+ RetrySettings listRecommendationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRecommendationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listRecommendationsSettings()
+ .setRetrySettings(listRecommendationsRetrySettings);
+
+ RetrySettings getRecommendationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecommendationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getRecommendationSettings()
+ .setRetrySettings(getRecommendationRetrySettings);
+
+ RetrySettings markRecommendationClaimedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationClaimedSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .markRecommendationClaimedSettings()
+ .setRetrySettings(markRecommendationClaimedRetrySettings);
+
+ RetrySettings markRecommendationSucceededRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationSucceededSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .markRecommendationSucceededSettings()
+ .setRetrySettings(markRecommendationSucceededRetrySettings);
+
+ RetrySettings markRecommendationFailedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationFailedSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .markRecommendationFailedSettings()
+ .setRetrySettings(markRecommendationFailedRetrySettings);
+
+ RetrySettings getRecommenderConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecommenderConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getRecommenderConfigSettings()
+ .setRetrySettings(getRecommenderConfigRetrySettings);
+
+ RetrySettings updateRecommenderConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRecommenderConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateRecommenderConfigSettings()
+ .setRetrySettings(updateRecommenderConfigRetrySettings);
+
+ RetrySettings getInsightTypeConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInsightTypeConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getInsightTypeConfigSettings()
+ .setRetrySettings(getInsightTypeConfigRetrySettings);
+
+ RetrySettings updateInsightTypeConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInsightTypeConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateInsightTypeConfigSettings()
+ .setRetrySettings(updateInsightTypeConfigRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listInsightsRetry = clientProperties.getListInsightsRetry();
+ if (listInsightsRetry != null) {
+ RetrySettings listInsightsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInsightsSettings().getRetrySettings(), listInsightsRetry);
+ clientSettingsBuilder.listInsightsSettings().setRetrySettings(listInsightsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInsights from properties.");
+ }
+ }
+ Retry getInsightRetry = clientProperties.getGetInsightRetry();
+ if (getInsightRetry != null) {
+ RetrySettings getInsightRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInsightSettings().getRetrySettings(), getInsightRetry);
+ clientSettingsBuilder.getInsightSettings().setRetrySettings(getInsightRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInsight from properties.");
+ }
+ }
+ Retry markInsightAcceptedRetry = clientProperties.getMarkInsightAcceptedRetry();
+ if (markInsightAcceptedRetry != null) {
+ RetrySettings markInsightAcceptedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markInsightAcceptedSettings().getRetrySettings(),
+ markInsightAcceptedRetry);
+ clientSettingsBuilder
+ .markInsightAcceptedSettings()
+ .setRetrySettings(markInsightAcceptedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for markInsightAccepted from properties.");
+ }
+ }
+ Retry listRecommendationsRetry = clientProperties.getListRecommendationsRetry();
+ if (listRecommendationsRetry != null) {
+ RetrySettings listRecommendationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRecommendationsSettings().getRetrySettings(),
+ listRecommendationsRetry);
+ clientSettingsBuilder
+ .listRecommendationsSettings()
+ .setRetrySettings(listRecommendationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRecommendations from properties.");
+ }
+ }
+ Retry getRecommendationRetry = clientProperties.getGetRecommendationRetry();
+ if (getRecommendationRetry != null) {
+ RetrySettings getRecommendationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecommendationSettings().getRetrySettings(),
+ getRecommendationRetry);
+ clientSettingsBuilder
+ .getRecommendationSettings()
+ .setRetrySettings(getRecommendationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getRecommendation from properties.");
+ }
+ }
+ Retry markRecommendationClaimedRetry = clientProperties.getMarkRecommendationClaimedRetry();
+ if (markRecommendationClaimedRetry != null) {
+ RetrySettings markRecommendationClaimedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationClaimedSettings().getRetrySettings(),
+ markRecommendationClaimedRetry);
+ clientSettingsBuilder
+ .markRecommendationClaimedSettings()
+ .setRetrySettings(markRecommendationClaimedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for markRecommendationClaimed from properties.");
+ }
+ }
+ Retry markRecommendationSucceededRetry = clientProperties.getMarkRecommendationSucceededRetry();
+ if (markRecommendationSucceededRetry != null) {
+ RetrySettings markRecommendationSucceededRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationSucceededSettings().getRetrySettings(),
+ markRecommendationSucceededRetry);
+ clientSettingsBuilder
+ .markRecommendationSucceededSettings()
+ .setRetrySettings(markRecommendationSucceededRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for markRecommendationSucceeded from properties.");
+ }
+ }
+ Retry markRecommendationFailedRetry = clientProperties.getMarkRecommendationFailedRetry();
+ if (markRecommendationFailedRetry != null) {
+ RetrySettings markRecommendationFailedRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.markRecommendationFailedSettings().getRetrySettings(),
+ markRecommendationFailedRetry);
+ clientSettingsBuilder
+ .markRecommendationFailedSettings()
+ .setRetrySettings(markRecommendationFailedRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for markRecommendationFailed from properties.");
+ }
+ }
+ Retry getRecommenderConfigRetry = clientProperties.getGetRecommenderConfigRetry();
+ if (getRecommenderConfigRetry != null) {
+ RetrySettings getRecommenderConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecommenderConfigSettings().getRetrySettings(),
+ getRecommenderConfigRetry);
+ clientSettingsBuilder
+ .getRecommenderConfigSettings()
+ .setRetrySettings(getRecommenderConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getRecommenderConfig from properties.");
+ }
+ }
+ Retry updateRecommenderConfigRetry = clientProperties.getUpdateRecommenderConfigRetry();
+ if (updateRecommenderConfigRetry != null) {
+ RetrySettings updateRecommenderConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRecommenderConfigSettings().getRetrySettings(),
+ updateRecommenderConfigRetry);
+ clientSettingsBuilder
+ .updateRecommenderConfigSettings()
+ .setRetrySettings(updateRecommenderConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateRecommenderConfig from properties.");
+ }
+ }
+ Retry getInsightTypeConfigRetry = clientProperties.getGetInsightTypeConfigRetry();
+ if (getInsightTypeConfigRetry != null) {
+ RetrySettings getInsightTypeConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInsightTypeConfigSettings().getRetrySettings(),
+ getInsightTypeConfigRetry);
+ clientSettingsBuilder
+ .getInsightTypeConfigSettings()
+ .setRetrySettings(getInsightTypeConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getInsightTypeConfig from properties.");
+ }
+ }
+ Retry updateInsightTypeConfigRetry = clientProperties.getUpdateInsightTypeConfigRetry();
+ if (updateInsightTypeConfigRetry != null) {
+ RetrySettings updateInsightTypeConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateInsightTypeConfigSettings().getRetrySettings(),
+ updateInsightTypeConfigRetry);
+ clientSettingsBuilder
+ .updateInsightTypeConfigSettings()
+ .setRetrySettings(updateInsightTypeConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateInsightTypeConfig from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a RecommenderClient bean configured with RecommenderSettings.
+ *
+ * @param recommenderSettings settings to configure an instance of client bean.
+ * @return a {@link RecommenderClient} bean configured with {@link RecommenderSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RecommenderClient recommenderClient(RecommenderSettings recommenderSettings)
+ throws IOException {
+ return RecommenderClient.create(recommenderSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-recommender";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringProperties.java b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringProperties.java
new file mode 100644
index 0000000000..f36b339705
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/RecommenderSpringProperties.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2022 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.recommender.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 Recommender client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.recommender.v1.recommender")
+public class RecommenderSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listInsights. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInsightsRetry;
+ /**
+ * Allow override of retry settings at method-level for getInsight. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInsightRetry;
+ /**
+ * Allow override of retry settings at method-level for markInsightAccepted. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry markInsightAcceptedRetry;
+ /**
+ * Allow override of retry settings at method-level for listRecommendations. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRecommendationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRecommendation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRecommendationRetry;
+ /**
+ * Allow override of retry settings at method-level for markRecommendationClaimed. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry markRecommendationClaimedRetry;
+ /**
+ * Allow override of retry settings at method-level for markRecommendationSucceeded. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry markRecommendationSucceededRetry;
+ /**
+ * Allow override of retry settings at method-level for markRecommendationFailed. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry markRecommendationFailedRetry;
+ /**
+ * Allow override of retry settings at method-level for getRecommenderConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRecommenderConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateRecommenderConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateRecommenderConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getInsightTypeConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInsightTypeConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateInsightTypeConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateInsightTypeConfigRetry;
+
+ @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 getListInsightsRetry() {
+ return this.listInsightsRetry;
+ }
+
+ public void setListInsightsRetry(Retry listInsightsRetry) {
+ this.listInsightsRetry = listInsightsRetry;
+ }
+
+ public Retry getGetInsightRetry() {
+ return this.getInsightRetry;
+ }
+
+ public void setGetInsightRetry(Retry getInsightRetry) {
+ this.getInsightRetry = getInsightRetry;
+ }
+
+ public Retry getMarkInsightAcceptedRetry() {
+ return this.markInsightAcceptedRetry;
+ }
+
+ public void setMarkInsightAcceptedRetry(Retry markInsightAcceptedRetry) {
+ this.markInsightAcceptedRetry = markInsightAcceptedRetry;
+ }
+
+ public Retry getListRecommendationsRetry() {
+ return this.listRecommendationsRetry;
+ }
+
+ public void setListRecommendationsRetry(Retry listRecommendationsRetry) {
+ this.listRecommendationsRetry = listRecommendationsRetry;
+ }
+
+ public Retry getGetRecommendationRetry() {
+ return this.getRecommendationRetry;
+ }
+
+ public void setGetRecommendationRetry(Retry getRecommendationRetry) {
+ this.getRecommendationRetry = getRecommendationRetry;
+ }
+
+ public Retry getMarkRecommendationClaimedRetry() {
+ return this.markRecommendationClaimedRetry;
+ }
+
+ public void setMarkRecommendationClaimedRetry(Retry markRecommendationClaimedRetry) {
+ this.markRecommendationClaimedRetry = markRecommendationClaimedRetry;
+ }
+
+ public Retry getMarkRecommendationSucceededRetry() {
+ return this.markRecommendationSucceededRetry;
+ }
+
+ public void setMarkRecommendationSucceededRetry(Retry markRecommendationSucceededRetry) {
+ this.markRecommendationSucceededRetry = markRecommendationSucceededRetry;
+ }
+
+ public Retry getMarkRecommendationFailedRetry() {
+ return this.markRecommendationFailedRetry;
+ }
+
+ public void setMarkRecommendationFailedRetry(Retry markRecommendationFailedRetry) {
+ this.markRecommendationFailedRetry = markRecommendationFailedRetry;
+ }
+
+ public Retry getGetRecommenderConfigRetry() {
+ return this.getRecommenderConfigRetry;
+ }
+
+ public void setGetRecommenderConfigRetry(Retry getRecommenderConfigRetry) {
+ this.getRecommenderConfigRetry = getRecommenderConfigRetry;
+ }
+
+ public Retry getUpdateRecommenderConfigRetry() {
+ return this.updateRecommenderConfigRetry;
+ }
+
+ public void setUpdateRecommenderConfigRetry(Retry updateRecommenderConfigRetry) {
+ this.updateRecommenderConfigRetry = updateRecommenderConfigRetry;
+ }
+
+ public Retry getGetInsightTypeConfigRetry() {
+ return this.getInsightTypeConfigRetry;
+ }
+
+ public void setGetInsightTypeConfigRetry(Retry getInsightTypeConfigRetry) {
+ this.getInsightTypeConfigRetry = getInsightTypeConfigRetry;
+ }
+
+ public Retry getUpdateInsightTypeConfigRetry() {
+ return this.updateInsightTypeConfigRetry;
+ }
+
+ public void setUpdateInsightTypeConfigRetry(Retry updateInsightTypeConfigRetry) {
+ this.updateInsightTypeConfigRetry = updateInsightTypeConfigRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/package-info.java
new file mode 100644
index 0000000000..ffcb9c4f67
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/java/com/google/cloud/recommender/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for recommender. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.recommender.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..6add31ae04
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.recommender.v1.recommender.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud recommender/Recommender components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..4ac148aab9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-recommender-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.recommender.v1.spring.RecommenderSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-redis-spring-starter/pom.xml
new file mode 100644
index 0000000000..6a4f0ec11e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-redis-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudRedisSpringProperties. 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 CloudRedisSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudRedisSettings cloudRedisSettings(
+ @Qualifier("defaultCloudRedisTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudRedisSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudRedisSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudRedisSettings.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 =
+ CloudRedisSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+
+ RetrySettings getInstanceAuthStringRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceAuthStringSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getInstanceAuthStringSettings()
+ .setRetrySettings(getInstanceAuthStringRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listInstancesRetry = clientProperties.getListInstancesRetry();
+ if (listInstancesRetry != null) {
+ RetrySettings listInstancesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listInstancesSettings().getRetrySettings(), listInstancesRetry);
+ clientSettingsBuilder.listInstancesSettings().setRetrySettings(listInstancesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listInstances from properties.");
+ }
+ }
+ Retry getInstanceRetry = clientProperties.getGetInstanceRetry();
+ if (getInstanceRetry != null) {
+ RetrySettings getInstanceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceSettings().getRetrySettings(), getInstanceRetry);
+ clientSettingsBuilder.getInstanceSettings().setRetrySettings(getInstanceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getInstance from properties.");
+ }
+ }
+ Retry getInstanceAuthStringRetry = clientProperties.getGetInstanceAuthStringRetry();
+ if (getInstanceAuthStringRetry != null) {
+ RetrySettings getInstanceAuthStringRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getInstanceAuthStringSettings().getRetrySettings(),
+ getInstanceAuthStringRetry);
+ clientSettingsBuilder
+ .getInstanceAuthStringSettings()
+ .setRetrySettings(getInstanceAuthStringRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getInstanceAuthString from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudRedisClient bean configured with CloudRedisSettings.
+ *
+ * @param cloudRedisSettings settings to configure an instance of client bean.
+ * @return a {@link CloudRedisClient} bean configured with {@link CloudRedisSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudRedisClient cloudRedisClient(CloudRedisSettings cloudRedisSettings)
+ throws IOException {
+ return CloudRedisClient.create(cloudRedisSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-redis";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringProperties.java b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringProperties.java
new file mode 100644
index 0000000000..0db3697391
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/CloudRedisSpringProperties.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2022 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.redis.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 CloudRedis client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.redis.v1.cloud-redis")
+public class CloudRedisSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listInstances. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listInstancesRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstance. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceRetry;
+ /**
+ * Allow override of retry settings at method-level for getInstanceAuthString. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getInstanceAuthStringRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListInstancesRetry() {
+ return this.listInstancesRetry;
+ }
+
+ public void setListInstancesRetry(Retry listInstancesRetry) {
+ this.listInstancesRetry = listInstancesRetry;
+ }
+
+ public Retry getGetInstanceRetry() {
+ return this.getInstanceRetry;
+ }
+
+ public void setGetInstanceRetry(Retry getInstanceRetry) {
+ this.getInstanceRetry = getInstanceRetry;
+ }
+
+ public Retry getGetInstanceAuthStringRetry() {
+ return this.getInstanceAuthStringRetry;
+ }
+
+ public void setGetInstanceAuthStringRetry(Retry getInstanceAuthStringRetry) {
+ this.getInstanceAuthStringRetry = getInstanceAuthStringRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/package-info.java
new file mode 100644
index 0000000000..78dbf2d25e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/java/com/google/cloud/redis/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for redis. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.redis.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..18267b6ae0
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.redis.v1.cloud-redis.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud redis/CloudRedis components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..84fd683854
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-redis-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.redis.v1.spring.CloudRedisSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/pom.xml
new file mode 100644
index 0000000000..e713082457
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ResourceSettingsServiceSpringProperties. 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 ResourceSettingsServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ResourceSettingsServiceSettings resourceSettingsServiceSettings(
+ @Qualifier("defaultResourceSettingsServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ResourceSettingsServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ResourceSettingsServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ResourceSettingsServiceSettings.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 =
+ ResourceSettingsServiceSettings.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 listSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSettingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSettingsSettings().setRetrySettings(listSettingsRetrySettings);
+
+ RetrySettings getSettingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSettingSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getSettingSettings().setRetrySettings(getSettingRetrySettings);
+
+ RetrySettings updateSettingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSettingSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateSettingSettings().setRetrySettings(updateSettingRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listSettingsRetry = clientProperties.getListSettingsRetry();
+ if (listSettingsRetry != null) {
+ RetrySettings listSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSettingsSettings().getRetrySettings(), listSettingsRetry);
+ clientSettingsBuilder.listSettingsSettings().setRetrySettings(listSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSettings from properties.");
+ }
+ }
+ Retry getSettingRetry = clientProperties.getGetSettingRetry();
+ if (getSettingRetry != null) {
+ RetrySettings getSettingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSettingSettings().getRetrySettings(), getSettingRetry);
+ clientSettingsBuilder.getSettingSettings().setRetrySettings(getSettingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSetting from properties.");
+ }
+ }
+ Retry updateSettingRetry = clientProperties.getUpdateSettingRetry();
+ if (updateSettingRetry != null) {
+ RetrySettings updateSettingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSettingSettings().getRetrySettings(), updateSettingRetry);
+ clientSettingsBuilder.updateSettingSettings().setRetrySettings(updateSettingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateSetting from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ResourceSettingsServiceClient bean configured with ResourceSettingsServiceSettings.
+ *
+ * @param resourceSettingsServiceSettings settings to configure an instance of client bean.
+ * @return a {@link ResourceSettingsServiceClient} bean configured with {@link
+ * ResourceSettingsServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ResourceSettingsServiceClient resourceSettingsServiceClient(
+ ResourceSettingsServiceSettings resourceSettingsServiceSettings) throws IOException {
+ return ResourceSettingsServiceClient.create(resourceSettingsServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-resource-settings-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringProperties.java b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringProperties.java
new file mode 100644
index 0000000000..1aad77a257
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/ResourceSettingsServiceSpringProperties.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2022 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.resourcesettings.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 ResourceSettingsService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.resourcesettings.v1.resource-settings-service")
+public class ResourceSettingsServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listSettings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for getSetting. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSettingRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSetting. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSettingRetry;
+
+ @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 getListSettingsRetry() {
+ return this.listSettingsRetry;
+ }
+
+ public void setListSettingsRetry(Retry listSettingsRetry) {
+ this.listSettingsRetry = listSettingsRetry;
+ }
+
+ public Retry getGetSettingRetry() {
+ return this.getSettingRetry;
+ }
+
+ public void setGetSettingRetry(Retry getSettingRetry) {
+ this.getSettingRetry = getSettingRetry;
+ }
+
+ public Retry getUpdateSettingRetry() {
+ return this.updateSettingRetry;
+ }
+
+ public void setUpdateSettingRetry(Retry updateSettingRetry) {
+ this.updateSettingRetry = updateSettingRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/package-info.java
new file mode 100644
index 0000000000..06619ac15e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/java/com/google/cloud/resourcesettings/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for resourcesettings. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.resourcesettings.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..367f51c45b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.resourcesettings.v1.resource-settings-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud resourcesettings/ResourceSettingsService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..6192b91625
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-resource-settings-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.resourcesettings.v1.spring.ResourceSettingsServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-retail-spring-starter/pom.xml
new file mode 100644
index 0000000000..52896d8eb7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-retail-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CatalogServiceSpringProperties. 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 CatalogServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public CatalogServiceSettings catalogServiceSettings( + @Qualifier("defaultCatalogServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CatalogServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CatalogServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CatalogServiceSettings.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 = + CatalogServiceSettings.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 listCatalogsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCatalogsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listCatalogsSettings().setRetrySettings(listCatalogsRetrySettings); + + RetrySettings updateCatalogRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCatalogSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateCatalogSettings().setRetrySettings(updateCatalogRetrySettings); + + RetrySettings setDefaultBranchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setDefaultBranchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .setDefaultBranchSettings() + .setRetrySettings(setDefaultBranchRetrySettings); + + RetrySettings getDefaultBranchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDefaultBranchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getDefaultBranchSettings() + .setRetrySettings(getDefaultBranchRetrySettings); + + RetrySettings getCompletionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCompletionConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getCompletionConfigSettings() + .setRetrySettings(getCompletionConfigRetrySettings); + + RetrySettings updateCompletionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCompletionConfigSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateCompletionConfigSettings() + .setRetrySettings(updateCompletionConfigRetrySettings); + + RetrySettings getAttributesConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAttributesConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getAttributesConfigSettings() + .setRetrySettings(getAttributesConfigRetrySettings); + + RetrySettings updateAttributesConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAttributesConfigSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateAttributesConfigSettings() + .setRetrySettings(updateAttributesConfigRetrySettings); + + RetrySettings addCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addCatalogAttributeSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .addCatalogAttributeSettings() + .setRetrySettings(addCatalogAttributeRetrySettings); + + RetrySettings removeCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeCatalogAttributeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .removeCatalogAttributeSettings() + .setRetrySettings(removeCatalogAttributeRetrySettings); + + RetrySettings replaceCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.replaceCatalogAttributeSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .replaceCatalogAttributeSettings() + .setRetrySettings(replaceCatalogAttributeRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry listCatalogsRetry = clientProperties.getListCatalogsRetry(); + if (listCatalogsRetry != null) { + RetrySettings listCatalogsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCatalogsSettings().getRetrySettings(), listCatalogsRetry); + clientSettingsBuilder.listCatalogsSettings().setRetrySettings(listCatalogsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listCatalogs from properties."); + } + } + Retry updateCatalogRetry = clientProperties.getUpdateCatalogRetry(); + if (updateCatalogRetry != null) { + RetrySettings updateCatalogRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCatalogSettings().getRetrySettings(), updateCatalogRetry); + clientSettingsBuilder.updateCatalogSettings().setRetrySettings(updateCatalogRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateCatalog from properties."); + } + } + Retry setDefaultBranchRetry = clientProperties.getSetDefaultBranchRetry(); + if (setDefaultBranchRetry != null) { + RetrySettings setDefaultBranchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.setDefaultBranchSettings().getRetrySettings(), + setDefaultBranchRetry); + clientSettingsBuilder + .setDefaultBranchSettings() + .setRetrySettings(setDefaultBranchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for setDefaultBranch from properties."); + } + } + Retry getDefaultBranchRetry = clientProperties.getGetDefaultBranchRetry(); + if (getDefaultBranchRetry != null) { + RetrySettings getDefaultBranchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDefaultBranchSettings().getRetrySettings(), + getDefaultBranchRetry); + clientSettingsBuilder + .getDefaultBranchSettings() + .setRetrySettings(getDefaultBranchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getDefaultBranch from properties."); + } + } + Retry getCompletionConfigRetry = clientProperties.getGetCompletionConfigRetry(); + if (getCompletionConfigRetry != null) { + RetrySettings getCompletionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCompletionConfigSettings().getRetrySettings(), + getCompletionConfigRetry); + clientSettingsBuilder + .getCompletionConfigSettings() + .setRetrySettings(getCompletionConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getCompletionConfig from properties."); + } + } + Retry updateCompletionConfigRetry = clientProperties.getUpdateCompletionConfigRetry(); + if (updateCompletionConfigRetry != null) { + RetrySettings updateCompletionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCompletionConfigSettings().getRetrySettings(), + updateCompletionConfigRetry); + clientSettingsBuilder + .updateCompletionConfigSettings() + .setRetrySettings(updateCompletionConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateCompletionConfig from properties."); + } + } + Retry getAttributesConfigRetry = clientProperties.getGetAttributesConfigRetry(); + if (getAttributesConfigRetry != null) { + RetrySettings getAttributesConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getAttributesConfigSettings().getRetrySettings(), + getAttributesConfigRetry); + clientSettingsBuilder + .getAttributesConfigSettings() + .setRetrySettings(getAttributesConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getAttributesConfig from properties."); + } + } + Retry updateAttributesConfigRetry = clientProperties.getUpdateAttributesConfigRetry(); + if (updateAttributesConfigRetry != null) { + RetrySettings updateAttributesConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateAttributesConfigSettings().getRetrySettings(), + updateAttributesConfigRetry); + clientSettingsBuilder + .updateAttributesConfigSettings() + .setRetrySettings(updateAttributesConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateAttributesConfig from properties."); + } + } + Retry addCatalogAttributeRetry = clientProperties.getAddCatalogAttributeRetry(); + if (addCatalogAttributeRetry != null) { + RetrySettings addCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addCatalogAttributeSettings().getRetrySettings(), + addCatalogAttributeRetry); + clientSettingsBuilder + .addCatalogAttributeSettings() + .setRetrySettings(addCatalogAttributeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for addCatalogAttribute from properties."); + } + } + Retry removeCatalogAttributeRetry = clientProperties.getRemoveCatalogAttributeRetry(); + if (removeCatalogAttributeRetry != null) { + RetrySettings removeCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeCatalogAttributeSettings().getRetrySettings(), + removeCatalogAttributeRetry); + clientSettingsBuilder + .removeCatalogAttributeSettings() + .setRetrySettings(removeCatalogAttributeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for removeCatalogAttribute from properties."); + } + } + Retry replaceCatalogAttributeRetry = clientProperties.getReplaceCatalogAttributeRetry(); + if (replaceCatalogAttributeRetry != null) { + RetrySettings replaceCatalogAttributeRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.replaceCatalogAttributeSettings().getRetrySettings(), + replaceCatalogAttributeRetry); + clientSettingsBuilder + .replaceCatalogAttributeSettings() + .setRetrySettings(replaceCatalogAttributeRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for replaceCatalogAttribute from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CatalogServiceClient bean configured with CatalogServiceSettings. + * + * @param catalogServiceSettings settings to configure an instance of client bean. + * @return a {@link CatalogServiceClient} bean configured with {@link CatalogServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public CatalogServiceClient catalogServiceClient(CatalogServiceSettings catalogServiceSettings) + throws IOException { + return CatalogServiceClient.create(catalogServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-catalog-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringProperties.java new file mode 100644 index 0000000000..ff13013878 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CatalogServiceSpringProperties.java @@ -0,0 +1,225 @@ +/* + * Copyright 2022 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.retail.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 CatalogService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.catalog-service") +public class CatalogServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for listCatalogs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCatalogsRetry; + /** + * Allow override of retry settings at method-level for updateCatalog. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateCatalogRetry; + /** + * Allow override of retry settings at method-level for setDefaultBranch. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry setDefaultBranchRetry; + /** + * Allow override of retry settings at method-level for getDefaultBranch. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDefaultBranchRetry; + /** + * Allow override of retry settings at method-level for getCompletionConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCompletionConfigRetry; + /** + * Allow override of retry settings at method-level for updateCompletionConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateCompletionConfigRetry; + /** + * Allow override of retry settings at method-level for getAttributesConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getAttributesConfigRetry; + /** + * Allow override of retry settings at method-level for updateAttributesConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateAttributesConfigRetry; + /** + * Allow override of retry settings at method-level for addCatalogAttribute. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry addCatalogAttributeRetry; + /** + * Allow override of retry settings at method-level for removeCatalogAttribute. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry removeCatalogAttributeRetry; + /** + * Allow override of retry settings at method-level for replaceCatalogAttribute. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry replaceCatalogAttributeRetry; + + @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 getListCatalogsRetry() { + return this.listCatalogsRetry; + } + + public void setListCatalogsRetry(Retry listCatalogsRetry) { + this.listCatalogsRetry = listCatalogsRetry; + } + + public Retry getUpdateCatalogRetry() { + return this.updateCatalogRetry; + } + + public void setUpdateCatalogRetry(Retry updateCatalogRetry) { + this.updateCatalogRetry = updateCatalogRetry; + } + + public Retry getSetDefaultBranchRetry() { + return this.setDefaultBranchRetry; + } + + public void setSetDefaultBranchRetry(Retry setDefaultBranchRetry) { + this.setDefaultBranchRetry = setDefaultBranchRetry; + } + + public Retry getGetDefaultBranchRetry() { + return this.getDefaultBranchRetry; + } + + public void setGetDefaultBranchRetry(Retry getDefaultBranchRetry) { + this.getDefaultBranchRetry = getDefaultBranchRetry; + } + + public Retry getGetCompletionConfigRetry() { + return this.getCompletionConfigRetry; + } + + public void setGetCompletionConfigRetry(Retry getCompletionConfigRetry) { + this.getCompletionConfigRetry = getCompletionConfigRetry; + } + + public Retry getUpdateCompletionConfigRetry() { + return this.updateCompletionConfigRetry; + } + + public void setUpdateCompletionConfigRetry(Retry updateCompletionConfigRetry) { + this.updateCompletionConfigRetry = updateCompletionConfigRetry; + } + + public Retry getGetAttributesConfigRetry() { + return this.getAttributesConfigRetry; + } + + public void setGetAttributesConfigRetry(Retry getAttributesConfigRetry) { + this.getAttributesConfigRetry = getAttributesConfigRetry; + } + + public Retry getUpdateAttributesConfigRetry() { + return this.updateAttributesConfigRetry; + } + + public void setUpdateAttributesConfigRetry(Retry updateAttributesConfigRetry) { + this.updateAttributesConfigRetry = updateAttributesConfigRetry; + } + + public Retry getAddCatalogAttributeRetry() { + return this.addCatalogAttributeRetry; + } + + public void setAddCatalogAttributeRetry(Retry addCatalogAttributeRetry) { + this.addCatalogAttributeRetry = addCatalogAttributeRetry; + } + + public Retry getRemoveCatalogAttributeRetry() { + return this.removeCatalogAttributeRetry; + } + + public void setRemoveCatalogAttributeRetry(Retry removeCatalogAttributeRetry) { + this.removeCatalogAttributeRetry = removeCatalogAttributeRetry; + } + + public Retry getReplaceCatalogAttributeRetry() { + return this.replaceCatalogAttributeRetry; + } + + public void setReplaceCatalogAttributeRetry(Retry replaceCatalogAttributeRetry) { + this.replaceCatalogAttributeRetry = replaceCatalogAttributeRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..5df739a28a --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.CompletionServiceClient; +import com.google.cloud.retail.v2.CompletionServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link CompletionServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CompletionServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link CompletionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public CompletionServiceSettings completionServiceSettings( + @Qualifier("defaultCompletionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CompletionServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CompletionServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CompletionServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + CompletionServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry completeQueryRetry = clientProperties.getCompleteQueryRetry(); + if (completeQueryRetry != null) { + RetrySettings completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), completeQueryRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for completeQuery from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CompletionServiceClient bean configured with CompletionServiceSettings. + * + * @param completionServiceSettings settings to configure an instance of client bean. + * @return a {@link CompletionServiceClient} bean configured with {@link + * CompletionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public CompletionServiceClient completionServiceClient( + CompletionServiceSettings completionServiceSettings) throws IOException { + return CompletionServiceClient.create(completionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-completion-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringProperties.java new file mode 100644 index 0000000000..df6ff3c3fd --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/CompletionServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.retail.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 CompletionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.completion-service") +public class CompletionServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for completeQuery. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry completeQueryRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCompleteQueryRetry() { + return this.completeQueryRetry; + } + + public void setCompleteQueryRetry(Retry completeQueryRetry) { + this.completeQueryRetry = completeQueryRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..70af2eed11 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringAutoConfiguration.java @@ -0,0 +1,261 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.ControlServiceClient; +import com.google.cloud.retail.v2.ControlServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link ControlServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ControlServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link ControlServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ControlServiceSettings controlServiceSettings( + @Qualifier("defaultControlServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ControlServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ControlServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ControlServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + ControlServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings createControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createControlSettings().setRetrySettings(createControlRetrySettings); + + RetrySettings deleteControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteControlSettings().setRetrySettings(deleteControlRetrySettings); + + RetrySettings updateControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateControlSettings().setRetrySettings(updateControlRetrySettings); + + RetrySettings getControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getControlSettings().setRetrySettings(getControlRetrySettings); + + RetrySettings listControlsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listControlsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listControlsSettings().setRetrySettings(listControlsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createControlRetry = clientProperties.getCreateControlRetry(); + if (createControlRetry != null) { + RetrySettings createControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createControlSettings().getRetrySettings(), createControlRetry); + clientSettingsBuilder.createControlSettings().setRetrySettings(createControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createControl from properties."); + } + } + Retry deleteControlRetry = clientProperties.getDeleteControlRetry(); + if (deleteControlRetry != null) { + RetrySettings deleteControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteControlSettings().getRetrySettings(), deleteControlRetry); + clientSettingsBuilder.deleteControlSettings().setRetrySettings(deleteControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteControl from properties."); + } + } + Retry updateControlRetry = clientProperties.getUpdateControlRetry(); + if (updateControlRetry != null) { + RetrySettings updateControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateControlSettings().getRetrySettings(), updateControlRetry); + clientSettingsBuilder.updateControlSettings().setRetrySettings(updateControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateControl from properties."); + } + } + Retry getControlRetry = clientProperties.getGetControlRetry(); + if (getControlRetry != null) { + RetrySettings getControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getControlSettings().getRetrySettings(), getControlRetry); + clientSettingsBuilder.getControlSettings().setRetrySettings(getControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getControl from properties."); + } + } + Retry listControlsRetry = clientProperties.getListControlsRetry(); + if (listControlsRetry != null) { + RetrySettings listControlsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listControlsSettings().getRetrySettings(), listControlsRetry); + clientSettingsBuilder.listControlsSettings().setRetrySettings(listControlsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listControls from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ControlServiceClient bean configured with ControlServiceSettings. + * + * @param controlServiceSettings settings to configure an instance of client bean. + * @return a {@link ControlServiceClient} bean configured with {@link ControlServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ControlServiceClient controlServiceClient(ControlServiceSettings controlServiceSettings) + throws IOException { + return ControlServiceClient.create(controlServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-control-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringProperties.java new file mode 100644 index 0000000000..b87e0793a9 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ControlServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * Copyright 2022 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.retail.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 ControlService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.control-service") +public class ControlServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createControlRetry; + /** + * Allow override of retry settings at method-level for deleteControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteControlRetry; + /** + * Allow override of retry settings at method-level for updateControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateControlRetry; + /** + * Allow override of retry settings at method-level for getControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getControlRetry; + /** + * Allow override of retry settings at method-level for listControls. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listControlsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCreateControlRetry() { + return this.createControlRetry; + } + + public void setCreateControlRetry(Retry createControlRetry) { + this.createControlRetry = createControlRetry; + } + + public Retry getDeleteControlRetry() { + return this.deleteControlRetry; + } + + public void setDeleteControlRetry(Retry deleteControlRetry) { + this.deleteControlRetry = deleteControlRetry; + } + + public Retry getUpdateControlRetry() { + return this.updateControlRetry; + } + + public void setUpdateControlRetry(Retry updateControlRetry) { + this.updateControlRetry = updateControlRetry; + } + + public Retry getGetControlRetry() { + return this.getControlRetry; + } + + public void setGetControlRetry(Retry getControlRetry) { + this.getControlRetry = getControlRetry; + } + + public Retry getListControlsRetry() { + return this.listControlsRetry; + } + + public void setListControlsRetry(Retry listControlsRetry) { + this.listControlsRetry = listControlsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..30ae12ea0e --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringAutoConfiguration.java @@ -0,0 +1,203 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.PredictionServiceClient; +import com.google.cloud.retail.v2.PredictionServiceSettings; +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 PredictionServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in PredictionServiceSpringProperties. 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 PredictionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public PredictionServiceSettings predictionServiceSettings( + @Qualifier("defaultPredictionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + PredictionServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = PredictionServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = PredictionServiceSettings.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 = + PredictionServiceSettings.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 predictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.predictSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry predictRetry = clientProperties.getPredictRetry(); + if (predictRetry != null) { + RetrySettings predictRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.predictSettings().getRetrySettings(), predictRetry); + clientSettingsBuilder.predictSettings().setRetrySettings(predictRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for predict from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a PredictionServiceClient bean configured with PredictionServiceSettings. + * + * @param predictionServiceSettings settings to configure an instance of client bean. + * @return a {@link PredictionServiceClient} bean configured with {@link + * PredictionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public PredictionServiceClient predictionServiceClient( + PredictionServiceSettings predictionServiceSettings) throws IOException { + return PredictionServiceClient.create(predictionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-prediction-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringProperties.java new file mode 100644 index 0000000000..7bf9c93d25 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/PredictionServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.retail.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 PredictionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.prediction-service") +public class PredictionServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** 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 predict. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry predictRetry; + + @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 getPredictRetry() { + return this.predictRetry; + } + + public void setPredictRetry(Retry predictRetry) { + this.predictRetry = predictRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4c218aa603 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringAutoConfiguration.java @@ -0,0 +1,261 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.ProductServiceClient; +import com.google.cloud.retail.v2.ProductServiceSettings; +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 ProductServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ProductServiceSpringProperties. 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 ProductServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public ProductServiceSettings productServiceSettings( + @Qualifier("defaultProductServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ProductServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ProductServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ProductServiceSettings.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 = + ProductServiceSettings.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 createProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createProductSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createProductSettings().setRetrySettings(createProductRetrySettings); + + RetrySettings getProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProductSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getProductSettings().setRetrySettings(getProductRetrySettings); + + RetrySettings listProductsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProductsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listProductsSettings().setRetrySettings(listProductsRetrySettings); + + RetrySettings updateProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProductSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateProductSettings().setRetrySettings(updateProductRetrySettings); + + RetrySettings deleteProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteProductSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteProductSettings().setRetrySettings(deleteProductRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createProductRetry = clientProperties.getCreateProductRetry(); + if (createProductRetry != null) { + RetrySettings createProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createProductSettings().getRetrySettings(), createProductRetry); + clientSettingsBuilder.createProductSettings().setRetrySettings(createProductRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createProduct from properties."); + } + } + Retry getProductRetry = clientProperties.getGetProductRetry(); + if (getProductRetry != null) { + RetrySettings getProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getProductSettings().getRetrySettings(), getProductRetry); + clientSettingsBuilder.getProductSettings().setRetrySettings(getProductRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getProduct from properties."); + } + } + Retry listProductsRetry = clientProperties.getListProductsRetry(); + if (listProductsRetry != null) { + RetrySettings listProductsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listProductsSettings().getRetrySettings(), listProductsRetry); + clientSettingsBuilder.listProductsSettings().setRetrySettings(listProductsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listProducts from properties."); + } + } + Retry updateProductRetry = clientProperties.getUpdateProductRetry(); + if (updateProductRetry != null) { + RetrySettings updateProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateProductSettings().getRetrySettings(), updateProductRetry); + clientSettingsBuilder.updateProductSettings().setRetrySettings(updateProductRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateProduct from properties."); + } + } + Retry deleteProductRetry = clientProperties.getDeleteProductRetry(); + if (deleteProductRetry != null) { + RetrySettings deleteProductRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteProductSettings().getRetrySettings(), deleteProductRetry); + clientSettingsBuilder.deleteProductSettings().setRetrySettings(deleteProductRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteProduct from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ProductServiceClient bean configured with ProductServiceSettings. + * + * @param productServiceSettings settings to configure an instance of client bean. + * @return a {@link ProductServiceClient} bean configured with {@link ProductServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ProductServiceClient productServiceClient(ProductServiceSettings productServiceSettings) + throws IOException { + return ProductServiceClient.create(productServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-product-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringProperties.java new file mode 100644 index 0000000000..73c33431d8 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ProductServiceSpringProperties.java @@ -0,0 +1,147 @@ +/* + * Copyright 2022 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.retail.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 ProductService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.product-service") +public class ProductServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createProduct. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createProductRetry; + /** + * Allow override of retry settings at method-level for getProduct. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getProductRetry; + /** + * Allow override of retry settings at method-level for listProducts. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listProductsRetry; + /** + * Allow override of retry settings at method-level for updateProduct. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateProductRetry; + /** + * Allow override of retry settings at method-level for deleteProduct. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteProductRetry; + + @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 getCreateProductRetry() { + return this.createProductRetry; + } + + public void setCreateProductRetry(Retry createProductRetry) { + this.createProductRetry = createProductRetry; + } + + public Retry getGetProductRetry() { + return this.getProductRetry; + } + + public void setGetProductRetry(Retry getProductRetry) { + this.getProductRetry = getProductRetry; + } + + public Retry getListProductsRetry() { + return this.listProductsRetry; + } + + public void setListProductsRetry(Retry listProductsRetry) { + this.listProductsRetry = listProductsRetry; + } + + public Retry getUpdateProductRetry() { + return this.updateProductRetry; + } + + public void setUpdateProductRetry(Retry updateProductRetry) { + this.updateProductRetry = updateProductRetry; + } + + public Retry getDeleteProductRetry() { + return this.deleteProductRetry; + } + + public void setDeleteProductRetry(Retry deleteProductRetry) { + this.deleteProductRetry = deleteProductRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..3829d3ccc5 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringAutoConfiguration.java @@ -0,0 +1,201 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.SearchServiceClient; +import com.google.cloud.retail.v2.SearchServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link SearchServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in SearchServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link SearchServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public SearchServiceSettings searchServiceSettings( + @Qualifier("defaultSearchServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + SearchServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = SearchServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = SearchServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + SearchServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings searchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchSettings().setRetrySettings(searchRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry searchRetry = clientProperties.getSearchRetry(); + if (searchRetry != null) { + RetrySettings searchRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchSettings().getRetrySettings(), searchRetry); + clientSettingsBuilder.searchSettings().setRetrySettings(searchRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for search from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a SearchServiceClient bean configured with SearchServiceSettings. + * + * @param searchServiceSettings settings to configure an instance of client bean. + * @return a {@link SearchServiceClient} bean configured with {@link SearchServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public SearchServiceClient searchServiceClient(SearchServiceSettings searchServiceSettings) + throws IOException { + return SearchServiceClient.create(searchServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-search-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringProperties.java new file mode 100644 index 0000000000..33ab8f6e5a --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/SearchServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.retail.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 SearchService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.search-service") +public class SearchServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for search. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getSearchRetry() { + return this.searchRetry; + } + + public void setSearchRetry(Retry searchRetry) { + this.searchRetry = searchRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..73e322ecf0 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringAutoConfiguration.java @@ -0,0 +1,324 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.ServingConfigServiceClient; +import com.google.cloud.retail.v2.ServingConfigServiceSettings; +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 ServingConfigServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in ServingConfigServiceSpringProperties. 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 ServingConfigServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public ServingConfigServiceSettings servingConfigServiceSettings( + @Qualifier("defaultServingConfigServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + ServingConfigServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = ServingConfigServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = ServingConfigServiceSettings.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 = + ServingConfigServiceSettings.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 createServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createServingConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createServingConfigSettings() + .setRetrySettings(createServingConfigRetrySettings); + + RetrySettings deleteServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteServingConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .deleteServingConfigSettings() + .setRetrySettings(deleteServingConfigRetrySettings); + + RetrySettings updateServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateServingConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .updateServingConfigSettings() + .setRetrySettings(updateServingConfigRetrySettings); + + RetrySettings getServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServingConfigSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getServingConfigSettings() + .setRetrySettings(getServingConfigRetrySettings); + + RetrySettings listServingConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServingConfigsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listServingConfigsSettings() + .setRetrySettings(listServingConfigsRetrySettings); + + RetrySettings addControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.addControlSettings().setRetrySettings(addControlRetrySettings); + + RetrySettings removeControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeControlSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.removeControlSettings().setRetrySettings(removeControlRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createServingConfigRetry = clientProperties.getCreateServingConfigRetry(); + if (createServingConfigRetry != null) { + RetrySettings createServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createServingConfigSettings().getRetrySettings(), + createServingConfigRetry); + clientSettingsBuilder + .createServingConfigSettings() + .setRetrySettings(createServingConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createServingConfig from properties."); + } + } + Retry deleteServingConfigRetry = clientProperties.getDeleteServingConfigRetry(); + if (deleteServingConfigRetry != null) { + RetrySettings deleteServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteServingConfigSettings().getRetrySettings(), + deleteServingConfigRetry); + clientSettingsBuilder + .deleteServingConfigSettings() + .setRetrySettings(deleteServingConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for deleteServingConfig from properties."); + } + } + Retry updateServingConfigRetry = clientProperties.getUpdateServingConfigRetry(); + if (updateServingConfigRetry != null) { + RetrySettings updateServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateServingConfigSettings().getRetrySettings(), + updateServingConfigRetry); + clientSettingsBuilder + .updateServingConfigSettings() + .setRetrySettings(updateServingConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateServingConfig from properties."); + } + } + Retry getServingConfigRetry = clientProperties.getGetServingConfigRetry(); + if (getServingConfigRetry != null) { + RetrySettings getServingConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getServingConfigSettings().getRetrySettings(), + getServingConfigRetry); + clientSettingsBuilder + .getServingConfigSettings() + .setRetrySettings(getServingConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getServingConfig from properties."); + } + } + Retry listServingConfigsRetry = clientProperties.getListServingConfigsRetry(); + if (listServingConfigsRetry != null) { + RetrySettings listServingConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listServingConfigsSettings().getRetrySettings(), + listServingConfigsRetry); + clientSettingsBuilder + .listServingConfigsSettings() + .setRetrySettings(listServingConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listServingConfigs from properties."); + } + } + Retry addControlRetry = clientProperties.getAddControlRetry(); + if (addControlRetry != null) { + RetrySettings addControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.addControlSettings().getRetrySettings(), addControlRetry); + clientSettingsBuilder.addControlSettings().setRetrySettings(addControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for addControl from properties."); + } + } + Retry removeControlRetry = clientProperties.getRemoveControlRetry(); + if (removeControlRetry != null) { + RetrySettings removeControlRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.removeControlSettings().getRetrySettings(), removeControlRetry); + clientSettingsBuilder.removeControlSettings().setRetrySettings(removeControlRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for removeControl from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a ServingConfigServiceClient bean configured with ServingConfigServiceSettings. + * + * @param servingConfigServiceSettings settings to configure an instance of client bean. + * @return a {@link ServingConfigServiceClient} bean configured with {@link + * ServingConfigServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public ServingConfigServiceClient servingConfigServiceClient( + ServingConfigServiceSettings servingConfigServiceSettings) throws IOException { + return ServingConfigServiceClient.create(servingConfigServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-serving-config-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringProperties.java new file mode 100644 index 0000000000..6218b2125c --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/ServingConfigServiceSpringProperties.java @@ -0,0 +1,173 @@ +/* + * Copyright 2022 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.retail.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 ServingConfigService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.serving-config-service") +public class ServingConfigServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for createServingConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createServingConfigRetry; + /** + * Allow override of retry settings at method-level for deleteServingConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteServingConfigRetry; + /** + * Allow override of retry settings at method-level for updateServingConfig. If defined, this + * takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateServingConfigRetry; + /** + * Allow override of retry settings at method-level for getServingConfig. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getServingConfigRetry; + /** + * Allow override of retry settings at method-level for listServingConfigs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listServingConfigsRetry; + /** + * Allow override of retry settings at method-level for addControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry addControlRetry; + /** + * Allow override of retry settings at method-level for removeControl. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry removeControlRetry; + + @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 getCreateServingConfigRetry() { + return this.createServingConfigRetry; + } + + public void setCreateServingConfigRetry(Retry createServingConfigRetry) { + this.createServingConfigRetry = createServingConfigRetry; + } + + public Retry getDeleteServingConfigRetry() { + return this.deleteServingConfigRetry; + } + + public void setDeleteServingConfigRetry(Retry deleteServingConfigRetry) { + this.deleteServingConfigRetry = deleteServingConfigRetry; + } + + public Retry getUpdateServingConfigRetry() { + return this.updateServingConfigRetry; + } + + public void setUpdateServingConfigRetry(Retry updateServingConfigRetry) { + this.updateServingConfigRetry = updateServingConfigRetry; + } + + public Retry getGetServingConfigRetry() { + return this.getServingConfigRetry; + } + + public void setGetServingConfigRetry(Retry getServingConfigRetry) { + this.getServingConfigRetry = getServingConfigRetry; + } + + public Retry getListServingConfigsRetry() { + return this.listServingConfigsRetry; + } + + public void setListServingConfigsRetry(Retry listServingConfigsRetry) { + this.listServingConfigsRetry = listServingConfigsRetry; + } + + public Retry getAddControlRetry() { + return this.addControlRetry; + } + + public void setAddControlRetry(Retry addControlRetry) { + this.addControlRetry = addControlRetry; + } + + public Retry getRemoveControlRetry() { + return this.removeControlRetry; + } + + public void setRemoveControlRetry(Retry removeControlRetry) { + this.removeControlRetry = removeControlRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..aa66b5d9fc --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringAutoConfiguration.java @@ -0,0 +1,224 @@ +/* + * Copyright 2022 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.retail.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.retail.v2.UserEventServiceClient; +import com.google.cloud.retail.v2.UserEventServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link UserEventServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in UserEventServiceSpringProperties. Method-level properties will take precedence over
+ * service-level properties if available, and client library defaults will be used if neither are
+ * specified.
+ *
+ * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings.
+ * @return a {@link UserEventServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public UserEventServiceSettings userEventServiceSettings(
+ @Qualifier("defaultUserEventServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ UserEventServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = UserEventServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = UserEventServiceSettings.newBuilder();
+ }
+ clientSettingsBuilder
+ .setCredentialsProvider(this.credentialsProvider)
+ .setTransportChannelProvider(defaultTransportChannelProvider)
+ .setHeaderProvider(this.userAgentHeaderProvider());
+ if (this.clientProperties.getQuotaProjectId() != null) {
+ clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId());
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Quota project id set to "
+ + this.clientProperties.getQuotaProjectId()
+ + ", this overrides project id from credentials.");
+ }
+ }
+ if (this.clientProperties.getExecutorThreadCount() != null) {
+ ExecutorProvider executorProvider =
+ UserEventServiceSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ RetrySettings writeUserEventRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.writeUserEventSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.writeUserEventSettings().setRetrySettings(writeUserEventRetrySettings);
+
+ RetrySettings collectUserEventRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.collectUserEventSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .collectUserEventSettings()
+ .setRetrySettings(collectUserEventRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry writeUserEventRetry = clientProperties.getWriteUserEventRetry();
+ if (writeUserEventRetry != null) {
+ RetrySettings writeUserEventRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.writeUserEventSettings().getRetrySettings(),
+ writeUserEventRetry);
+ clientSettingsBuilder.writeUserEventSettings().setRetrySettings(writeUserEventRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for writeUserEvent from properties.");
+ }
+ }
+ Retry collectUserEventRetry = clientProperties.getCollectUserEventRetry();
+ if (collectUserEventRetry != null) {
+ RetrySettings collectUserEventRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.collectUserEventSettings().getRetrySettings(),
+ collectUserEventRetry);
+ clientSettingsBuilder
+ .collectUserEventSettings()
+ .setRetrySettings(collectUserEventRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for collectUserEvent from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a UserEventServiceClient bean configured with UserEventServiceSettings.
+ *
+ * @param userEventServiceSettings settings to configure an instance of client bean.
+ * @return a {@link UserEventServiceClient} bean configured with {@link UserEventServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public UserEventServiceClient userEventServiceClient(
+ UserEventServiceSettings userEventServiceSettings) throws IOException {
+ return UserEventServiceClient.create(userEventServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-user-event-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringProperties.java
new file mode 100644
index 0000000000..a3be6326e4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/UserEventServiceSpringProperties.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2022 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.retail.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 UserEventService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.retail.v2.user-event-service")
+public class UserEventServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for writeUserEvent. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry writeUserEventRetry;
+ /**
+ * Allow override of retry settings at method-level for collectUserEvent. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry collectUserEventRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getWriteUserEventRetry() {
+ return this.writeUserEventRetry;
+ }
+
+ public void setWriteUserEventRetry(Retry writeUserEventRetry) {
+ this.writeUserEventRetry = writeUserEventRetry;
+ }
+
+ public Retry getCollectUserEventRetry() {
+ return this.collectUserEventRetry;
+ }
+
+ public void setCollectUserEventRetry(Retry collectUserEventRetry) {
+ this.collectUserEventRetry = collectUserEventRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/package-info.java
new file mode 100644
index 0000000000..f18483a754
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for retail. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.retail.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..736ad80b9f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,52 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.retail.v2.catalog-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/CatalogService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.completion-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/CompletionService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.control-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/ControlService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.prediction-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/PredictionService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.product-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/ProductService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.search-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/SearchService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.serving-config-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/ServingConfigService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.retail.v2.user-event-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud retail/UserEventService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..c6a03edb37
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,8 @@
+com.google.cloud.retail.v2.spring.CatalogServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.CompletionServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.ControlServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.PredictionServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.ProductServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.SearchServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.ServingConfigServiceSpringAutoConfiguration
+com.google.cloud.retail.v2.spring.UserEventServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-scheduler-spring-starter/pom.xml
new file mode 100644
index 0000000000..c3652b7d24
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudSchedulerSpringProperties. 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 CloudSchedulerSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudSchedulerSettings cloudSchedulerSettings(
+ @Qualifier("defaultCloudSchedulerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudSchedulerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudSchedulerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudSchedulerSettings.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 =
+ CloudSchedulerSettings.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 listJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings);
+
+ RetrySettings getJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings);
+
+ RetrySettings createJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings);
+
+ RetrySettings updateJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings);
+
+ RetrySettings deleteJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings);
+
+ RetrySettings pauseJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.pauseJobSettings().setRetrySettings(pauseJobRetrySettings);
+
+ RetrySettings resumeJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.resumeJobSettings().setRetrySettings(resumeJobRetrySettings);
+
+ RetrySettings runJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.runJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.runJobSettings().setRetrySettings(runJobRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listJobsRetry = clientProperties.getListJobsRetry();
+ if (listJobsRetry != null) {
+ RetrySettings listJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobsSettings().getRetrySettings(), listJobsRetry);
+ clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listJobs from properties.");
+ }
+ }
+ Retry getJobRetry = clientProperties.getGetJobRetry();
+ if (getJobRetry != null) {
+ RetrySettings getJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobSettings().getRetrySettings(), getJobRetry);
+ clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJob from properties.");
+ }
+ }
+ Retry createJobRetry = clientProperties.getCreateJobRetry();
+ if (createJobRetry != null) {
+ RetrySettings createJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobSettings().getRetrySettings(), createJobRetry);
+ clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createJob from properties.");
+ }
+ }
+ Retry updateJobRetry = clientProperties.getUpdateJobRetry();
+ if (updateJobRetry != null) {
+ RetrySettings updateJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateJobSettings().getRetrySettings(), updateJobRetry);
+ clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateJob from properties.");
+ }
+ }
+ Retry deleteJobRetry = clientProperties.getDeleteJobRetry();
+ if (deleteJobRetry != null) {
+ RetrySettings deleteJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobSettings().getRetrySettings(), deleteJobRetry);
+ clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteJob from properties.");
+ }
+ }
+ Retry pauseJobRetry = clientProperties.getPauseJobRetry();
+ if (pauseJobRetry != null) {
+ RetrySettings pauseJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseJobSettings().getRetrySettings(), pauseJobRetry);
+ clientSettingsBuilder.pauseJobSettings().setRetrySettings(pauseJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for pauseJob from properties.");
+ }
+ }
+ Retry resumeJobRetry = clientProperties.getResumeJobRetry();
+ if (resumeJobRetry != null) {
+ RetrySettings resumeJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeJobSettings().getRetrySettings(), resumeJobRetry);
+ clientSettingsBuilder.resumeJobSettings().setRetrySettings(resumeJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for resumeJob from properties.");
+ }
+ }
+ Retry runJobRetry = clientProperties.getRunJobRetry();
+ if (runJobRetry != null) {
+ RetrySettings runJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.runJobSettings().getRetrySettings(), runJobRetry);
+ clientSettingsBuilder.runJobSettings().setRetrySettings(runJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for runJob from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudSchedulerClient bean configured with CloudSchedulerSettings.
+ *
+ * @param cloudSchedulerSettings settings to configure an instance of client bean.
+ * @return a {@link CloudSchedulerClient} bean configured with {@link CloudSchedulerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudSchedulerClient cloudSchedulerClient(CloudSchedulerSettings cloudSchedulerSettings)
+ throws IOException {
+ return CloudSchedulerClient.create(cloudSchedulerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-scheduler";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringProperties.java b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringProperties.java
new file mode 100644
index 0000000000..672ee10003
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/CloudSchedulerSpringProperties.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2022 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.scheduler.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 CloudScheduler client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.scheduler.v1.cloud-scheduler")
+public class CloudSchedulerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getJob. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJobRetry;
+ /**
+ * Allow override of retry settings at method-level for createJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createJobRetry;
+ /**
+ * Allow override of retry settings at method-level for updateJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateJobRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteJobRetry;
+ /**
+ * Allow override of retry settings at method-level for pauseJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry pauseJobRetry;
+ /**
+ * Allow override of retry settings at method-level for resumeJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry resumeJobRetry;
+ /**
+ * Allow override of retry settings at method-level for runJob. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry runJobRetry;
+
+ @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 getListJobsRetry() {
+ return this.listJobsRetry;
+ }
+
+ public void setListJobsRetry(Retry listJobsRetry) {
+ this.listJobsRetry = listJobsRetry;
+ }
+
+ public Retry getGetJobRetry() {
+ return this.getJobRetry;
+ }
+
+ public void setGetJobRetry(Retry getJobRetry) {
+ this.getJobRetry = getJobRetry;
+ }
+
+ public Retry getCreateJobRetry() {
+ return this.createJobRetry;
+ }
+
+ public void setCreateJobRetry(Retry createJobRetry) {
+ this.createJobRetry = createJobRetry;
+ }
+
+ public Retry getUpdateJobRetry() {
+ return this.updateJobRetry;
+ }
+
+ public void setUpdateJobRetry(Retry updateJobRetry) {
+ this.updateJobRetry = updateJobRetry;
+ }
+
+ public Retry getDeleteJobRetry() {
+ return this.deleteJobRetry;
+ }
+
+ public void setDeleteJobRetry(Retry deleteJobRetry) {
+ this.deleteJobRetry = deleteJobRetry;
+ }
+
+ public Retry getPauseJobRetry() {
+ return this.pauseJobRetry;
+ }
+
+ public void setPauseJobRetry(Retry pauseJobRetry) {
+ this.pauseJobRetry = pauseJobRetry;
+ }
+
+ public Retry getResumeJobRetry() {
+ return this.resumeJobRetry;
+ }
+
+ public void setResumeJobRetry(Retry resumeJobRetry) {
+ this.resumeJobRetry = resumeJobRetry;
+ }
+
+ public Retry getRunJobRetry() {
+ return this.runJobRetry;
+ }
+
+ public void setRunJobRetry(Retry runJobRetry) {
+ this.runJobRetry = runJobRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/package-info.java
new file mode 100644
index 0000000000..f3789d2c21
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/java/com/google/cloud/scheduler/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudscheduler. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.scheduler.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..ff0e24c136
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.scheduler.v1.cloud-scheduler.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudscheduler/CloudScheduler components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..7dec5aac5d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-scheduler-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.scheduler.v1.spring.CloudSchedulerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/pom.xml
new file mode 100644
index 0000000000..770d679ad5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CertificateAuthorityServiceSpringProperties. 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 CertificateAuthorityServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CertificateAuthorityServiceSettings certificateAuthorityServiceSettings(
+ @Qualifier("defaultCertificateAuthorityServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CertificateAuthorityServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CertificateAuthorityServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CertificateAuthorityServiceSettings.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 =
+ CertificateAuthorityServiceSettings.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 createCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCertificateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createCertificateSettings()
+ .setRetrySettings(createCertificateRetrySettings);
+
+ RetrySettings getCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCertificateSettings().setRetrySettings(getCertificateRetrySettings);
+
+ RetrySettings listCertificatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificatesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listCertificatesSettings()
+ .setRetrySettings(listCertificatesRetrySettings);
+
+ RetrySettings revokeCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.revokeCertificateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .revokeCertificateSettings()
+ .setRetrySettings(revokeCertificateRetrySettings);
+
+ RetrySettings updateCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCertificateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateCertificateSettings()
+ .setRetrySettings(updateCertificateRetrySettings);
+
+ RetrySettings fetchCertificateAuthorityCsrRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchCertificateAuthorityCsrSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .fetchCertificateAuthorityCsrSettings()
+ .setRetrySettings(fetchCertificateAuthorityCsrRetrySettings);
+
+ RetrySettings getCertificateAuthorityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateAuthoritySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getCertificateAuthoritySettings()
+ .setRetrySettings(getCertificateAuthorityRetrySettings);
+
+ RetrySettings listCertificateAuthoritiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateAuthoritiesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listCertificateAuthoritiesSettings()
+ .setRetrySettings(listCertificateAuthoritiesRetrySettings);
+
+ RetrySettings getCaPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCaPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCaPoolSettings().setRetrySettings(getCaPoolRetrySettings);
+
+ RetrySettings listCaPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCaPoolsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listCaPoolsSettings().setRetrySettings(listCaPoolsRetrySettings);
+
+ RetrySettings fetchCaCertsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchCaCertsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.fetchCaCertsSettings().setRetrySettings(fetchCaCertsRetrySettings);
+
+ RetrySettings getCertificateRevocationListRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateRevocationListSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getCertificateRevocationListSettings()
+ .setRetrySettings(getCertificateRevocationListRetrySettings);
+
+ RetrySettings listCertificateRevocationListsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateRevocationListsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listCertificateRevocationListsSettings()
+ .setRetrySettings(listCertificateRevocationListsRetrySettings);
+
+ RetrySettings getCertificateTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateTemplateSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getCertificateTemplateSettings()
+ .setRetrySettings(getCertificateTemplateRetrySettings);
+
+ RetrySettings listCertificateTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateTemplatesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listCertificateTemplatesSettings()
+ .setRetrySettings(listCertificateTemplatesRetrySettings);
+
+ 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 createCertificateRetry = clientProperties.getCreateCertificateRetry();
+ if (createCertificateRetry != null) {
+ RetrySettings createCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createCertificateSettings().getRetrySettings(),
+ createCertificateRetry);
+ clientSettingsBuilder
+ .createCertificateSettings()
+ .setRetrySettings(createCertificateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createCertificate from properties.");
+ }
+ }
+ Retry getCertificateRetry = clientProperties.getGetCertificateRetry();
+ if (getCertificateRetry != null) {
+ RetrySettings getCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateSettings().getRetrySettings(),
+ getCertificateRetry);
+ clientSettingsBuilder.getCertificateSettings().setRetrySettings(getCertificateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCertificate from properties.");
+ }
+ }
+ Retry listCertificatesRetry = clientProperties.getListCertificatesRetry();
+ if (listCertificatesRetry != null) {
+ RetrySettings listCertificatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificatesSettings().getRetrySettings(),
+ listCertificatesRetry);
+ clientSettingsBuilder
+ .listCertificatesSettings()
+ .setRetrySettings(listCertificatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCertificates from properties.");
+ }
+ }
+ Retry revokeCertificateRetry = clientProperties.getRevokeCertificateRetry();
+ if (revokeCertificateRetry != null) {
+ RetrySettings revokeCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.revokeCertificateSettings().getRetrySettings(),
+ revokeCertificateRetry);
+ clientSettingsBuilder
+ .revokeCertificateSettings()
+ .setRetrySettings(revokeCertificateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for revokeCertificate from properties.");
+ }
+ }
+ Retry updateCertificateRetry = clientProperties.getUpdateCertificateRetry();
+ if (updateCertificateRetry != null) {
+ RetrySettings updateCertificateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateCertificateSettings().getRetrySettings(),
+ updateCertificateRetry);
+ clientSettingsBuilder
+ .updateCertificateSettings()
+ .setRetrySettings(updateCertificateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateCertificate from properties.");
+ }
+ }
+ Retry fetchCertificateAuthorityCsrRetry =
+ clientProperties.getFetchCertificateAuthorityCsrRetry();
+ if (fetchCertificateAuthorityCsrRetry != null) {
+ RetrySettings fetchCertificateAuthorityCsrRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchCertificateAuthorityCsrSettings().getRetrySettings(),
+ fetchCertificateAuthorityCsrRetry);
+ clientSettingsBuilder
+ .fetchCertificateAuthorityCsrSettings()
+ .setRetrySettings(fetchCertificateAuthorityCsrRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for fetchCertificateAuthorityCsr from properties.");
+ }
+ }
+ Retry getCertificateAuthorityRetry = clientProperties.getGetCertificateAuthorityRetry();
+ if (getCertificateAuthorityRetry != null) {
+ RetrySettings getCertificateAuthorityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateAuthoritySettings().getRetrySettings(),
+ getCertificateAuthorityRetry);
+ clientSettingsBuilder
+ .getCertificateAuthoritySettings()
+ .setRetrySettings(getCertificateAuthorityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getCertificateAuthority from properties.");
+ }
+ }
+ Retry listCertificateAuthoritiesRetry = clientProperties.getListCertificateAuthoritiesRetry();
+ if (listCertificateAuthoritiesRetry != null) {
+ RetrySettings listCertificateAuthoritiesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateAuthoritiesSettings().getRetrySettings(),
+ listCertificateAuthoritiesRetry);
+ clientSettingsBuilder
+ .listCertificateAuthoritiesSettings()
+ .setRetrySettings(listCertificateAuthoritiesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCertificateAuthorities from properties.");
+ }
+ }
+ Retry getCaPoolRetry = clientProperties.getGetCaPoolRetry();
+ if (getCaPoolRetry != null) {
+ RetrySettings getCaPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCaPoolSettings().getRetrySettings(), getCaPoolRetry);
+ clientSettingsBuilder.getCaPoolSettings().setRetrySettings(getCaPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCaPool from properties.");
+ }
+ }
+ Retry listCaPoolsRetry = clientProperties.getListCaPoolsRetry();
+ if (listCaPoolsRetry != null) {
+ RetrySettings listCaPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCaPoolsSettings().getRetrySettings(), listCaPoolsRetry);
+ clientSettingsBuilder.listCaPoolsSettings().setRetrySettings(listCaPoolsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listCaPools from properties.");
+ }
+ }
+ Retry fetchCaCertsRetry = clientProperties.getFetchCaCertsRetry();
+ if (fetchCaCertsRetry != null) {
+ RetrySettings fetchCaCertsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchCaCertsSettings().getRetrySettings(), fetchCaCertsRetry);
+ clientSettingsBuilder.fetchCaCertsSettings().setRetrySettings(fetchCaCertsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for fetchCaCerts from properties.");
+ }
+ }
+ Retry getCertificateRevocationListRetry =
+ clientProperties.getGetCertificateRevocationListRetry();
+ if (getCertificateRevocationListRetry != null) {
+ RetrySettings getCertificateRevocationListRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateRevocationListSettings().getRetrySettings(),
+ getCertificateRevocationListRetry);
+ clientSettingsBuilder
+ .getCertificateRevocationListSettings()
+ .setRetrySettings(getCertificateRevocationListRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getCertificateRevocationList from properties.");
+ }
+ }
+ Retry listCertificateRevocationListsRetry =
+ clientProperties.getListCertificateRevocationListsRetry();
+ if (listCertificateRevocationListsRetry != null) {
+ RetrySettings listCertificateRevocationListsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateRevocationListsSettings().getRetrySettings(),
+ listCertificateRevocationListsRetry);
+ clientSettingsBuilder
+ .listCertificateRevocationListsSettings()
+ .setRetrySettings(listCertificateRevocationListsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCertificateRevocationLists from properties.");
+ }
+ }
+ Retry getCertificateTemplateRetry = clientProperties.getGetCertificateTemplateRetry();
+ if (getCertificateTemplateRetry != null) {
+ RetrySettings getCertificateTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCertificateTemplateSettings().getRetrySettings(),
+ getCertificateTemplateRetry);
+ clientSettingsBuilder
+ .getCertificateTemplateSettings()
+ .setRetrySettings(getCertificateTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getCertificateTemplate from properties.");
+ }
+ }
+ Retry listCertificateTemplatesRetry = clientProperties.getListCertificateTemplatesRetry();
+ if (listCertificateTemplatesRetry != null) {
+ RetrySettings listCertificateTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCertificateTemplatesSettings().getRetrySettings(),
+ listCertificateTemplatesRetry);
+ clientSettingsBuilder
+ .listCertificateTemplatesSettings()
+ .setRetrySettings(listCertificateTemplatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCertificateTemplates 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 CertificateAuthorityServiceClient bean configured with
+ * CertificateAuthorityServiceSettings.
+ *
+ * @param certificateAuthorityServiceSettings settings to configure an instance of client bean.
+ * @return a {@link CertificateAuthorityServiceClient} bean configured with {@link
+ * CertificateAuthorityServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CertificateAuthorityServiceClient certificateAuthorityServiceClient(
+ CertificateAuthorityServiceSettings certificateAuthorityServiceSettings) throws IOException {
+ return CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-certificate-authority-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringProperties.java b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringProperties.java
new file mode 100644
index 0000000000..ec13dc2a40
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/CertificateAuthorityServiceSpringProperties.java
@@ -0,0 +1,342 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.security.privateca.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 CertificateAuthorityService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.security.privateca.v1.certificate-authority-service")
+public class CertificateAuthorityServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createCertificate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createCertificateRetry;
+ /**
+ * Allow override of retry settings at method-level for getCertificate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCertificateRetry;
+ /**
+ * Allow override of retry settings at method-level for listCertificates. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCertificatesRetry;
+ /**
+ * Allow override of retry settings at method-level for revokeCertificate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry revokeCertificateRetry;
+ /**
+ * Allow override of retry settings at method-level for updateCertificate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateCertificateRetry;
+ /**
+ * Allow override of retry settings at method-level for fetchCertificateAuthorityCsr. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry fetchCertificateAuthorityCsrRetry;
+ /**
+ * Allow override of retry settings at method-level for getCertificateAuthority. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCertificateAuthorityRetry;
+ /**
+ * Allow override of retry settings at method-level for listCertificateAuthorities. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCertificateAuthoritiesRetry;
+ /**
+ * Allow override of retry settings at method-level for getCaPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCaPoolRetry;
+ /**
+ * Allow override of retry settings at method-level for listCaPools. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCaPoolsRetry;
+ /**
+ * Allow override of retry settings at method-level for fetchCaCerts. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry fetchCaCertsRetry;
+ /**
+ * Allow override of retry settings at method-level for getCertificateRevocationList. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCertificateRevocationListRetry;
+ /**
+ * Allow override of retry settings at method-level for listCertificateRevocationLists. If
+ * defined, this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCertificateRevocationListsRetry;
+ /**
+ * Allow override of retry settings at method-level for getCertificateTemplate. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCertificateTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for listCertificateTemplates. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCertificateTemplatesRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getCreateCertificateRetry() {
+ return this.createCertificateRetry;
+ }
+
+ public void setCreateCertificateRetry(Retry createCertificateRetry) {
+ this.createCertificateRetry = createCertificateRetry;
+ }
+
+ public Retry getGetCertificateRetry() {
+ return this.getCertificateRetry;
+ }
+
+ public void setGetCertificateRetry(Retry getCertificateRetry) {
+ this.getCertificateRetry = getCertificateRetry;
+ }
+
+ public Retry getListCertificatesRetry() {
+ return this.listCertificatesRetry;
+ }
+
+ public void setListCertificatesRetry(Retry listCertificatesRetry) {
+ this.listCertificatesRetry = listCertificatesRetry;
+ }
+
+ public Retry getRevokeCertificateRetry() {
+ return this.revokeCertificateRetry;
+ }
+
+ public void setRevokeCertificateRetry(Retry revokeCertificateRetry) {
+ this.revokeCertificateRetry = revokeCertificateRetry;
+ }
+
+ public Retry getUpdateCertificateRetry() {
+ return this.updateCertificateRetry;
+ }
+
+ public void setUpdateCertificateRetry(Retry updateCertificateRetry) {
+ this.updateCertificateRetry = updateCertificateRetry;
+ }
+
+ public Retry getFetchCertificateAuthorityCsrRetry() {
+ return this.fetchCertificateAuthorityCsrRetry;
+ }
+
+ public void setFetchCertificateAuthorityCsrRetry(Retry fetchCertificateAuthorityCsrRetry) {
+ this.fetchCertificateAuthorityCsrRetry = fetchCertificateAuthorityCsrRetry;
+ }
+
+ public Retry getGetCertificateAuthorityRetry() {
+ return this.getCertificateAuthorityRetry;
+ }
+
+ public void setGetCertificateAuthorityRetry(Retry getCertificateAuthorityRetry) {
+ this.getCertificateAuthorityRetry = getCertificateAuthorityRetry;
+ }
+
+ public Retry getListCertificateAuthoritiesRetry() {
+ return this.listCertificateAuthoritiesRetry;
+ }
+
+ public void setListCertificateAuthoritiesRetry(Retry listCertificateAuthoritiesRetry) {
+ this.listCertificateAuthoritiesRetry = listCertificateAuthoritiesRetry;
+ }
+
+ public Retry getGetCaPoolRetry() {
+ return this.getCaPoolRetry;
+ }
+
+ public void setGetCaPoolRetry(Retry getCaPoolRetry) {
+ this.getCaPoolRetry = getCaPoolRetry;
+ }
+
+ public Retry getListCaPoolsRetry() {
+ return this.listCaPoolsRetry;
+ }
+
+ public void setListCaPoolsRetry(Retry listCaPoolsRetry) {
+ this.listCaPoolsRetry = listCaPoolsRetry;
+ }
+
+ public Retry getFetchCaCertsRetry() {
+ return this.fetchCaCertsRetry;
+ }
+
+ public void setFetchCaCertsRetry(Retry fetchCaCertsRetry) {
+ this.fetchCaCertsRetry = fetchCaCertsRetry;
+ }
+
+ public Retry getGetCertificateRevocationListRetry() {
+ return this.getCertificateRevocationListRetry;
+ }
+
+ public void setGetCertificateRevocationListRetry(Retry getCertificateRevocationListRetry) {
+ this.getCertificateRevocationListRetry = getCertificateRevocationListRetry;
+ }
+
+ public Retry getListCertificateRevocationListsRetry() {
+ return this.listCertificateRevocationListsRetry;
+ }
+
+ public void setListCertificateRevocationListsRetry(Retry listCertificateRevocationListsRetry) {
+ this.listCertificateRevocationListsRetry = listCertificateRevocationListsRetry;
+ }
+
+ public Retry getGetCertificateTemplateRetry() {
+ return this.getCertificateTemplateRetry;
+ }
+
+ public void setGetCertificateTemplateRetry(Retry getCertificateTemplateRetry) {
+ this.getCertificateTemplateRetry = getCertificateTemplateRetry;
+ }
+
+ public Retry getListCertificateTemplatesRetry() {
+ return this.listCertificateTemplatesRetry;
+ }
+
+ public void setListCertificateTemplatesRetry(Retry listCertificateTemplatesRetry) {
+ this.listCertificateTemplatesRetry = listCertificateTemplatesRetry;
+ }
+
+ 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-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/package-info.java
new file mode 100644
index 0000000000..de44966b8c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/java/com/google/cloud/security/privateca/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for privateca. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.security.privateca.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..922646107c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.security.privateca.v1.certificate-authority-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud privateca/CertificateAuthorityService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..01bebaf377
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-security-private-ca-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.security.privateca.v1.spring.CertificateAuthorityServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/pom.xml
new file mode 100644
index 0000000000..b82e2c197a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in SecurityCenterSpringProperties. 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 SecurityCenterSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public SecurityCenterSettings securityCenterSettings(
+ @Qualifier("defaultSecurityCenterTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ SecurityCenterSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = SecurityCenterSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = SecurityCenterSettings.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 =
+ SecurityCenterSettings.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 createSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSourceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createSourceSettings().setRetrySettings(createSourceRetrySettings);
+
+ RetrySettings createFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createFindingSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createFindingSettings().setRetrySettings(createFindingRetrySettings);
+
+ RetrySettings createMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createMuteConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createMuteConfigSettings()
+ .setRetrySettings(createMuteConfigRetrySettings);
+
+ RetrySettings createNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNotificationConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createNotificationConfigSettings()
+ .setRetrySettings(createNotificationConfigRetrySettings);
+
+ RetrySettings deleteMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteMuteConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteMuteConfigSettings()
+ .setRetrySettings(deleteMuteConfigRetrySettings);
+
+ RetrySettings deleteNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNotificationConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteNotificationConfigSettings()
+ .setRetrySettings(deleteNotificationConfigRetrySettings);
+
+ RetrySettings getBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBigQueryExportSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getBigQueryExportSettings()
+ .setRetrySettings(getBigQueryExportRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings getMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMuteConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getMuteConfigSettings().setRetrySettings(getMuteConfigRetrySettings);
+
+ RetrySettings getNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNotificationConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getNotificationConfigSettings()
+ .setRetrySettings(getNotificationConfigRetrySettings);
+
+ RetrySettings getOrganizationSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOrganizationSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getOrganizationSettingsSettings()
+ .setRetrySettings(getOrganizationSettingsRetrySettings);
+
+ RetrySettings getSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSourceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getSourceSettings().setRetrySettings(getSourceRetrySettings);
+
+ RetrySettings groupAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.groupAssetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.groupAssetsSettings().setRetrySettings(groupAssetsRetrySettings);
+
+ RetrySettings groupFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.groupFindingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.groupFindingsSettings().setRetrySettings(groupFindingsRetrySettings);
+
+ RetrySettings listAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings);
+
+ RetrySettings listFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFindingsSettings().setRetrySettings(listFindingsRetrySettings);
+
+ RetrySettings listMuteConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMuteConfigsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listMuteConfigsSettings()
+ .setRetrySettings(listMuteConfigsRetrySettings);
+
+ RetrySettings listNotificationConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNotificationConfigsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listNotificationConfigsSettings()
+ .setRetrySettings(listNotificationConfigsRetrySettings);
+
+ RetrySettings listSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSourcesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSourcesSettings().setRetrySettings(listSourcesRetrySettings);
+
+ RetrySettings setFindingStateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setFindingStateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .setFindingStateSettings()
+ .setRetrySettings(setFindingStateRetrySettings);
+
+ RetrySettings setMuteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMuteSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setMuteSettings().setRetrySettings(setMuteRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings updateExternalSystemRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateExternalSystemSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateExternalSystemSettings()
+ .setRetrySettings(updateExternalSystemRetrySettings);
+
+ RetrySettings updateFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateFindingSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateFindingSettings().setRetrySettings(updateFindingRetrySettings);
+
+ RetrySettings updateMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateMuteConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateMuteConfigSettings()
+ .setRetrySettings(updateMuteConfigRetrySettings);
+
+ RetrySettings updateNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNotificationConfigSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateNotificationConfigSettings()
+ .setRetrySettings(updateNotificationConfigRetrySettings);
+
+ RetrySettings updateOrganizationSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateOrganizationSettingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateOrganizationSettingsSettings()
+ .setRetrySettings(updateOrganizationSettingsRetrySettings);
+
+ RetrySettings updateSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSourceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateSourceSettings().setRetrySettings(updateSourceRetrySettings);
+
+ RetrySettings updateSecurityMarksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSecurityMarksSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateSecurityMarksSettings()
+ .setRetrySettings(updateSecurityMarksRetrySettings);
+
+ RetrySettings createBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBigQueryExportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createBigQueryExportSettings()
+ .setRetrySettings(createBigQueryExportRetrySettings);
+
+ RetrySettings deleteBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBigQueryExportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteBigQueryExportSettings()
+ .setRetrySettings(deleteBigQueryExportRetrySettings);
+
+ RetrySettings updateBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBigQueryExportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateBigQueryExportSettings()
+ .setRetrySettings(updateBigQueryExportRetrySettings);
+
+ RetrySettings listBigQueryExportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBigQueryExportsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listBigQueryExportsSettings()
+ .setRetrySettings(listBigQueryExportsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createSourceRetry = clientProperties.getCreateSourceRetry();
+ if (createSourceRetry != null) {
+ RetrySettings createSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSourceSettings().getRetrySettings(), createSourceRetry);
+ clientSettingsBuilder.createSourceSettings().setRetrySettings(createSourceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createSource from properties.");
+ }
+ }
+ Retry createFindingRetry = clientProperties.getCreateFindingRetry();
+ if (createFindingRetry != null) {
+ RetrySettings createFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createFindingSettings().getRetrySettings(), createFindingRetry);
+ clientSettingsBuilder.createFindingSettings().setRetrySettings(createFindingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createFinding from properties.");
+ }
+ }
+ Retry createMuteConfigRetry = clientProperties.getCreateMuteConfigRetry();
+ if (createMuteConfigRetry != null) {
+ RetrySettings createMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createMuteConfigSettings().getRetrySettings(),
+ createMuteConfigRetry);
+ clientSettingsBuilder
+ .createMuteConfigSettings()
+ .setRetrySettings(createMuteConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createMuteConfig from properties.");
+ }
+ }
+ Retry createNotificationConfigRetry = clientProperties.getCreateNotificationConfigRetry();
+ if (createNotificationConfigRetry != null) {
+ RetrySettings createNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNotificationConfigSettings().getRetrySettings(),
+ createNotificationConfigRetry);
+ clientSettingsBuilder
+ .createNotificationConfigSettings()
+ .setRetrySettings(createNotificationConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createNotificationConfig from properties.");
+ }
+ }
+ Retry deleteMuteConfigRetry = clientProperties.getDeleteMuteConfigRetry();
+ if (deleteMuteConfigRetry != null) {
+ RetrySettings deleteMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteMuteConfigSettings().getRetrySettings(),
+ deleteMuteConfigRetry);
+ clientSettingsBuilder
+ .deleteMuteConfigSettings()
+ .setRetrySettings(deleteMuteConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteMuteConfig from properties.");
+ }
+ }
+ Retry deleteNotificationConfigRetry = clientProperties.getDeleteNotificationConfigRetry();
+ if (deleteNotificationConfigRetry != null) {
+ RetrySettings deleteNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNotificationConfigSettings().getRetrySettings(),
+ deleteNotificationConfigRetry);
+ clientSettingsBuilder
+ .deleteNotificationConfigSettings()
+ .setRetrySettings(deleteNotificationConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteNotificationConfig from properties.");
+ }
+ }
+ Retry getBigQueryExportRetry = clientProperties.getGetBigQueryExportRetry();
+ if (getBigQueryExportRetry != null) {
+ RetrySettings getBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getBigQueryExportSettings().getRetrySettings(),
+ getBigQueryExportRetry);
+ clientSettingsBuilder
+ .getBigQueryExportSettings()
+ .setRetrySettings(getBigQueryExportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getBigQueryExport 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 getMuteConfigRetry = clientProperties.getGetMuteConfigRetry();
+ if (getMuteConfigRetry != null) {
+ RetrySettings getMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMuteConfigSettings().getRetrySettings(), getMuteConfigRetry);
+ clientSettingsBuilder.getMuteConfigSettings().setRetrySettings(getMuteConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getMuteConfig from properties.");
+ }
+ }
+ Retry getNotificationConfigRetry = clientProperties.getGetNotificationConfigRetry();
+ if (getNotificationConfigRetry != null) {
+ RetrySettings getNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNotificationConfigSettings().getRetrySettings(),
+ getNotificationConfigRetry);
+ clientSettingsBuilder
+ .getNotificationConfigSettings()
+ .setRetrySettings(getNotificationConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getNotificationConfig from properties.");
+ }
+ }
+ Retry getOrganizationSettingsRetry = clientProperties.getGetOrganizationSettingsRetry();
+ if (getOrganizationSettingsRetry != null) {
+ RetrySettings getOrganizationSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getOrganizationSettingsSettings().getRetrySettings(),
+ getOrganizationSettingsRetry);
+ clientSettingsBuilder
+ .getOrganizationSettingsSettings()
+ .setRetrySettings(getOrganizationSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getOrganizationSettings from properties.");
+ }
+ }
+ Retry getSourceRetry = clientProperties.getGetSourceRetry();
+ if (getSourceRetry != null) {
+ RetrySettings getSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSourceSettings().getRetrySettings(), getSourceRetry);
+ clientSettingsBuilder.getSourceSettings().setRetrySettings(getSourceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSource from properties.");
+ }
+ }
+ Retry groupAssetsRetry = clientProperties.getGroupAssetsRetry();
+ if (groupAssetsRetry != null) {
+ RetrySettings groupAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.groupAssetsSettings().getRetrySettings(), groupAssetsRetry);
+ clientSettingsBuilder.groupAssetsSettings().setRetrySettings(groupAssetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for groupAssets from properties.");
+ }
+ }
+ Retry groupFindingsRetry = clientProperties.getGroupFindingsRetry();
+ if (groupFindingsRetry != null) {
+ RetrySettings groupFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.groupFindingsSettings().getRetrySettings(), groupFindingsRetry);
+ clientSettingsBuilder.groupFindingsSettings().setRetrySettings(groupFindingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for groupFindings from properties.");
+ }
+ }
+ Retry listAssetsRetry = clientProperties.getListAssetsRetry();
+ if (listAssetsRetry != null) {
+ RetrySettings listAssetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAssetsSettings().getRetrySettings(), listAssetsRetry);
+ clientSettingsBuilder.listAssetsSettings().setRetrySettings(listAssetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listAssets from properties.");
+ }
+ }
+ Retry listFindingsRetry = clientProperties.getListFindingsRetry();
+ if (listFindingsRetry != null) {
+ RetrySettings listFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingsSettings().getRetrySettings(), listFindingsRetry);
+ clientSettingsBuilder.listFindingsSettings().setRetrySettings(listFindingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFindings from properties.");
+ }
+ }
+ Retry listMuteConfigsRetry = clientProperties.getListMuteConfigsRetry();
+ if (listMuteConfigsRetry != null) {
+ RetrySettings listMuteConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMuteConfigsSettings().getRetrySettings(),
+ listMuteConfigsRetry);
+ clientSettingsBuilder
+ .listMuteConfigsSettings()
+ .setRetrySettings(listMuteConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listMuteConfigs from properties.");
+ }
+ }
+ Retry listNotificationConfigsRetry = clientProperties.getListNotificationConfigsRetry();
+ if (listNotificationConfigsRetry != null) {
+ RetrySettings listNotificationConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNotificationConfigsSettings().getRetrySettings(),
+ listNotificationConfigsRetry);
+ clientSettingsBuilder
+ .listNotificationConfigsSettings()
+ .setRetrySettings(listNotificationConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listNotificationConfigs from properties.");
+ }
+ }
+ Retry listSourcesRetry = clientProperties.getListSourcesRetry();
+ if (listSourcesRetry != null) {
+ RetrySettings listSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSourcesSettings().getRetrySettings(), listSourcesRetry);
+ clientSettingsBuilder.listSourcesSettings().setRetrySettings(listSourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSources from properties.");
+ }
+ }
+ Retry setFindingStateRetry = clientProperties.getSetFindingStateRetry();
+ if (setFindingStateRetry != null) {
+ RetrySettings setFindingStateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setFindingStateSettings().getRetrySettings(),
+ setFindingStateRetry);
+ clientSettingsBuilder
+ .setFindingStateSettings()
+ .setRetrySettings(setFindingStateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setFindingState from properties.");
+ }
+ }
+ Retry setMuteRetry = clientProperties.getSetMuteRetry();
+ if (setMuteRetry != null) {
+ RetrySettings setMuteRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setMuteSettings().getRetrySettings(), setMuteRetry);
+ clientSettingsBuilder.setMuteSettings().setRetrySettings(setMuteRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setMute 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.");
+ }
+ }
+ Retry updateExternalSystemRetry = clientProperties.getUpdateExternalSystemRetry();
+ if (updateExternalSystemRetry != null) {
+ RetrySettings updateExternalSystemRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateExternalSystemSettings().getRetrySettings(),
+ updateExternalSystemRetry);
+ clientSettingsBuilder
+ .updateExternalSystemSettings()
+ .setRetrySettings(updateExternalSystemRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateExternalSystem from properties.");
+ }
+ }
+ Retry updateFindingRetry = clientProperties.getUpdateFindingRetry();
+ if (updateFindingRetry != null) {
+ RetrySettings updateFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateFindingSettings().getRetrySettings(), updateFindingRetry);
+ clientSettingsBuilder.updateFindingSettings().setRetrySettings(updateFindingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateFinding from properties.");
+ }
+ }
+ Retry updateMuteConfigRetry = clientProperties.getUpdateMuteConfigRetry();
+ if (updateMuteConfigRetry != null) {
+ RetrySettings updateMuteConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateMuteConfigSettings().getRetrySettings(),
+ updateMuteConfigRetry);
+ clientSettingsBuilder
+ .updateMuteConfigSettings()
+ .setRetrySettings(updateMuteConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateMuteConfig from properties.");
+ }
+ }
+ Retry updateNotificationConfigRetry = clientProperties.getUpdateNotificationConfigRetry();
+ if (updateNotificationConfigRetry != null) {
+ RetrySettings updateNotificationConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNotificationConfigSettings().getRetrySettings(),
+ updateNotificationConfigRetry);
+ clientSettingsBuilder
+ .updateNotificationConfigSettings()
+ .setRetrySettings(updateNotificationConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateNotificationConfig from properties.");
+ }
+ }
+ Retry updateOrganizationSettingsRetry = clientProperties.getUpdateOrganizationSettingsRetry();
+ if (updateOrganizationSettingsRetry != null) {
+ RetrySettings updateOrganizationSettingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateOrganizationSettingsSettings().getRetrySettings(),
+ updateOrganizationSettingsRetry);
+ clientSettingsBuilder
+ .updateOrganizationSettingsSettings()
+ .setRetrySettings(updateOrganizationSettingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateOrganizationSettings from properties.");
+ }
+ }
+ Retry updateSourceRetry = clientProperties.getUpdateSourceRetry();
+ if (updateSourceRetry != null) {
+ RetrySettings updateSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSourceSettings().getRetrySettings(), updateSourceRetry);
+ clientSettingsBuilder.updateSourceSettings().setRetrySettings(updateSourceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateSource from properties.");
+ }
+ }
+ Retry updateSecurityMarksRetry = clientProperties.getUpdateSecurityMarksRetry();
+ if (updateSecurityMarksRetry != null) {
+ RetrySettings updateSecurityMarksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateSecurityMarksSettings().getRetrySettings(),
+ updateSecurityMarksRetry);
+ clientSettingsBuilder
+ .updateSecurityMarksSettings()
+ .setRetrySettings(updateSecurityMarksRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateSecurityMarks from properties.");
+ }
+ }
+ Retry createBigQueryExportRetry = clientProperties.getCreateBigQueryExportRetry();
+ if (createBigQueryExportRetry != null) {
+ RetrySettings createBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createBigQueryExportSettings().getRetrySettings(),
+ createBigQueryExportRetry);
+ clientSettingsBuilder
+ .createBigQueryExportSettings()
+ .setRetrySettings(createBigQueryExportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createBigQueryExport from properties.");
+ }
+ }
+ Retry deleteBigQueryExportRetry = clientProperties.getDeleteBigQueryExportRetry();
+ if (deleteBigQueryExportRetry != null) {
+ RetrySettings deleteBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteBigQueryExportSettings().getRetrySettings(),
+ deleteBigQueryExportRetry);
+ clientSettingsBuilder
+ .deleteBigQueryExportSettings()
+ .setRetrySettings(deleteBigQueryExportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteBigQueryExport from properties.");
+ }
+ }
+ Retry updateBigQueryExportRetry = clientProperties.getUpdateBigQueryExportRetry();
+ if (updateBigQueryExportRetry != null) {
+ RetrySettings updateBigQueryExportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateBigQueryExportSettings().getRetrySettings(),
+ updateBigQueryExportRetry);
+ clientSettingsBuilder
+ .updateBigQueryExportSettings()
+ .setRetrySettings(updateBigQueryExportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateBigQueryExport from properties.");
+ }
+ }
+ Retry listBigQueryExportsRetry = clientProperties.getListBigQueryExportsRetry();
+ if (listBigQueryExportsRetry != null) {
+ RetrySettings listBigQueryExportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listBigQueryExportsSettings().getRetrySettings(),
+ listBigQueryExportsRetry);
+ clientSettingsBuilder
+ .listBigQueryExportsSettings()
+ .setRetrySettings(listBigQueryExportsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listBigQueryExports from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a SecurityCenterClient bean configured with SecurityCenterSettings.
+ *
+ * @param securityCenterSettings settings to configure an instance of client bean.
+ * @return a {@link SecurityCenterClient} bean configured with {@link SecurityCenterSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public SecurityCenterClient securityCenterClient(SecurityCenterSettings securityCenterSettings)
+ throws IOException {
+ return SecurityCenterClient.create(securityCenterSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-security-center";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/SecurityCenterSpringProperties.java b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/SecurityCenterSpringProperties.java
new file mode 100644
index 0000000000..b450354f79
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/SecurityCenterSpringProperties.java
@@ -0,0 +1,524 @@
+/*
+ * Copyright 2022 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.securitycenter.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 SecurityCenter client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.securitycenter.v1.security-center")
+public class SecurityCenterSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createSource. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createSourceRetry;
+ /**
+ * Allow override of retry settings at method-level for createFinding. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createFindingRetry;
+ /**
+ * Allow override of retry settings at method-level for createMuteConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createMuteConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for createNotificationConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createNotificationConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteMuteConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteMuteConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteNotificationConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteNotificationConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getBigQueryExport. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getBigQueryExportRetry;
+ /**
+ * 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 getMuteConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMuteConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getNotificationConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getNotificationConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getOrganizationSettings. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getOrganizationSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for getSource. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSourceRetry;
+ /**
+ * Allow override of retry settings at method-level for groupAssets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry groupAssetsRetry;
+ /**
+ * Allow override of retry settings at method-level for groupFindings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry groupFindingsRetry;
+ /**
+ * Allow override of retry settings at method-level for listAssets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAssetsRetry;
+ /**
+ * Allow override of retry settings at method-level for listFindings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFindingsRetry;
+ /**
+ * Allow override of retry settings at method-level for listMuteConfigs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listMuteConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for listNotificationConfigs. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listNotificationConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for listSources. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for setFindingState. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setFindingStateRetry;
+ /**
+ * Allow override of retry settings at method-level for setMute. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setMuteRetry;
+ /**
+ * 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;
+ /**
+ * Allow override of retry settings at method-level for updateExternalSystem. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateExternalSystemRetry;
+ /**
+ * Allow override of retry settings at method-level for updateFinding. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateFindingRetry;
+ /**
+ * Allow override of retry settings at method-level for updateMuteConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateMuteConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateNotificationConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateNotificationConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateOrganizationSettings. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateOrganizationSettingsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSource. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSourceRetry;
+ /**
+ * Allow override of retry settings at method-level for updateSecurityMarks. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateSecurityMarksRetry;
+ /**
+ * Allow override of retry settings at method-level for createBigQueryExport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createBigQueryExportRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteBigQueryExport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteBigQueryExportRetry;
+ /**
+ * Allow override of retry settings at method-level for updateBigQueryExport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateBigQueryExportRetry;
+ /**
+ * Allow override of retry settings at method-level for listBigQueryExports. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listBigQueryExportsRetry;
+
+ @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 getCreateSourceRetry() {
+ return this.createSourceRetry;
+ }
+
+ public void setCreateSourceRetry(Retry createSourceRetry) {
+ this.createSourceRetry = createSourceRetry;
+ }
+
+ public Retry getCreateFindingRetry() {
+ return this.createFindingRetry;
+ }
+
+ public void setCreateFindingRetry(Retry createFindingRetry) {
+ this.createFindingRetry = createFindingRetry;
+ }
+
+ public Retry getCreateMuteConfigRetry() {
+ return this.createMuteConfigRetry;
+ }
+
+ public void setCreateMuteConfigRetry(Retry createMuteConfigRetry) {
+ this.createMuteConfigRetry = createMuteConfigRetry;
+ }
+
+ public Retry getCreateNotificationConfigRetry() {
+ return this.createNotificationConfigRetry;
+ }
+
+ public void setCreateNotificationConfigRetry(Retry createNotificationConfigRetry) {
+ this.createNotificationConfigRetry = createNotificationConfigRetry;
+ }
+
+ public Retry getDeleteMuteConfigRetry() {
+ return this.deleteMuteConfigRetry;
+ }
+
+ public void setDeleteMuteConfigRetry(Retry deleteMuteConfigRetry) {
+ this.deleteMuteConfigRetry = deleteMuteConfigRetry;
+ }
+
+ public Retry getDeleteNotificationConfigRetry() {
+ return this.deleteNotificationConfigRetry;
+ }
+
+ public void setDeleteNotificationConfigRetry(Retry deleteNotificationConfigRetry) {
+ this.deleteNotificationConfigRetry = deleteNotificationConfigRetry;
+ }
+
+ public Retry getGetBigQueryExportRetry() {
+ return this.getBigQueryExportRetry;
+ }
+
+ public void setGetBigQueryExportRetry(Retry getBigQueryExportRetry) {
+ this.getBigQueryExportRetry = getBigQueryExportRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getGetMuteConfigRetry() {
+ return this.getMuteConfigRetry;
+ }
+
+ public void setGetMuteConfigRetry(Retry getMuteConfigRetry) {
+ this.getMuteConfigRetry = getMuteConfigRetry;
+ }
+
+ public Retry getGetNotificationConfigRetry() {
+ return this.getNotificationConfigRetry;
+ }
+
+ public void setGetNotificationConfigRetry(Retry getNotificationConfigRetry) {
+ this.getNotificationConfigRetry = getNotificationConfigRetry;
+ }
+
+ public Retry getGetOrganizationSettingsRetry() {
+ return this.getOrganizationSettingsRetry;
+ }
+
+ public void setGetOrganizationSettingsRetry(Retry getOrganizationSettingsRetry) {
+ this.getOrganizationSettingsRetry = getOrganizationSettingsRetry;
+ }
+
+ public Retry getGetSourceRetry() {
+ return this.getSourceRetry;
+ }
+
+ public void setGetSourceRetry(Retry getSourceRetry) {
+ this.getSourceRetry = getSourceRetry;
+ }
+
+ public Retry getGroupAssetsRetry() {
+ return this.groupAssetsRetry;
+ }
+
+ public void setGroupAssetsRetry(Retry groupAssetsRetry) {
+ this.groupAssetsRetry = groupAssetsRetry;
+ }
+
+ public Retry getGroupFindingsRetry() {
+ return this.groupFindingsRetry;
+ }
+
+ public void setGroupFindingsRetry(Retry groupFindingsRetry) {
+ this.groupFindingsRetry = groupFindingsRetry;
+ }
+
+ public Retry getListAssetsRetry() {
+ return this.listAssetsRetry;
+ }
+
+ public void setListAssetsRetry(Retry listAssetsRetry) {
+ this.listAssetsRetry = listAssetsRetry;
+ }
+
+ public Retry getListFindingsRetry() {
+ return this.listFindingsRetry;
+ }
+
+ public void setListFindingsRetry(Retry listFindingsRetry) {
+ this.listFindingsRetry = listFindingsRetry;
+ }
+
+ public Retry getListMuteConfigsRetry() {
+ return this.listMuteConfigsRetry;
+ }
+
+ public void setListMuteConfigsRetry(Retry listMuteConfigsRetry) {
+ this.listMuteConfigsRetry = listMuteConfigsRetry;
+ }
+
+ public Retry getListNotificationConfigsRetry() {
+ return this.listNotificationConfigsRetry;
+ }
+
+ public void setListNotificationConfigsRetry(Retry listNotificationConfigsRetry) {
+ this.listNotificationConfigsRetry = listNotificationConfigsRetry;
+ }
+
+ public Retry getListSourcesRetry() {
+ return this.listSourcesRetry;
+ }
+
+ public void setListSourcesRetry(Retry listSourcesRetry) {
+ this.listSourcesRetry = listSourcesRetry;
+ }
+
+ public Retry getSetFindingStateRetry() {
+ return this.setFindingStateRetry;
+ }
+
+ public void setSetFindingStateRetry(Retry setFindingStateRetry) {
+ this.setFindingStateRetry = setFindingStateRetry;
+ }
+
+ public Retry getSetMuteRetry() {
+ return this.setMuteRetry;
+ }
+
+ public void setSetMuteRetry(Retry setMuteRetry) {
+ this.setMuteRetry = setMuteRetry;
+ }
+
+ 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;
+ }
+
+ public Retry getUpdateExternalSystemRetry() {
+ return this.updateExternalSystemRetry;
+ }
+
+ public void setUpdateExternalSystemRetry(Retry updateExternalSystemRetry) {
+ this.updateExternalSystemRetry = updateExternalSystemRetry;
+ }
+
+ public Retry getUpdateFindingRetry() {
+ return this.updateFindingRetry;
+ }
+
+ public void setUpdateFindingRetry(Retry updateFindingRetry) {
+ this.updateFindingRetry = updateFindingRetry;
+ }
+
+ public Retry getUpdateMuteConfigRetry() {
+ return this.updateMuteConfigRetry;
+ }
+
+ public void setUpdateMuteConfigRetry(Retry updateMuteConfigRetry) {
+ this.updateMuteConfigRetry = updateMuteConfigRetry;
+ }
+
+ public Retry getUpdateNotificationConfigRetry() {
+ return this.updateNotificationConfigRetry;
+ }
+
+ public void setUpdateNotificationConfigRetry(Retry updateNotificationConfigRetry) {
+ this.updateNotificationConfigRetry = updateNotificationConfigRetry;
+ }
+
+ public Retry getUpdateOrganizationSettingsRetry() {
+ return this.updateOrganizationSettingsRetry;
+ }
+
+ public void setUpdateOrganizationSettingsRetry(Retry updateOrganizationSettingsRetry) {
+ this.updateOrganizationSettingsRetry = updateOrganizationSettingsRetry;
+ }
+
+ public Retry getUpdateSourceRetry() {
+ return this.updateSourceRetry;
+ }
+
+ public void setUpdateSourceRetry(Retry updateSourceRetry) {
+ this.updateSourceRetry = updateSourceRetry;
+ }
+
+ public Retry getUpdateSecurityMarksRetry() {
+ return this.updateSecurityMarksRetry;
+ }
+
+ public void setUpdateSecurityMarksRetry(Retry updateSecurityMarksRetry) {
+ this.updateSecurityMarksRetry = updateSecurityMarksRetry;
+ }
+
+ public Retry getCreateBigQueryExportRetry() {
+ return this.createBigQueryExportRetry;
+ }
+
+ public void setCreateBigQueryExportRetry(Retry createBigQueryExportRetry) {
+ this.createBigQueryExportRetry = createBigQueryExportRetry;
+ }
+
+ public Retry getDeleteBigQueryExportRetry() {
+ return this.deleteBigQueryExportRetry;
+ }
+
+ public void setDeleteBigQueryExportRetry(Retry deleteBigQueryExportRetry) {
+ this.deleteBigQueryExportRetry = deleteBigQueryExportRetry;
+ }
+
+ public Retry getUpdateBigQueryExportRetry() {
+ return this.updateBigQueryExportRetry;
+ }
+
+ public void setUpdateBigQueryExportRetry(Retry updateBigQueryExportRetry) {
+ this.updateBigQueryExportRetry = updateBigQueryExportRetry;
+ }
+
+ public Retry getListBigQueryExportsRetry() {
+ return this.listBigQueryExportsRetry;
+ }
+
+ public void setListBigQueryExportsRetry(Retry listBigQueryExportsRetry) {
+ this.listBigQueryExportsRetry = listBigQueryExportsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/package-info.java
new file mode 100644
index 0000000000..b44040c87c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/java/com/google/cloud/securitycenter/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for securitycenter. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.securitycenter.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..0a611edc4f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.securitycenter.v1.security-center.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud securitycenter/SecurityCenter components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..a45b5eed75
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-securitycenter-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.securitycenter.v1.spring.SecurityCenterSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-service-control-spring-starter/pom.xml
new file mode 100644
index 0000000000..cc5ffbe4a6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ServiceControllerSpringProperties. 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 ServiceControllerSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceControllerSettings serviceControllerSettings(
+ @Qualifier("defaultServiceControllerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ServiceControllerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ServiceControllerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ServiceControllerSettings.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 =
+ ServiceControllerSettings.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 checkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.checkSettings().setRetrySettings(checkRetrySettings);
+
+ RetrySettings reportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.reportSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.reportSettings().setRetrySettings(reportRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry checkRetry = clientProperties.getCheckRetry();
+ if (checkRetry != null) {
+ RetrySettings checkRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.checkSettings().getRetrySettings(), checkRetry);
+ clientSettingsBuilder.checkSettings().setRetrySettings(checkRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for check from properties.");
+ }
+ }
+ Retry reportRetry = clientProperties.getReportRetry();
+ if (reportRetry != null) {
+ RetrySettings reportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.reportSettings().getRetrySettings(), reportRetry);
+ clientSettingsBuilder.reportSettings().setRetrySettings(reportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for report from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ServiceControllerClient bean configured with ServiceControllerSettings.
+ *
+ * @param serviceControllerSettings settings to configure an instance of client bean.
+ * @return a {@link ServiceControllerClient} bean configured with {@link
+ * ServiceControllerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceControllerClient serviceControllerClient(
+ ServiceControllerSettings serviceControllerSettings) throws IOException {
+ return ServiceControllerClient.create(serviceControllerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-service-controller";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringProperties.java b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringProperties.java
new file mode 100644
index 0000000000..99213f45de
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/ServiceControllerSpringProperties.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.api.servicecontrol.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 ServiceController client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.api.servicecontrol.v2.service-controller")
+public class ServiceControllerSpringProperties 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/servicecontrol");
+ /** 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 check. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry checkRetry;
+ /**
+ * Allow override of retry settings at method-level for report. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry reportRetry;
+
+ @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 getCheckRetry() {
+ return this.checkRetry;
+ }
+
+ public void setCheckRetry(Retry checkRetry) {
+ this.checkRetry = checkRetry;
+ }
+
+ public Retry getReportRetry() {
+ return this.reportRetry;
+ }
+
+ public void setReportRetry(Retry reportRetry) {
+ this.reportRetry = reportRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/package-info.java
new file mode 100644
index 0000000000..4e02ebadfa
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/java/com/google/api/servicecontrol/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for servicecontrol. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.api.servicecontrol.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..f9245c1ba9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.api.servicecontrol.v2.service-controller.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud servicecontrol/ServiceController components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..22d977d6c3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-control-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.api.servicecontrol.v2.spring.ServiceControllerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-service-management-spring-starter/pom.xml
new file mode 100644
index 0000000000..5e195cadf1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ServiceManagerSpringProperties. 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 ServiceManagerSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceManagerSettings serviceManagerSettings(
+ @Qualifier("defaultServiceManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ServiceManagerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ServiceManagerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ServiceManagerSettings.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 =
+ ServiceManagerSettings.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 listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+
+ RetrySettings listServiceConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceConfigsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listServiceConfigsSettings()
+ .setRetrySettings(listServiceConfigsRetrySettings);
+
+ RetrySettings getServiceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getServiceConfigSettings()
+ .setRetrySettings(getServiceConfigRetrySettings);
+
+ RetrySettings createServiceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createServiceConfigSettings()
+ .setRetrySettings(createServiceConfigRetrySettings);
+
+ RetrySettings listServiceRolloutsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceRolloutsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listServiceRolloutsSettings()
+ .setRetrySettings(listServiceRolloutsRetrySettings);
+
+ RetrySettings getServiceRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceRolloutSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getServiceRolloutSettings()
+ .setRetrySettings(getServiceRolloutRetrySettings);
+
+ RetrySettings generateConfigReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateConfigReportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .generateConfigReportSettings()
+ .setRetrySettings(generateConfigReportRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listServicesRetry = clientProperties.getListServicesRetry();
+ if (listServicesRetry != null) {
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listServices from properties.");
+ }
+ }
+ Retry getServiceRetry = clientProperties.getGetServiceRetry();
+ if (getServiceRetry != null) {
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), getServiceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getService from properties.");
+ }
+ }
+ Retry listServiceConfigsRetry = clientProperties.getListServiceConfigsRetry();
+ if (listServiceConfigsRetry != null) {
+ RetrySettings listServiceConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceConfigsSettings().getRetrySettings(),
+ listServiceConfigsRetry);
+ clientSettingsBuilder
+ .listServiceConfigsSettings()
+ .setRetrySettings(listServiceConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listServiceConfigs from properties.");
+ }
+ }
+ Retry getServiceConfigRetry = clientProperties.getGetServiceConfigRetry();
+ if (getServiceConfigRetry != null) {
+ RetrySettings getServiceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceConfigSettings().getRetrySettings(),
+ getServiceConfigRetry);
+ clientSettingsBuilder
+ .getServiceConfigSettings()
+ .setRetrySettings(getServiceConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getServiceConfig from properties.");
+ }
+ }
+ Retry createServiceConfigRetry = clientProperties.getCreateServiceConfigRetry();
+ if (createServiceConfigRetry != null) {
+ RetrySettings createServiceConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceConfigSettings().getRetrySettings(),
+ createServiceConfigRetry);
+ clientSettingsBuilder
+ .createServiceConfigSettings()
+ .setRetrySettings(createServiceConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createServiceConfig from properties.");
+ }
+ }
+ Retry listServiceRolloutsRetry = clientProperties.getListServiceRolloutsRetry();
+ if (listServiceRolloutsRetry != null) {
+ RetrySettings listServiceRolloutsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceRolloutsSettings().getRetrySettings(),
+ listServiceRolloutsRetry);
+ clientSettingsBuilder
+ .listServiceRolloutsSettings()
+ .setRetrySettings(listServiceRolloutsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listServiceRollouts from properties.");
+ }
+ }
+ Retry getServiceRolloutRetry = clientProperties.getGetServiceRolloutRetry();
+ if (getServiceRolloutRetry != null) {
+ RetrySettings getServiceRolloutRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceRolloutSettings().getRetrySettings(),
+ getServiceRolloutRetry);
+ clientSettingsBuilder
+ .getServiceRolloutSettings()
+ .setRetrySettings(getServiceRolloutRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getServiceRollout from properties.");
+ }
+ }
+ Retry generateConfigReportRetry = clientProperties.getGenerateConfigReportRetry();
+ if (generateConfigReportRetry != null) {
+ RetrySettings generateConfigReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateConfigReportSettings().getRetrySettings(),
+ generateConfigReportRetry);
+ clientSettingsBuilder
+ .generateConfigReportSettings()
+ .setRetrySettings(generateConfigReportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateConfigReport from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ServiceManagerClient bean configured with ServiceManagerSettings.
+ *
+ * @param serviceManagerSettings settings to configure an instance of client bean.
+ * @return a {@link ServiceManagerClient} bean configured with {@link ServiceManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceManagerClient serviceManagerClient(ServiceManagerSettings serviceManagerSettings)
+ throws IOException {
+ return ServiceManagerClient.create(serviceManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-service-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringProperties.java b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringProperties.java
new file mode 100644
index 0000000000..ed4042c2c2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/ServiceManagerSpringProperties.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2022 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.api.servicemanagement.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 ServiceManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.api.servicemanagement.v1.service-manager")
+public class ServiceManagerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/service.management",
+ "https://www.googleapis.com/auth/service.management.readonly");
+ /** 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 listServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for getService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for listServiceConfigs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServiceConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for getServiceConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for createServiceConfig. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createServiceConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listServiceRollouts. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServiceRolloutsRetry;
+ /**
+ * Allow override of retry settings at method-level for getServiceRollout. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceRolloutRetry;
+ /**
+ * Allow override of retry settings at method-level for generateConfigReport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateConfigReportRetry;
+
+ @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 getListServicesRetry() {
+ return this.listServicesRetry;
+ }
+
+ public void setListServicesRetry(Retry listServicesRetry) {
+ this.listServicesRetry = listServicesRetry;
+ }
+
+ public Retry getGetServiceRetry() {
+ return this.getServiceRetry;
+ }
+
+ public void setGetServiceRetry(Retry getServiceRetry) {
+ this.getServiceRetry = getServiceRetry;
+ }
+
+ public Retry getListServiceConfigsRetry() {
+ return this.listServiceConfigsRetry;
+ }
+
+ public void setListServiceConfigsRetry(Retry listServiceConfigsRetry) {
+ this.listServiceConfigsRetry = listServiceConfigsRetry;
+ }
+
+ public Retry getGetServiceConfigRetry() {
+ return this.getServiceConfigRetry;
+ }
+
+ public void setGetServiceConfigRetry(Retry getServiceConfigRetry) {
+ this.getServiceConfigRetry = getServiceConfigRetry;
+ }
+
+ public Retry getCreateServiceConfigRetry() {
+ return this.createServiceConfigRetry;
+ }
+
+ public void setCreateServiceConfigRetry(Retry createServiceConfigRetry) {
+ this.createServiceConfigRetry = createServiceConfigRetry;
+ }
+
+ public Retry getListServiceRolloutsRetry() {
+ return this.listServiceRolloutsRetry;
+ }
+
+ public void setListServiceRolloutsRetry(Retry listServiceRolloutsRetry) {
+ this.listServiceRolloutsRetry = listServiceRolloutsRetry;
+ }
+
+ public Retry getGetServiceRolloutRetry() {
+ return this.getServiceRolloutRetry;
+ }
+
+ public void setGetServiceRolloutRetry(Retry getServiceRolloutRetry) {
+ this.getServiceRolloutRetry = getServiceRolloutRetry;
+ }
+
+ public Retry getGenerateConfigReportRetry() {
+ return this.generateConfigReportRetry;
+ }
+
+ public void setGenerateConfigReportRetry(Retry generateConfigReportRetry) {
+ this.generateConfigReportRetry = generateConfigReportRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/package-info.java
new file mode 100644
index 0000000000..0496c584b2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/java/com/google/cloud/api/servicemanagement/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for servicemanagement. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.api.servicemanagement.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..41d40fa18a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.api.servicemanagement.v1.service-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud servicemanagement/ServiceManager components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..b2fd087473
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-management-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.api.servicemanagement.v1.spring.ServiceManagerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-service-usage-spring-starter/pom.xml
new file mode 100644
index 0000000000..b26ab27a2b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ServiceUsageSpringProperties. 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 ServiceUsageSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceUsageSettings serviceUsageSettings(
+ @Qualifier("defaultServiceUsageTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ServiceUsageSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ServiceUsageSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ServiceUsageSettings.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 =
+ ServiceUsageSettings.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 getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+
+ RetrySettings batchGetServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .batchGetServicesSettings()
+ .setRetrySettings(batchGetServicesRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getServiceRetry = clientProperties.getGetServiceRetry();
+ if (getServiceRetry != null) {
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), getServiceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getService from properties.");
+ }
+ }
+ Retry listServicesRetry = clientProperties.getListServicesRetry();
+ if (listServicesRetry != null) {
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listServices from properties.");
+ }
+ }
+ Retry batchGetServicesRetry = clientProperties.getBatchGetServicesRetry();
+ if (batchGetServicesRetry != null) {
+ RetrySettings batchGetServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchGetServicesSettings().getRetrySettings(),
+ batchGetServicesRetry);
+ clientSettingsBuilder
+ .batchGetServicesSettings()
+ .setRetrySettings(batchGetServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for batchGetServices from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ServiceUsageClient bean configured with ServiceUsageSettings.
+ *
+ * @param serviceUsageSettings settings to configure an instance of client bean.
+ * @return a {@link ServiceUsageClient} bean configured with {@link ServiceUsageSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ServiceUsageClient serviceUsageClient(ServiceUsageSettings serviceUsageSettings)
+ throws IOException {
+ return ServiceUsageClient.create(serviceUsageSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-service-usage";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringProperties.java b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringProperties.java
new file mode 100644
index 0000000000..e955dcc94c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/ServiceUsageSpringProperties.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.api.serviceusage.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 ServiceUsage client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.api.serviceusage.v1.service-usage")
+public class ServiceUsageSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/service.management");
+ /** 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 getService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for listServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for batchGetServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry batchGetServicesRetry;
+
+ @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 getGetServiceRetry() {
+ return this.getServiceRetry;
+ }
+
+ public void setGetServiceRetry(Retry getServiceRetry) {
+ this.getServiceRetry = getServiceRetry;
+ }
+
+ public Retry getListServicesRetry() {
+ return this.listServicesRetry;
+ }
+
+ public void setListServicesRetry(Retry listServicesRetry) {
+ this.listServicesRetry = listServicesRetry;
+ }
+
+ public Retry getBatchGetServicesRetry() {
+ return this.batchGetServicesRetry;
+ }
+
+ public void setBatchGetServicesRetry(Retry batchGetServicesRetry) {
+ this.batchGetServicesRetry = batchGetServicesRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/package-info.java
new file mode 100644
index 0000000000..d8b8a9004a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/java/com/google/api/serviceusage/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for serviceusage. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.api.serviceusage.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..b6b2a269ed
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.api.serviceusage.v1.service-usage.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud serviceusage/ServiceUsage components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..e18067efed
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-service-usage-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.api.serviceusage.v1.spring.ServiceUsageSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/pom.xml
new file mode 100644
index 0000000000..a7edaa2bd4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in LookupServiceSpringProperties. 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 LookupServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public LookupServiceSettings lookupServiceSettings( + @Qualifier("defaultLookupServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + LookupServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = LookupServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = LookupServiceSettings.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 = + LookupServiceSettings.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 resolveServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resolveServiceSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.resolveServiceSettings().setRetrySettings(resolveServiceRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry resolveServiceRetry = clientProperties.getResolveServiceRetry(); + if (resolveServiceRetry != null) { + RetrySettings resolveServiceRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.resolveServiceSettings().getRetrySettings(), + resolveServiceRetry); + clientSettingsBuilder.resolveServiceSettings().setRetrySettings(resolveServiceRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for resolveService from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a LookupServiceClient bean configured with LookupServiceSettings. + * + * @param lookupServiceSettings settings to configure an instance of client bean. + * @return a {@link LookupServiceClient} bean configured with {@link LookupServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public LookupServiceClient lookupServiceClient(LookupServiceSettings lookupServiceSettings) + throws IOException { + return LookupServiceClient.create(lookupServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-lookup-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringProperties.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringProperties.java new file mode 100644 index 0000000000..fabd382f1a --- /dev/null +++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/LookupServiceSpringProperties.java @@ -0,0 +1,95 @@ +/* + * Copyright 2022 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.servicedirectory.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 LookupService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.servicedirectory.v1.lookup-service") +public class LookupServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for resolveService. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry resolveServiceRetry; + + @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 getResolveServiceRetry() { + return this.resolveServiceRetry; + } + + public void setResolveServiceRetry(Retry resolveServiceRetry) { + this.resolveServiceRetry = resolveServiceRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..74e24ab18b --- /dev/null +++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringAutoConfiguration.java @@ -0,0 +1,483 @@ +/* + * Copyright 2022 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.servicedirectory.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.servicedirectory.v1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings; +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 RegistrationServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in RegistrationServiceSpringProperties. 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 RegistrationServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RegistrationServiceSettings registrationServiceSettings(
+ @Qualifier("defaultRegistrationServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ RegistrationServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = RegistrationServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = RegistrationServiceSettings.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 =
+ RegistrationServiceSettings.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 createNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNamespaceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createNamespaceSettings()
+ .setRetrySettings(createNamespaceRetrySettings);
+
+ RetrySettings listNamespacesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNamespacesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listNamespacesSettings().setRetrySettings(listNamespacesRetrySettings);
+
+ RetrySettings getNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNamespaceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getNamespaceSettings().setRetrySettings(getNamespaceRetrySettings);
+
+ RetrySettings updateNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNamespaceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateNamespaceSettings()
+ .setRetrySettings(updateNamespaceRetrySettings);
+
+ RetrySettings deleteNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNamespaceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteNamespaceSettings()
+ .setRetrySettings(deleteNamespaceRetrySettings);
+
+ RetrySettings createServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createServiceSettings().setRetrySettings(createServiceRetrySettings);
+
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+
+ RetrySettings updateServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateServiceSettings().setRetrySettings(updateServiceRetrySettings);
+
+ RetrySettings deleteServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteServiceSettings().setRetrySettings(deleteServiceRetrySettings);
+
+ RetrySettings createEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createEndpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createEndpointSettings().setRetrySettings(createEndpointRetrySettings);
+
+ RetrySettings listEndpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings);
+
+ RetrySettings getEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEndpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings);
+
+ RetrySettings updateEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateEndpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateEndpointSettings().setRetrySettings(updateEndpointRetrySettings);
+
+ RetrySettings deleteEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteEndpointSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteEndpointSettings().setRetrySettings(deleteEndpointRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createNamespaceRetry = clientProperties.getCreateNamespaceRetry();
+ if (createNamespaceRetry != null) {
+ RetrySettings createNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createNamespaceSettings().getRetrySettings(),
+ createNamespaceRetry);
+ clientSettingsBuilder
+ .createNamespaceSettings()
+ .setRetrySettings(createNamespaceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createNamespace from properties.");
+ }
+ }
+ Retry listNamespacesRetry = clientProperties.getListNamespacesRetry();
+ if (listNamespacesRetry != null) {
+ RetrySettings listNamespacesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNamespacesSettings().getRetrySettings(),
+ listNamespacesRetry);
+ clientSettingsBuilder.listNamespacesSettings().setRetrySettings(listNamespacesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listNamespaces from properties.");
+ }
+ }
+ Retry getNamespaceRetry = clientProperties.getGetNamespaceRetry();
+ if (getNamespaceRetry != null) {
+ RetrySettings getNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNamespaceSettings().getRetrySettings(), getNamespaceRetry);
+ clientSettingsBuilder.getNamespaceSettings().setRetrySettings(getNamespaceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getNamespace from properties.");
+ }
+ }
+ Retry updateNamespaceRetry = clientProperties.getUpdateNamespaceRetry();
+ if (updateNamespaceRetry != null) {
+ RetrySettings updateNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateNamespaceSettings().getRetrySettings(),
+ updateNamespaceRetry);
+ clientSettingsBuilder
+ .updateNamespaceSettings()
+ .setRetrySettings(updateNamespaceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateNamespace from properties.");
+ }
+ }
+ Retry deleteNamespaceRetry = clientProperties.getDeleteNamespaceRetry();
+ if (deleteNamespaceRetry != null) {
+ RetrySettings deleteNamespaceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteNamespaceSettings().getRetrySettings(),
+ deleteNamespaceRetry);
+ clientSettingsBuilder
+ .deleteNamespaceSettings()
+ .setRetrySettings(deleteNamespaceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteNamespace from properties.");
+ }
+ }
+ Retry createServiceRetry = clientProperties.getCreateServiceRetry();
+ if (createServiceRetry != null) {
+ RetrySettings createServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceSettings().getRetrySettings(), createServiceRetry);
+ clientSettingsBuilder.createServiceSettings().setRetrySettings(createServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createService from properties.");
+ }
+ }
+ Retry listServicesRetry = clientProperties.getListServicesRetry();
+ if (listServicesRetry != null) {
+ RetrySettings listServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicesSettings().getRetrySettings(), listServicesRetry);
+ clientSettingsBuilder.listServicesSettings().setRetrySettings(listServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listServices from properties.");
+ }
+ }
+ Retry getServiceRetry = clientProperties.getGetServiceRetry();
+ if (getServiceRetry != null) {
+ RetrySettings getServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceSettings().getRetrySettings(), getServiceRetry);
+ clientSettingsBuilder.getServiceSettings().setRetrySettings(getServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getService from properties.");
+ }
+ }
+ Retry updateServiceRetry = clientProperties.getUpdateServiceRetry();
+ if (updateServiceRetry != null) {
+ RetrySettings updateServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateServiceSettings().getRetrySettings(), updateServiceRetry);
+ clientSettingsBuilder.updateServiceSettings().setRetrySettings(updateServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateService from properties.");
+ }
+ }
+ Retry deleteServiceRetry = clientProperties.getDeleteServiceRetry();
+ if (deleteServiceRetry != null) {
+ RetrySettings deleteServiceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceSettings().getRetrySettings(), deleteServiceRetry);
+ clientSettingsBuilder.deleteServiceSettings().setRetrySettings(deleteServiceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteService from properties.");
+ }
+ }
+ Retry createEndpointRetry = clientProperties.getCreateEndpointRetry();
+ if (createEndpointRetry != null) {
+ RetrySettings createEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createEndpointSettings().getRetrySettings(),
+ createEndpointRetry);
+ clientSettingsBuilder.createEndpointSettings().setRetrySettings(createEndpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createEndpoint from properties.");
+ }
+ }
+ Retry listEndpointsRetry = clientProperties.getListEndpointsRetry();
+ if (listEndpointsRetry != null) {
+ RetrySettings listEndpointsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listEndpointsSettings().getRetrySettings(), listEndpointsRetry);
+ clientSettingsBuilder.listEndpointsSettings().setRetrySettings(listEndpointsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listEndpoints from properties.");
+ }
+ }
+ Retry getEndpointRetry = clientProperties.getGetEndpointRetry();
+ if (getEndpointRetry != null) {
+ RetrySettings getEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEndpointSettings().getRetrySettings(), getEndpointRetry);
+ clientSettingsBuilder.getEndpointSettings().setRetrySettings(getEndpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEndpoint from properties.");
+ }
+ }
+ Retry updateEndpointRetry = clientProperties.getUpdateEndpointRetry();
+ if (updateEndpointRetry != null) {
+ RetrySettings updateEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateEndpointSettings().getRetrySettings(),
+ updateEndpointRetry);
+ clientSettingsBuilder.updateEndpointSettings().setRetrySettings(updateEndpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateEndpoint from properties.");
+ }
+ }
+ Retry deleteEndpointRetry = clientProperties.getDeleteEndpointRetry();
+ if (deleteEndpointRetry != null) {
+ RetrySettings deleteEndpointRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteEndpointSettings().getRetrySettings(),
+ deleteEndpointRetry);
+ clientSettingsBuilder.deleteEndpointSettings().setRetrySettings(deleteEndpointRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteEndpoint from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a RegistrationServiceClient bean configured with RegistrationServiceSettings.
+ *
+ * @param registrationServiceSettings settings to configure an instance of client bean.
+ * @return a {@link RegistrationServiceClient} bean configured with {@link
+ * RegistrationServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RegistrationServiceClient registrationServiceClient(
+ RegistrationServiceSettings registrationServiceSettings) throws IOException {
+ return RegistrationServiceClient.create(registrationServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-registration-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringProperties.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringProperties.java
new file mode 100644
index 0000000000..a740bc47c6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/RegistrationServiceSpringProperties.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2022 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.servicedirectory.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 RegistrationService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.servicedirectory.v1.registration-service")
+public class RegistrationServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createNamespace. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createNamespaceRetry;
+ /**
+ * Allow override of retry settings at method-level for listNamespaces. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listNamespacesRetry;
+ /**
+ * Allow override of retry settings at method-level for getNamespace. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getNamespaceRetry;
+ /**
+ * Allow override of retry settings at method-level for updateNamespace. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateNamespaceRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteNamespace. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteNamespaceRetry;
+ /**
+ * Allow override of retry settings at method-level for createService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for listServices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for getService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for updateService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteService. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteServiceRetry;
+ /**
+ * Allow override of retry settings at method-level for createEndpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createEndpointRetry;
+ /**
+ * Allow override of retry settings at method-level for listEndpoints. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listEndpointsRetry;
+ /**
+ * Allow override of retry settings at method-level for getEndpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEndpointRetry;
+ /**
+ * Allow override of retry settings at method-level for updateEndpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateEndpointRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteEndpoint. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteEndpointRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getCreateNamespaceRetry() {
+ return this.createNamespaceRetry;
+ }
+
+ public void setCreateNamespaceRetry(Retry createNamespaceRetry) {
+ this.createNamespaceRetry = createNamespaceRetry;
+ }
+
+ public Retry getListNamespacesRetry() {
+ return this.listNamespacesRetry;
+ }
+
+ public void setListNamespacesRetry(Retry listNamespacesRetry) {
+ this.listNamespacesRetry = listNamespacesRetry;
+ }
+
+ public Retry getGetNamespaceRetry() {
+ return this.getNamespaceRetry;
+ }
+
+ public void setGetNamespaceRetry(Retry getNamespaceRetry) {
+ this.getNamespaceRetry = getNamespaceRetry;
+ }
+
+ public Retry getUpdateNamespaceRetry() {
+ return this.updateNamespaceRetry;
+ }
+
+ public void setUpdateNamespaceRetry(Retry updateNamespaceRetry) {
+ this.updateNamespaceRetry = updateNamespaceRetry;
+ }
+
+ public Retry getDeleteNamespaceRetry() {
+ return this.deleteNamespaceRetry;
+ }
+
+ public void setDeleteNamespaceRetry(Retry deleteNamespaceRetry) {
+ this.deleteNamespaceRetry = deleteNamespaceRetry;
+ }
+
+ public Retry getCreateServiceRetry() {
+ return this.createServiceRetry;
+ }
+
+ public void setCreateServiceRetry(Retry createServiceRetry) {
+ this.createServiceRetry = createServiceRetry;
+ }
+
+ public Retry getListServicesRetry() {
+ return this.listServicesRetry;
+ }
+
+ public void setListServicesRetry(Retry listServicesRetry) {
+ this.listServicesRetry = listServicesRetry;
+ }
+
+ public Retry getGetServiceRetry() {
+ return this.getServiceRetry;
+ }
+
+ public void setGetServiceRetry(Retry getServiceRetry) {
+ this.getServiceRetry = getServiceRetry;
+ }
+
+ public Retry getUpdateServiceRetry() {
+ return this.updateServiceRetry;
+ }
+
+ public void setUpdateServiceRetry(Retry updateServiceRetry) {
+ this.updateServiceRetry = updateServiceRetry;
+ }
+
+ public Retry getDeleteServiceRetry() {
+ return this.deleteServiceRetry;
+ }
+
+ public void setDeleteServiceRetry(Retry deleteServiceRetry) {
+ this.deleteServiceRetry = deleteServiceRetry;
+ }
+
+ public Retry getCreateEndpointRetry() {
+ return this.createEndpointRetry;
+ }
+
+ public void setCreateEndpointRetry(Retry createEndpointRetry) {
+ this.createEndpointRetry = createEndpointRetry;
+ }
+
+ public Retry getListEndpointsRetry() {
+ return this.listEndpointsRetry;
+ }
+
+ public void setListEndpointsRetry(Retry listEndpointsRetry) {
+ this.listEndpointsRetry = listEndpointsRetry;
+ }
+
+ public Retry getGetEndpointRetry() {
+ return this.getEndpointRetry;
+ }
+
+ public void setGetEndpointRetry(Retry getEndpointRetry) {
+ this.getEndpointRetry = getEndpointRetry;
+ }
+
+ public Retry getUpdateEndpointRetry() {
+ return this.updateEndpointRetry;
+ }
+
+ public void setUpdateEndpointRetry(Retry updateEndpointRetry) {
+ this.updateEndpointRetry = updateEndpointRetry;
+ }
+
+ public Retry getDeleteEndpointRetry() {
+ return this.deleteEndpointRetry;
+ }
+
+ public void setDeleteEndpointRetry(Retry deleteEndpointRetry) {
+ this.deleteEndpointRetry = deleteEndpointRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/package-info.java
new file mode 100644
index 0000000000..ad036fdb94
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/java/com/google/cloud/servicedirectory/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for servicedirectory. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.servicedirectory.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..69ad6db5b2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.servicedirectory.v1.lookup-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud servicedirectory/LookupService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.servicedirectory.v1.registration-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud servicedirectory/RegistrationService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..98a98af996
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-servicedirectory-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.servicedirectory.v1.spring.LookupServiceSpringAutoConfiguration
+com.google.cloud.servicedirectory.v1.spring.RegistrationServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-shell-spring-starter/pom.xml
new file mode 100644
index 0000000000..c094a127ec
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-shell-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudShellServiceSpringProperties. 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 CloudShellServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudShellServiceSettings cloudShellServiceSettings(
+ @Qualifier("defaultCloudShellServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudShellServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudShellServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudShellServiceSettings.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 =
+ CloudShellServiceSettings.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 getEnvironmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getEnvironmentRetry = clientProperties.getGetEnvironmentRetry();
+ if (getEnvironmentRetry != null) {
+ RetrySettings getEnvironmentRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getEnvironmentSettings().getRetrySettings(),
+ getEnvironmentRetry);
+ clientSettingsBuilder.getEnvironmentSettings().setRetrySettings(getEnvironmentRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getEnvironment from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudShellServiceClient bean configured with CloudShellServiceSettings.
+ *
+ * @param cloudShellServiceSettings settings to configure an instance of client bean.
+ * @return a {@link CloudShellServiceClient} bean configured with {@link
+ * CloudShellServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudShellServiceClient cloudShellServiceClient(
+ CloudShellServiceSettings cloudShellServiceSettings) throws IOException {
+ return CloudShellServiceClient.create(cloudShellServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-shell-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringProperties.java b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringProperties.java
new file mode 100644
index 0000000000..148b979474
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/CloudShellServiceSpringProperties.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2022 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.shell.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 CloudShellService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.shell.v1.cloud-shell-service")
+public class CloudShellServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getEnvironment. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getEnvironmentRetry;
+
+ @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 getGetEnvironmentRetry() {
+ return this.getEnvironmentRetry;
+ }
+
+ public void setGetEnvironmentRetry(Retry getEnvironmentRetry) {
+ this.getEnvironmentRetry = getEnvironmentRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/package-info.java
new file mode 100644
index 0000000000..668506b8d8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/java/com/google/cloud/shell/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudshell. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.shell.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..2ca8e35bf4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.shell.v1.cloud-shell-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudshell/CloudShellService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..c1dba70ec7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-shell-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.shell.v1.spring.CloudShellServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-speech-spring-starter/pom.xml
new file mode 100644
index 0000000000..40c87a5ec9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-speech-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in SpeechSpringProperties. 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 SpeechSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public SpeechSettings speechSettings(
+ @Qualifier("defaultSpeechTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ SpeechSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = SpeechSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = SpeechSettings.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 =
+ SpeechSettings.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 listRecognizersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRecognizersSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listRecognizersSettings()
+ .setRetrySettings(listRecognizersRetrySettings);
+
+ RetrySettings getRecognizerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecognizerSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRecognizerSettings().setRetrySettings(getRecognizerRetrySettings);
+
+ RetrySettings recognizeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.recognizeSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.recognizeSettings().setRetrySettings(recognizeRetrySettings);
+
+ RetrySettings getConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getConfigSettings().setRetrySettings(getConfigRetrySettings);
+
+ RetrySettings updateConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateConfigSettings().setRetrySettings(updateConfigRetrySettings);
+
+ RetrySettings listCustomClassesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomClassesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listCustomClassesSettings()
+ .setRetrySettings(listCustomClassesRetrySettings);
+
+ RetrySettings getCustomClassRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomClassSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCustomClassSettings().setRetrySettings(getCustomClassRetrySettings);
+
+ RetrySettings listPhraseSetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPhraseSetsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listPhraseSetsSettings().setRetrySettings(listPhraseSetsRetrySettings);
+
+ RetrySettings getPhraseSetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPhraseSetSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getPhraseSetSettings().setRetrySettings(getPhraseSetRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listRecognizersRetry = clientProperties.getListRecognizersRetry();
+ if (listRecognizersRetry != null) {
+ RetrySettings listRecognizersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRecognizersSettings().getRetrySettings(),
+ listRecognizersRetry);
+ clientSettingsBuilder
+ .listRecognizersSettings()
+ .setRetrySettings(listRecognizersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRecognizers from properties.");
+ }
+ }
+ Retry getRecognizerRetry = clientProperties.getGetRecognizerRetry();
+ if (getRecognizerRetry != null) {
+ RetrySettings getRecognizerRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRecognizerSettings().getRetrySettings(), getRecognizerRetry);
+ clientSettingsBuilder.getRecognizerSettings().setRetrySettings(getRecognizerRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRecognizer from properties.");
+ }
+ }
+ Retry recognizeRetry = clientProperties.getRecognizeRetry();
+ if (recognizeRetry != null) {
+ RetrySettings recognizeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.recognizeSettings().getRetrySettings(), recognizeRetry);
+ clientSettingsBuilder.recognizeSettings().setRetrySettings(recognizeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for recognize from properties.");
+ }
+ }
+ Retry getConfigRetry = clientProperties.getGetConfigRetry();
+ if (getConfigRetry != null) {
+ RetrySettings getConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConfigSettings().getRetrySettings(), getConfigRetry);
+ clientSettingsBuilder.getConfigSettings().setRetrySettings(getConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getConfig from properties.");
+ }
+ }
+ Retry updateConfigRetry = clientProperties.getUpdateConfigRetry();
+ if (updateConfigRetry != null) {
+ RetrySettings updateConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateConfigSettings().getRetrySettings(), updateConfigRetry);
+ clientSettingsBuilder.updateConfigSettings().setRetrySettings(updateConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateConfig from properties.");
+ }
+ }
+ Retry listCustomClassesRetry = clientProperties.getListCustomClassesRetry();
+ if (listCustomClassesRetry != null) {
+ RetrySettings listCustomClassesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCustomClassesSettings().getRetrySettings(),
+ listCustomClassesRetry);
+ clientSettingsBuilder
+ .listCustomClassesSettings()
+ .setRetrySettings(listCustomClassesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listCustomClasses from properties.");
+ }
+ }
+ Retry getCustomClassRetry = clientProperties.getGetCustomClassRetry();
+ if (getCustomClassRetry != null) {
+ RetrySettings getCustomClassRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCustomClassSettings().getRetrySettings(),
+ getCustomClassRetry);
+ clientSettingsBuilder.getCustomClassSettings().setRetrySettings(getCustomClassRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCustomClass from properties.");
+ }
+ }
+ Retry listPhraseSetsRetry = clientProperties.getListPhraseSetsRetry();
+ if (listPhraseSetsRetry != null) {
+ RetrySettings listPhraseSetsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listPhraseSetsSettings().getRetrySettings(),
+ listPhraseSetsRetry);
+ clientSettingsBuilder.listPhraseSetsSettings().setRetrySettings(listPhraseSetsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listPhraseSets from properties.");
+ }
+ }
+ Retry getPhraseSetRetry = clientProperties.getGetPhraseSetRetry();
+ if (getPhraseSetRetry != null) {
+ RetrySettings getPhraseSetRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getPhraseSetSettings().getRetrySettings(), getPhraseSetRetry);
+ clientSettingsBuilder.getPhraseSetSettings().setRetrySettings(getPhraseSetRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getPhraseSet from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a SpeechClient bean configured with SpeechSettings.
+ *
+ * @param speechSettings settings to configure an instance of client bean.
+ * @return a {@link SpeechClient} bean configured with {@link SpeechSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public SpeechClient speechClient(SpeechSettings speechSettings) throws IOException {
+ return SpeechClient.create(speechSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-speech";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringProperties.java b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringProperties.java
new file mode 100644
index 0000000000..7485e08bc8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/SpeechSpringProperties.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2022 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.speech.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 Speech client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.speech.v2.speech")
+public class SpeechSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listRecognizers. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRecognizersRetry;
+ /**
+ * Allow override of retry settings at method-level for getRecognizer. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRecognizerRetry;
+ /**
+ * Allow override of retry settings at method-level for recognize. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry recognizeRetry;
+ /**
+ * Allow override of retry settings at method-level for getConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for updateConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listCustomClasses. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCustomClassesRetry;
+ /**
+ * Allow override of retry settings at method-level for getCustomClass. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCustomClassRetry;
+ /**
+ * Allow override of retry settings at method-level for listPhraseSets. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listPhraseSetsRetry;
+ /**
+ * Allow override of retry settings at method-level for getPhraseSet. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getPhraseSetRetry;
+
+ @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 getListRecognizersRetry() {
+ return this.listRecognizersRetry;
+ }
+
+ public void setListRecognizersRetry(Retry listRecognizersRetry) {
+ this.listRecognizersRetry = listRecognizersRetry;
+ }
+
+ public Retry getGetRecognizerRetry() {
+ return this.getRecognizerRetry;
+ }
+
+ public void setGetRecognizerRetry(Retry getRecognizerRetry) {
+ this.getRecognizerRetry = getRecognizerRetry;
+ }
+
+ public Retry getRecognizeRetry() {
+ return this.recognizeRetry;
+ }
+
+ public void setRecognizeRetry(Retry recognizeRetry) {
+ this.recognizeRetry = recognizeRetry;
+ }
+
+ public Retry getGetConfigRetry() {
+ return this.getConfigRetry;
+ }
+
+ public void setGetConfigRetry(Retry getConfigRetry) {
+ this.getConfigRetry = getConfigRetry;
+ }
+
+ public Retry getUpdateConfigRetry() {
+ return this.updateConfigRetry;
+ }
+
+ public void setUpdateConfigRetry(Retry updateConfigRetry) {
+ this.updateConfigRetry = updateConfigRetry;
+ }
+
+ public Retry getListCustomClassesRetry() {
+ return this.listCustomClassesRetry;
+ }
+
+ public void setListCustomClassesRetry(Retry listCustomClassesRetry) {
+ this.listCustomClassesRetry = listCustomClassesRetry;
+ }
+
+ public Retry getGetCustomClassRetry() {
+ return this.getCustomClassRetry;
+ }
+
+ public void setGetCustomClassRetry(Retry getCustomClassRetry) {
+ this.getCustomClassRetry = getCustomClassRetry;
+ }
+
+ public Retry getListPhraseSetsRetry() {
+ return this.listPhraseSetsRetry;
+ }
+
+ public void setListPhraseSetsRetry(Retry listPhraseSetsRetry) {
+ this.listPhraseSetsRetry = listPhraseSetsRetry;
+ }
+
+ public Retry getGetPhraseSetRetry() {
+ return this.getPhraseSetRetry;
+ }
+
+ public void setGetPhraseSetRetry(Retry getPhraseSetRetry) {
+ this.getPhraseSetRetry = getPhraseSetRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/package-info.java
new file mode 100644
index 0000000000..ec953a7807
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/java/com/google/cloud/speech/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for speech. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.speech.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..f9541e4885
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.speech.v2.speech.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud speech/Speech components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..38c5d0ebf9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-speech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.speech.v2.spring.SpeechSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/pom.xml
new file mode 100644
index 0000000000..634b245c3c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in StorageTransferServiceSpringProperties. 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 StorageTransferServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public StorageTransferServiceSettings storageTransferServiceSettings(
+ @Qualifier("defaultStorageTransferServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ StorageTransferServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = StorageTransferServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = StorageTransferServiceSettings.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 =
+ StorageTransferServiceSettings.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 getGoogleServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGoogleServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getGoogleServiceAccountSettings()
+ .setRetrySettings(getGoogleServiceAccountRetrySettings);
+
+ RetrySettings createTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTransferJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createTransferJobSettings()
+ .setRetrySettings(createTransferJobRetrySettings);
+
+ RetrySettings updateTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTransferJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateTransferJobSettings()
+ .setRetrySettings(updateTransferJobRetrySettings);
+
+ RetrySettings getTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTransferJobSettings().setRetrySettings(getTransferJobRetrySettings);
+
+ RetrySettings listTransferJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listTransferJobsSettings()
+ .setRetrySettings(listTransferJobsRetrySettings);
+
+ RetrySettings pauseTransferOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseTransferOperationSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .pauseTransferOperationSettings()
+ .setRetrySettings(pauseTransferOperationRetrySettings);
+
+ RetrySettings resumeTransferOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeTransferOperationSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .resumeTransferOperationSettings()
+ .setRetrySettings(resumeTransferOperationRetrySettings);
+
+ RetrySettings deleteTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteTransferJobSettings()
+ .setRetrySettings(deleteTransferJobRetrySettings);
+
+ RetrySettings createAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAgentPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createAgentPoolSettings()
+ .setRetrySettings(createAgentPoolRetrySettings);
+
+ RetrySettings updateAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAgentPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateAgentPoolSettings()
+ .setRetrySettings(updateAgentPoolRetrySettings);
+
+ RetrySettings getAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAgentPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getAgentPoolSettings().setRetrySettings(getAgentPoolRetrySettings);
+
+ RetrySettings listAgentPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAgentPoolsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listAgentPoolsSettings().setRetrySettings(listAgentPoolsRetrySettings);
+
+ RetrySettings deleteAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAgentPoolSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteAgentPoolSettings()
+ .setRetrySettings(deleteAgentPoolRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getGoogleServiceAccountRetry = clientProperties.getGetGoogleServiceAccountRetry();
+ if (getGoogleServiceAccountRetry != null) {
+ RetrySettings getGoogleServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGoogleServiceAccountSettings().getRetrySettings(),
+ getGoogleServiceAccountRetry);
+ clientSettingsBuilder
+ .getGoogleServiceAccountSettings()
+ .setRetrySettings(getGoogleServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getGoogleServiceAccount from properties.");
+ }
+ }
+ Retry createTransferJobRetry = clientProperties.getCreateTransferJobRetry();
+ if (createTransferJobRetry != null) {
+ RetrySettings createTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTransferJobSettings().getRetrySettings(),
+ createTransferJobRetry);
+ clientSettingsBuilder
+ .createTransferJobSettings()
+ .setRetrySettings(createTransferJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createTransferJob from properties.");
+ }
+ }
+ Retry updateTransferJobRetry = clientProperties.getUpdateTransferJobRetry();
+ if (updateTransferJobRetry != null) {
+ RetrySettings updateTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTransferJobSettings().getRetrySettings(),
+ updateTransferJobRetry);
+ clientSettingsBuilder
+ .updateTransferJobSettings()
+ .setRetrySettings(updateTransferJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateTransferJob from properties.");
+ }
+ }
+ Retry getTransferJobRetry = clientProperties.getGetTransferJobRetry();
+ if (getTransferJobRetry != null) {
+ RetrySettings getTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTransferJobSettings().getRetrySettings(),
+ getTransferJobRetry);
+ clientSettingsBuilder.getTransferJobSettings().setRetrySettings(getTransferJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTransferJob from properties.");
+ }
+ }
+ Retry listTransferJobsRetry = clientProperties.getListTransferJobsRetry();
+ if (listTransferJobsRetry != null) {
+ RetrySettings listTransferJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTransferJobsSettings().getRetrySettings(),
+ listTransferJobsRetry);
+ clientSettingsBuilder
+ .listTransferJobsSettings()
+ .setRetrySettings(listTransferJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTransferJobs from properties.");
+ }
+ }
+ Retry pauseTransferOperationRetry = clientProperties.getPauseTransferOperationRetry();
+ if (pauseTransferOperationRetry != null) {
+ RetrySettings pauseTransferOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseTransferOperationSettings().getRetrySettings(),
+ pauseTransferOperationRetry);
+ clientSettingsBuilder
+ .pauseTransferOperationSettings()
+ .setRetrySettings(pauseTransferOperationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for pauseTransferOperation from properties.");
+ }
+ }
+ Retry resumeTransferOperationRetry = clientProperties.getResumeTransferOperationRetry();
+ if (resumeTransferOperationRetry != null) {
+ RetrySettings resumeTransferOperationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeTransferOperationSettings().getRetrySettings(),
+ resumeTransferOperationRetry);
+ clientSettingsBuilder
+ .resumeTransferOperationSettings()
+ .setRetrySettings(resumeTransferOperationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for resumeTransferOperation from properties.");
+ }
+ }
+ Retry deleteTransferJobRetry = clientProperties.getDeleteTransferJobRetry();
+ if (deleteTransferJobRetry != null) {
+ RetrySettings deleteTransferJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTransferJobSettings().getRetrySettings(),
+ deleteTransferJobRetry);
+ clientSettingsBuilder
+ .deleteTransferJobSettings()
+ .setRetrySettings(deleteTransferJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteTransferJob from properties.");
+ }
+ }
+ Retry createAgentPoolRetry = clientProperties.getCreateAgentPoolRetry();
+ if (createAgentPoolRetry != null) {
+ RetrySettings createAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createAgentPoolSettings().getRetrySettings(),
+ createAgentPoolRetry);
+ clientSettingsBuilder
+ .createAgentPoolSettings()
+ .setRetrySettings(createAgentPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createAgentPool from properties.");
+ }
+ }
+ Retry updateAgentPoolRetry = clientProperties.getUpdateAgentPoolRetry();
+ if (updateAgentPoolRetry != null) {
+ RetrySettings updateAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateAgentPoolSettings().getRetrySettings(),
+ updateAgentPoolRetry);
+ clientSettingsBuilder
+ .updateAgentPoolSettings()
+ .setRetrySettings(updateAgentPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateAgentPool from properties.");
+ }
+ }
+ Retry getAgentPoolRetry = clientProperties.getGetAgentPoolRetry();
+ if (getAgentPoolRetry != null) {
+ RetrySettings getAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAgentPoolSettings().getRetrySettings(), getAgentPoolRetry);
+ clientSettingsBuilder.getAgentPoolSettings().setRetrySettings(getAgentPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getAgentPool from properties.");
+ }
+ }
+ Retry listAgentPoolsRetry = clientProperties.getListAgentPoolsRetry();
+ if (listAgentPoolsRetry != null) {
+ RetrySettings listAgentPoolsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAgentPoolsSettings().getRetrySettings(),
+ listAgentPoolsRetry);
+ clientSettingsBuilder.listAgentPoolsSettings().setRetrySettings(listAgentPoolsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listAgentPools from properties.");
+ }
+ }
+ Retry deleteAgentPoolRetry = clientProperties.getDeleteAgentPoolRetry();
+ if (deleteAgentPoolRetry != null) {
+ RetrySettings deleteAgentPoolRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteAgentPoolSettings().getRetrySettings(),
+ deleteAgentPoolRetry);
+ clientSettingsBuilder
+ .deleteAgentPoolSettings()
+ .setRetrySettings(deleteAgentPoolRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteAgentPool from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a StorageTransferServiceClient bean configured with StorageTransferServiceSettings.
+ *
+ * @param storageTransferServiceSettings settings to configure an instance of client bean.
+ * @return a {@link StorageTransferServiceClient} bean configured with {@link
+ * StorageTransferServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public StorageTransferServiceClient storageTransferServiceClient(
+ StorageTransferServiceSettings storageTransferServiceSettings) throws IOException {
+ return StorageTransferServiceClient.create(storageTransferServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-storage-transfer-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringProperties.java b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringProperties.java
new file mode 100644
index 0000000000..52c90d50ac
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/StorageTransferServiceSpringProperties.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2022 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.storagetransfer.v1.proto.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 StorageTransferService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.storagetransfer.v1.proto.storage-transfer-service")
+public class StorageTransferServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getGoogleServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGoogleServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for createTransferJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTransferJobRetry;
+ /**
+ * Allow override of retry settings at method-level for updateTransferJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateTransferJobRetry;
+ /**
+ * Allow override of retry settings at method-level for getTransferJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTransferJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listTransferJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTransferJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for pauseTransferOperation. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry pauseTransferOperationRetry;
+ /**
+ * Allow override of retry settings at method-level for resumeTransferOperation. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry resumeTransferOperationRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTransferJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTransferJobRetry;
+ /**
+ * Allow override of retry settings at method-level for createAgentPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createAgentPoolRetry;
+ /**
+ * Allow override of retry settings at method-level for updateAgentPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateAgentPoolRetry;
+ /**
+ * Allow override of retry settings at method-level for getAgentPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAgentPoolRetry;
+ /**
+ * Allow override of retry settings at method-level for listAgentPools. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAgentPoolsRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteAgentPool. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteAgentPoolRetry;
+
+ @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 getGetGoogleServiceAccountRetry() {
+ return this.getGoogleServiceAccountRetry;
+ }
+
+ public void setGetGoogleServiceAccountRetry(Retry getGoogleServiceAccountRetry) {
+ this.getGoogleServiceAccountRetry = getGoogleServiceAccountRetry;
+ }
+
+ public Retry getCreateTransferJobRetry() {
+ return this.createTransferJobRetry;
+ }
+
+ public void setCreateTransferJobRetry(Retry createTransferJobRetry) {
+ this.createTransferJobRetry = createTransferJobRetry;
+ }
+
+ public Retry getUpdateTransferJobRetry() {
+ return this.updateTransferJobRetry;
+ }
+
+ public void setUpdateTransferJobRetry(Retry updateTransferJobRetry) {
+ this.updateTransferJobRetry = updateTransferJobRetry;
+ }
+
+ public Retry getGetTransferJobRetry() {
+ return this.getTransferJobRetry;
+ }
+
+ public void setGetTransferJobRetry(Retry getTransferJobRetry) {
+ this.getTransferJobRetry = getTransferJobRetry;
+ }
+
+ public Retry getListTransferJobsRetry() {
+ return this.listTransferJobsRetry;
+ }
+
+ public void setListTransferJobsRetry(Retry listTransferJobsRetry) {
+ this.listTransferJobsRetry = listTransferJobsRetry;
+ }
+
+ public Retry getPauseTransferOperationRetry() {
+ return this.pauseTransferOperationRetry;
+ }
+
+ public void setPauseTransferOperationRetry(Retry pauseTransferOperationRetry) {
+ this.pauseTransferOperationRetry = pauseTransferOperationRetry;
+ }
+
+ public Retry getResumeTransferOperationRetry() {
+ return this.resumeTransferOperationRetry;
+ }
+
+ public void setResumeTransferOperationRetry(Retry resumeTransferOperationRetry) {
+ this.resumeTransferOperationRetry = resumeTransferOperationRetry;
+ }
+
+ public Retry getDeleteTransferJobRetry() {
+ return this.deleteTransferJobRetry;
+ }
+
+ public void setDeleteTransferJobRetry(Retry deleteTransferJobRetry) {
+ this.deleteTransferJobRetry = deleteTransferJobRetry;
+ }
+
+ public Retry getCreateAgentPoolRetry() {
+ return this.createAgentPoolRetry;
+ }
+
+ public void setCreateAgentPoolRetry(Retry createAgentPoolRetry) {
+ this.createAgentPoolRetry = createAgentPoolRetry;
+ }
+
+ public Retry getUpdateAgentPoolRetry() {
+ return this.updateAgentPoolRetry;
+ }
+
+ public void setUpdateAgentPoolRetry(Retry updateAgentPoolRetry) {
+ this.updateAgentPoolRetry = updateAgentPoolRetry;
+ }
+
+ public Retry getGetAgentPoolRetry() {
+ return this.getAgentPoolRetry;
+ }
+
+ public void setGetAgentPoolRetry(Retry getAgentPoolRetry) {
+ this.getAgentPoolRetry = getAgentPoolRetry;
+ }
+
+ public Retry getListAgentPoolsRetry() {
+ return this.listAgentPoolsRetry;
+ }
+
+ public void setListAgentPoolsRetry(Retry listAgentPoolsRetry) {
+ this.listAgentPoolsRetry = listAgentPoolsRetry;
+ }
+
+ public Retry getDeleteAgentPoolRetry() {
+ return this.deleteAgentPoolRetry;
+ }
+
+ public void setDeleteAgentPoolRetry(Retry deleteAgentPoolRetry) {
+ this.deleteAgentPoolRetry = deleteAgentPoolRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/package-info.java b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/package-info.java
new file mode 100644
index 0000000000..3868dd41d8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/java/com/google/storagetransfer/v1/proto/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for storagetransfer. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.storagetransfer.v1.proto.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..a8833ec3ba
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.storagetransfer.v1.proto.storage-transfer-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud storagetransfer/StorageTransferService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..28fe5bcecb
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-storage-transfer-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.storagetransfer.v1.proto.spring.StorageTransferServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-talent-spring-starter/pom.xml
new file mode 100644
index 0000000000..7f82045907
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-talent-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CompanyServiceSpringProperties. 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 CompanyServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public CompanyServiceSettings companyServiceSettings( + @Qualifier("defaultCompanyServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CompanyServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CompanyServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CompanyServiceSettings.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 = + CompanyServiceSettings.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 createCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCompanySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createCompanySettings().setRetrySettings(createCompanyRetrySettings); + + RetrySettings getCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCompanySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getCompanySettings().setRetrySettings(getCompanyRetrySettings); + + RetrySettings updateCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCompanySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateCompanySettings().setRetrySettings(updateCompanyRetrySettings); + + RetrySettings deleteCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteCompanySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteCompanySettings().setRetrySettings(deleteCompanyRetrySettings); + + RetrySettings listCompaniesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCompaniesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listCompaniesSettings().setRetrySettings(listCompaniesRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createCompanyRetry = clientProperties.getCreateCompanyRetry(); + if (createCompanyRetry != null) { + RetrySettings createCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createCompanySettings().getRetrySettings(), createCompanyRetry); + clientSettingsBuilder.createCompanySettings().setRetrySettings(createCompanyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createCompany from properties."); + } + } + Retry getCompanyRetry = clientProperties.getGetCompanyRetry(); + if (getCompanyRetry != null) { + RetrySettings getCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getCompanySettings().getRetrySettings(), getCompanyRetry); + clientSettingsBuilder.getCompanySettings().setRetrySettings(getCompanyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getCompany from properties."); + } + } + Retry updateCompanyRetry = clientProperties.getUpdateCompanyRetry(); + if (updateCompanyRetry != null) { + RetrySettings updateCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateCompanySettings().getRetrySettings(), updateCompanyRetry); + clientSettingsBuilder.updateCompanySettings().setRetrySettings(updateCompanyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateCompany from properties."); + } + } + Retry deleteCompanyRetry = clientProperties.getDeleteCompanyRetry(); + if (deleteCompanyRetry != null) { + RetrySettings deleteCompanyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteCompanySettings().getRetrySettings(), deleteCompanyRetry); + clientSettingsBuilder.deleteCompanySettings().setRetrySettings(deleteCompanyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteCompany from properties."); + } + } + Retry listCompaniesRetry = clientProperties.getListCompaniesRetry(); + if (listCompaniesRetry != null) { + RetrySettings listCompaniesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listCompaniesSettings().getRetrySettings(), listCompaniesRetry); + clientSettingsBuilder.listCompaniesSettings().setRetrySettings(listCompaniesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listCompanies from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CompanyServiceClient bean configured with CompanyServiceSettings. + * + * @param companyServiceSettings settings to configure an instance of client bean. + * @return a {@link CompanyServiceClient} bean configured with {@link CompanyServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public CompanyServiceClient companyServiceClient(CompanyServiceSettings companyServiceSettings) + throws IOException { + return CompanyServiceClient.create(companyServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-company-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringProperties.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringProperties.java new file mode 100644 index 0000000000..3435d32ef1 --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompanyServiceSpringProperties.java @@ -0,0 +1,148 @@ +/* + * Copyright 2022 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.talent.v4.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 CompanyService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.talent.v4.company-service") +public class CompanyServiceSpringProperties 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/jobs"); + /** 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 createCompany. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createCompanyRetry; + /** + * Allow override of retry settings at method-level for getCompany. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getCompanyRetry; + /** + * Allow override of retry settings at method-level for updateCompany. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateCompanyRetry; + /** + * Allow override of retry settings at method-level for deleteCompany. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteCompanyRetry; + /** + * Allow override of retry settings at method-level for listCompanies. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listCompaniesRetry; + + @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 getCreateCompanyRetry() { + return this.createCompanyRetry; + } + + public void setCreateCompanyRetry(Retry createCompanyRetry) { + this.createCompanyRetry = createCompanyRetry; + } + + public Retry getGetCompanyRetry() { + return this.getCompanyRetry; + } + + public void setGetCompanyRetry(Retry getCompanyRetry) { + this.getCompanyRetry = getCompanyRetry; + } + + public Retry getUpdateCompanyRetry() { + return this.updateCompanyRetry; + } + + public void setUpdateCompanyRetry(Retry updateCompanyRetry) { + this.updateCompanyRetry = updateCompanyRetry; + } + + public Retry getDeleteCompanyRetry() { + return this.deleteCompanyRetry; + } + + public void setDeleteCompanyRetry(Retry deleteCompanyRetry) { + this.deleteCompanyRetry = deleteCompanyRetry; + } + + public Retry getListCompaniesRetry() { + return this.listCompaniesRetry; + } + + public void setListCompaniesRetry(Retry listCompaniesRetry) { + this.listCompaniesRetry = listCompaniesRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java new file mode 100644 index 0000000000..97ac5abbab --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringAutoConfiguration.java @@ -0,0 +1,200 @@ +/* + * Copyright 2022 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.talent.v4.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.CompletionSettings; +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 CompletionClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in CompletionSpringProperties. 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 CompletionSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public CompletionSettings completionSettings( + @Qualifier("defaultCompletionTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + CompletionSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = CompletionSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = CompletionSettings.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 = + CompletionSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry completeQueryRetry = clientProperties.getCompleteQueryRetry(); + if (completeQueryRetry != null) { + RetrySettings completeQueryRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.completeQuerySettings().getRetrySettings(), completeQueryRetry); + clientSettingsBuilder.completeQuerySettings().setRetrySettings(completeQueryRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for completeQuery from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a CompletionClient bean configured with CompletionSettings. + * + * @param completionSettings settings to configure an instance of client bean. + * @return a {@link CompletionClient} bean configured with {@link CompletionSettings} + */ + @Bean + @ConditionalOnMissingBean + public CompletionClient completionClient(CompletionSettings completionSettings) + throws IOException { + return CompletionClient.create(completionSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-completion"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringProperties.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringProperties.java new file mode 100644 index 0000000000..d46de2eabf --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/CompletionSpringProperties.java @@ -0,0 +1,96 @@ +/* + * Copyright 2022 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.talent.v4.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 Completion client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.talent.v4.completion") +public class CompletionSpringProperties 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/jobs"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for completeQuery. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry completeQueryRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getCompleteQueryRetry() { + return this.completeQueryRetry; + } + + public void setCompleteQueryRetry(Retry completeQueryRetry) { + this.completeQueryRetry = completeQueryRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..75fc0a15fe --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringAutoConfiguration.java @@ -0,0 +1,207 @@ +/* + * Copyright 2022 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.talent.v4.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.EventServiceSettings; +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 EventServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in EventServiceSpringProperties. 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 EventServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public EventServiceSettings eventServiceSettings( + @Qualifier("defaultEventServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + EventServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = EventServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = EventServiceSettings.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 = + EventServiceSettings.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 createClientEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createClientEventSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .createClientEventSettings() + .setRetrySettings(createClientEventRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createClientEventRetry = clientProperties.getCreateClientEventRetry(); + if (createClientEventRetry != null) { + RetrySettings createClientEventRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createClientEventSettings().getRetrySettings(), + createClientEventRetry); + clientSettingsBuilder + .createClientEventSettings() + .setRetrySettings(createClientEventRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for createClientEvent from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a EventServiceClient bean configured with EventServiceSettings. + * + * @param eventServiceSettings settings to configure an instance of client bean. + * @return a {@link EventServiceClient} bean configured with {@link EventServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public EventServiceClient eventServiceClient(EventServiceSettings eventServiceSettings) + throws IOException { + return EventServiceClient.create(eventServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-event-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringProperties.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringProperties.java new file mode 100644 index 0000000000..97ce805311 --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/EventServiceSpringProperties.java @@ -0,0 +1,96 @@ +/* + * Copyright 2022 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.talent.v4.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 EventService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.talent.v4.event-service") +public class EventServiceSpringProperties 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/jobs"); + /** 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 createClientEvent. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createClientEventRetry; + + @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 getCreateClientEventRetry() { + return this.createClientEventRetry; + } + + public void setCreateClientEventRetry(Retry createClientEventRetry) { + this.createClientEventRetry = createClientEventRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..dddd25276d --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringAutoConfiguration.java @@ -0,0 +1,296 @@ +/* + * Copyright 2022 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.talent.v4.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobServiceSettings; +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 JobServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in JobServiceSpringProperties. 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 JobServiceSettings} bean configured with {@link TransportChannelProvider} + * bean. + */ + @Bean + @ConditionalOnMissingBean + public JobServiceSettings jobServiceSettings( + @Qualifier("defaultJobServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + JobServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = JobServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = JobServiceSettings.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 = + JobServiceSettings.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 createJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings); + + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + + RetrySettings updateJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings); + + RetrySettings deleteJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteJobSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings); + + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + + RetrySettings searchJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchJobsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder.searchJobsSettings().setRetrySettings(searchJobsRetrySettings); + + RetrySettings searchJobsForAlertRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchJobsForAlertSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .searchJobsForAlertSettings() + .setRetrySettings(searchJobsForAlertRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry createJobRetry = clientProperties.getCreateJobRetry(); + if (createJobRetry != null) { + RetrySettings createJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.createJobSettings().getRetrySettings(), createJobRetry); + clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for createJob from properties."); + } + } + Retry getJobRetry = clientProperties.getGetJobRetry(); + if (getJobRetry != null) { + RetrySettings getJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getJobSettings().getRetrySettings(), getJobRetry); + clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getJob from properties."); + } + } + Retry updateJobRetry = clientProperties.getUpdateJobRetry(); + if (updateJobRetry != null) { + RetrySettings updateJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateJobSettings().getRetrySettings(), updateJobRetry); + clientSettingsBuilder.updateJobSettings().setRetrySettings(updateJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for updateJob from properties."); + } + } + Retry deleteJobRetry = clientProperties.getDeleteJobRetry(); + if (deleteJobRetry != null) { + RetrySettings deleteJobRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.deleteJobSettings().getRetrySettings(), deleteJobRetry); + clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for deleteJob from properties."); + } + } + Retry listJobsRetry = clientProperties.getListJobsRetry(); + if (listJobsRetry != null) { + RetrySettings listJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listJobsSettings().getRetrySettings(), listJobsRetry); + clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for listJobs from properties."); + } + } + Retry searchJobsRetry = clientProperties.getSearchJobsRetry(); + if (searchJobsRetry != null) { + RetrySettings searchJobsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchJobsSettings().getRetrySettings(), searchJobsRetry); + clientSettingsBuilder.searchJobsSettings().setRetrySettings(searchJobsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for searchJobs from properties."); + } + } + Retry searchJobsForAlertRetry = clientProperties.getSearchJobsForAlertRetry(); + if (searchJobsForAlertRetry != null) { + RetrySettings searchJobsForAlertRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.searchJobsForAlertSettings().getRetrySettings(), + searchJobsForAlertRetry); + clientSettingsBuilder + .searchJobsForAlertSettings() + .setRetrySettings(searchJobsForAlertRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for searchJobsForAlert from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a JobServiceClient bean configured with JobServiceSettings. + * + * @param jobServiceSettings settings to configure an instance of client bean. + * @return a {@link JobServiceClient} bean configured with {@link JobServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public JobServiceClient jobServiceClient(JobServiceSettings jobServiceSettings) + throws IOException { + return JobServiceClient.create(jobServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-job-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringProperties.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringProperties.java new file mode 100644 index 0000000000..34d14a5491 --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/JobServiceSpringProperties.java @@ -0,0 +1,174 @@ +/* + * Copyright 2022 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.talent.v4.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 JobService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.talent.v4.job-service") +public class JobServiceSpringProperties 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/jobs"); + /** 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 createJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry createJobRetry; + /** + * Allow override of retry settings at method-level for getJob. If defined, this takes precedence + * over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getJobRetry; + /** + * Allow override of retry settings at method-level for updateJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateJobRetry; + /** + * Allow override of retry settings at method-level for deleteJob. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry deleteJobRetry; + /** + * Allow override of retry settings at method-level for listJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listJobsRetry; + /** + * Allow override of retry settings at method-level for searchJobs. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchJobsRetry; + /** + * Allow override of retry settings at method-level for searchJobsForAlert. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry searchJobsForAlertRetry; + + @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 getCreateJobRetry() { + return this.createJobRetry; + } + + public void setCreateJobRetry(Retry createJobRetry) { + this.createJobRetry = createJobRetry; + } + + public Retry getGetJobRetry() { + return this.getJobRetry; + } + + public void setGetJobRetry(Retry getJobRetry) { + this.getJobRetry = getJobRetry; + } + + public Retry getUpdateJobRetry() { + return this.updateJobRetry; + } + + public void setUpdateJobRetry(Retry updateJobRetry) { + this.updateJobRetry = updateJobRetry; + } + + public Retry getDeleteJobRetry() { + return this.deleteJobRetry; + } + + public void setDeleteJobRetry(Retry deleteJobRetry) { + this.deleteJobRetry = deleteJobRetry; + } + + public Retry getListJobsRetry() { + return this.listJobsRetry; + } + + public void setListJobsRetry(Retry listJobsRetry) { + this.listJobsRetry = listJobsRetry; + } + + public Retry getSearchJobsRetry() { + return this.searchJobsRetry; + } + + public void setSearchJobsRetry(Retry searchJobsRetry) { + this.searchJobsRetry = searchJobsRetry; + } + + public Retry getSearchJobsForAlertRetry() { + return this.searchJobsForAlertRetry; + } + + public void setSearchJobsForAlertRetry(Retry searchJobsForAlertRetry) { + this.searchJobsForAlertRetry = searchJobsForAlertRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..4ac01c424f --- /dev/null +++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringAutoConfiguration.java @@ -0,0 +1,261 @@ +/* + * Copyright 2022 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.talent.v4.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.TenantServiceSettings; +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 TenantServiceClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TenantServiceSpringProperties. 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 TenantServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TenantServiceSettings tenantServiceSettings(
+ @Qualifier("defaultTenantServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TenantServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TenantServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TenantServiceSettings.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 =
+ TenantServiceSettings.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 createTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTenantSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createTenantSettings().setRetrySettings(createTenantRetrySettings);
+
+ RetrySettings getTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTenantSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTenantSettings().setRetrySettings(getTenantRetrySettings);
+
+ RetrySettings updateTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTenantSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateTenantSettings().setRetrySettings(updateTenantRetrySettings);
+
+ RetrySettings deleteTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTenantSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteTenantSettings().setRetrySettings(deleteTenantRetrySettings);
+
+ RetrySettings listTenantsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTenantsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTenantsSettings().setRetrySettings(listTenantsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createTenantRetry = clientProperties.getCreateTenantRetry();
+ if (createTenantRetry != null) {
+ RetrySettings createTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTenantSettings().getRetrySettings(), createTenantRetry);
+ clientSettingsBuilder.createTenantSettings().setRetrySettings(createTenantRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createTenant from properties.");
+ }
+ }
+ Retry getTenantRetry = clientProperties.getGetTenantRetry();
+ if (getTenantRetry != null) {
+ RetrySettings getTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTenantSettings().getRetrySettings(), getTenantRetry);
+ clientSettingsBuilder.getTenantSettings().setRetrySettings(getTenantRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTenant from properties.");
+ }
+ }
+ Retry updateTenantRetry = clientProperties.getUpdateTenantRetry();
+ if (updateTenantRetry != null) {
+ RetrySettings updateTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateTenantSettings().getRetrySettings(), updateTenantRetry);
+ clientSettingsBuilder.updateTenantSettings().setRetrySettings(updateTenantRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateTenant from properties.");
+ }
+ }
+ Retry deleteTenantRetry = clientProperties.getDeleteTenantRetry();
+ if (deleteTenantRetry != null) {
+ RetrySettings deleteTenantRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTenantSettings().getRetrySettings(), deleteTenantRetry);
+ clientSettingsBuilder.deleteTenantSettings().setRetrySettings(deleteTenantRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteTenant from properties.");
+ }
+ }
+ Retry listTenantsRetry = clientProperties.getListTenantsRetry();
+ if (listTenantsRetry != null) {
+ RetrySettings listTenantsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTenantsSettings().getRetrySettings(), listTenantsRetry);
+ clientSettingsBuilder.listTenantsSettings().setRetrySettings(listTenantsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTenants from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TenantServiceClient bean configured with TenantServiceSettings.
+ *
+ * @param tenantServiceSettings settings to configure an instance of client bean.
+ * @return a {@link TenantServiceClient} bean configured with {@link TenantServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TenantServiceClient tenantServiceClient(TenantServiceSettings tenantServiceSettings)
+ throws IOException {
+ return TenantServiceClient.create(tenantServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-tenant-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringProperties.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringProperties.java
new file mode 100644
index 0000000000..ae518b8504
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/TenantServiceSpringProperties.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2022 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.talent.v4.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 TenantService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.talent.v4.tenant-service")
+public class TenantServiceSpringProperties 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/jobs");
+ /** 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 createTenant. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTenantRetry;
+ /**
+ * Allow override of retry settings at method-level for getTenant. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTenantRetry;
+ /**
+ * Allow override of retry settings at method-level for updateTenant. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateTenantRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTenant. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTenantRetry;
+ /**
+ * Allow override of retry settings at method-level for listTenants. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTenantsRetry;
+
+ @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 getCreateTenantRetry() {
+ return this.createTenantRetry;
+ }
+
+ public void setCreateTenantRetry(Retry createTenantRetry) {
+ this.createTenantRetry = createTenantRetry;
+ }
+
+ public Retry getGetTenantRetry() {
+ return this.getTenantRetry;
+ }
+
+ public void setGetTenantRetry(Retry getTenantRetry) {
+ this.getTenantRetry = getTenantRetry;
+ }
+
+ public Retry getUpdateTenantRetry() {
+ return this.updateTenantRetry;
+ }
+
+ public void setUpdateTenantRetry(Retry updateTenantRetry) {
+ this.updateTenantRetry = updateTenantRetry;
+ }
+
+ public Retry getDeleteTenantRetry() {
+ return this.deleteTenantRetry;
+ }
+
+ public void setDeleteTenantRetry(Retry deleteTenantRetry) {
+ this.deleteTenantRetry = deleteTenantRetry;
+ }
+
+ public Retry getListTenantsRetry() {
+ return this.listTenantsRetry;
+ }
+
+ public void setListTenantsRetry(Retry listTenantsRetry) {
+ this.listTenantsRetry = listTenantsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/package-info.java b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/package-info.java
new file mode 100644
index 0000000000..c11e053162
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/java/com/google/cloud/talent/v4/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for jobs. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.talent.v4.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..4f6b0cf5c5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,34 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.talent.v4.company-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud jobs/CompanyService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.talent.v4.completion.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud jobs/Completion components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.talent.v4.event-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud jobs/EventService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.talent.v4.job-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud jobs/JobService components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.talent.v4.tenant-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud jobs/TenantService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..43d0483b36
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-talent-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,5 @@
+com.google.cloud.talent.v4.spring.CompanyServiceSpringAutoConfiguration
+com.google.cloud.talent.v4.spring.CompletionSpringAutoConfiguration
+com.google.cloud.talent.v4.spring.EventServiceSpringAutoConfiguration
+com.google.cloud.talent.v4.spring.JobServiceSpringAutoConfiguration
+com.google.cloud.talent.v4.spring.TenantServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-tasks-spring-starter/pom.xml
new file mode 100644
index 0000000000..2aacc32a10
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in CloudTasksSpringProperties. 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 CloudTasksSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudTasksSettings cloudTasksSettings(
+ @Qualifier("defaultCloudTasksTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ CloudTasksSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = CloudTasksSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = CloudTasksSettings.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 =
+ CloudTasksSettings.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 listQueuesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listQueuesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listQueuesSettings().setRetrySettings(listQueuesRetrySettings);
+
+ RetrySettings getQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getQueueSettings().setRetrySettings(getQueueRetrySettings);
+
+ RetrySettings createQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createQueueSettings().setRetrySettings(createQueueRetrySettings);
+
+ RetrySettings updateQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateQueueSettings().setRetrySettings(updateQueueRetrySettings);
+
+ RetrySettings deleteQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteQueueSettings().setRetrySettings(deleteQueueRetrySettings);
+
+ RetrySettings purgeQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.purgeQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.purgeQueueSettings().setRetrySettings(purgeQueueRetrySettings);
+
+ RetrySettings pauseQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.pauseQueueSettings().setRetrySettings(pauseQueueRetrySettings);
+
+ RetrySettings resumeQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeQueueSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.resumeQueueSettings().setRetrySettings(resumeQueueRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings listTasksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTasksSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listTasksSettings().setRetrySettings(listTasksRetrySettings);
+
+ RetrySettings getTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTaskSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getTaskSettings().setRetrySettings(getTaskRetrySettings);
+
+ RetrySettings createTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTaskSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createTaskSettings().setRetrySettings(createTaskRetrySettings);
+
+ RetrySettings deleteTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTaskSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteTaskSettings().setRetrySettings(deleteTaskRetrySettings);
+
+ RetrySettings runTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.runTaskSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.runTaskSettings().setRetrySettings(runTaskRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listQueuesRetry = clientProperties.getListQueuesRetry();
+ if (listQueuesRetry != null) {
+ RetrySettings listQueuesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listQueuesSettings().getRetrySettings(), listQueuesRetry);
+ clientSettingsBuilder.listQueuesSettings().setRetrySettings(listQueuesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listQueues from properties.");
+ }
+ }
+ Retry getQueueRetry = clientProperties.getGetQueueRetry();
+ if (getQueueRetry != null) {
+ RetrySettings getQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getQueueSettings().getRetrySettings(), getQueueRetry);
+ clientSettingsBuilder.getQueueSettings().setRetrySettings(getQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getQueue from properties.");
+ }
+ }
+ Retry createQueueRetry = clientProperties.getCreateQueueRetry();
+ if (createQueueRetry != null) {
+ RetrySettings createQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createQueueSettings().getRetrySettings(), createQueueRetry);
+ clientSettingsBuilder.createQueueSettings().setRetrySettings(createQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createQueue from properties.");
+ }
+ }
+ Retry updateQueueRetry = clientProperties.getUpdateQueueRetry();
+ if (updateQueueRetry != null) {
+ RetrySettings updateQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateQueueSettings().getRetrySettings(), updateQueueRetry);
+ clientSettingsBuilder.updateQueueSettings().setRetrySettings(updateQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateQueue from properties.");
+ }
+ }
+ Retry deleteQueueRetry = clientProperties.getDeleteQueueRetry();
+ if (deleteQueueRetry != null) {
+ RetrySettings deleteQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteQueueSettings().getRetrySettings(), deleteQueueRetry);
+ clientSettingsBuilder.deleteQueueSettings().setRetrySettings(deleteQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteQueue from properties.");
+ }
+ }
+ Retry purgeQueueRetry = clientProperties.getPurgeQueueRetry();
+ if (purgeQueueRetry != null) {
+ RetrySettings purgeQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.purgeQueueSettings().getRetrySettings(), purgeQueueRetry);
+ clientSettingsBuilder.purgeQueueSettings().setRetrySettings(purgeQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for purgeQueue from properties.");
+ }
+ }
+ Retry pauseQueueRetry = clientProperties.getPauseQueueRetry();
+ if (pauseQueueRetry != null) {
+ RetrySettings pauseQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.pauseQueueSettings().getRetrySettings(), pauseQueueRetry);
+ clientSettingsBuilder.pauseQueueSettings().setRetrySettings(pauseQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for pauseQueue from properties.");
+ }
+ }
+ Retry resumeQueueRetry = clientProperties.getResumeQueueRetry();
+ if (resumeQueueRetry != null) {
+ RetrySettings resumeQueueRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.resumeQueueSettings().getRetrySettings(), resumeQueueRetry);
+ clientSettingsBuilder.resumeQueueSettings().setRetrySettings(resumeQueueRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for resumeQueue from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ Retry listTasksRetry = clientProperties.getListTasksRetry();
+ if (listTasksRetry != null) {
+ RetrySettings listTasksRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTasksSettings().getRetrySettings(), listTasksRetry);
+ clientSettingsBuilder.listTasksSettings().setRetrySettings(listTasksRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listTasks from properties.");
+ }
+ }
+ Retry getTaskRetry = clientProperties.getGetTaskRetry();
+ if (getTaskRetry != null) {
+ RetrySettings getTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTaskSettings().getRetrySettings(), getTaskRetry);
+ clientSettingsBuilder.getTaskSettings().setRetrySettings(getTaskRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getTask from properties.");
+ }
+ }
+ Retry createTaskRetry = clientProperties.getCreateTaskRetry();
+ if (createTaskRetry != null) {
+ RetrySettings createTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createTaskSettings().getRetrySettings(), createTaskRetry);
+ clientSettingsBuilder.createTaskSettings().setRetrySettings(createTaskRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createTask from properties.");
+ }
+ }
+ Retry deleteTaskRetry = clientProperties.getDeleteTaskRetry();
+ if (deleteTaskRetry != null) {
+ RetrySettings deleteTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteTaskSettings().getRetrySettings(), deleteTaskRetry);
+ clientSettingsBuilder.deleteTaskSettings().setRetrySettings(deleteTaskRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteTask from properties.");
+ }
+ }
+ Retry runTaskRetry = clientProperties.getRunTaskRetry();
+ if (runTaskRetry != null) {
+ RetrySettings runTaskRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.runTaskSettings().getRetrySettings(), runTaskRetry);
+ clientSettingsBuilder.runTaskSettings().setRetrySettings(runTaskRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for runTask from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a CloudTasksClient bean configured with CloudTasksSettings.
+ *
+ * @param cloudTasksSettings settings to configure an instance of client bean.
+ * @return a {@link CloudTasksClient} bean configured with {@link CloudTasksSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public CloudTasksClient cloudTasksClient(CloudTasksSettings cloudTasksSettings)
+ throws IOException {
+ return CloudTasksClient.create(cloudTasksSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-cloud-tasks";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringProperties.java b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringProperties.java
new file mode 100644
index 0000000000..5b6ce2efc4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/CloudTasksSpringProperties.java
@@ -0,0 +1,290 @@
+/*
+ * Copyright 2022 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.tasks.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 CloudTasks client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.tasks.v2.cloud-tasks")
+public class CloudTasksSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listQueues. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listQueuesRetry;
+ /**
+ * Allow override of retry settings at method-level for getQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for createQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for updateQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for purgeQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry purgeQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for pauseQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry pauseQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for resumeQueue. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry resumeQueueRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for listTasks. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTasksRetry;
+ /**
+ * Allow override of retry settings at method-level for getTask. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTaskRetry;
+ /**
+ * Allow override of retry settings at method-level for createTask. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createTaskRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteTask. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteTaskRetry;
+ /**
+ * Allow override of retry settings at method-level for runTask. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry runTaskRetry;
+
+ @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 getListQueuesRetry() {
+ return this.listQueuesRetry;
+ }
+
+ public void setListQueuesRetry(Retry listQueuesRetry) {
+ this.listQueuesRetry = listQueuesRetry;
+ }
+
+ public Retry getGetQueueRetry() {
+ return this.getQueueRetry;
+ }
+
+ public void setGetQueueRetry(Retry getQueueRetry) {
+ this.getQueueRetry = getQueueRetry;
+ }
+
+ public Retry getCreateQueueRetry() {
+ return this.createQueueRetry;
+ }
+
+ public void setCreateQueueRetry(Retry createQueueRetry) {
+ this.createQueueRetry = createQueueRetry;
+ }
+
+ public Retry getUpdateQueueRetry() {
+ return this.updateQueueRetry;
+ }
+
+ public void setUpdateQueueRetry(Retry updateQueueRetry) {
+ this.updateQueueRetry = updateQueueRetry;
+ }
+
+ public Retry getDeleteQueueRetry() {
+ return this.deleteQueueRetry;
+ }
+
+ public void setDeleteQueueRetry(Retry deleteQueueRetry) {
+ this.deleteQueueRetry = deleteQueueRetry;
+ }
+
+ public Retry getPurgeQueueRetry() {
+ return this.purgeQueueRetry;
+ }
+
+ public void setPurgeQueueRetry(Retry purgeQueueRetry) {
+ this.purgeQueueRetry = purgeQueueRetry;
+ }
+
+ public Retry getPauseQueueRetry() {
+ return this.pauseQueueRetry;
+ }
+
+ public void setPauseQueueRetry(Retry pauseQueueRetry) {
+ this.pauseQueueRetry = pauseQueueRetry;
+ }
+
+ public Retry getResumeQueueRetry() {
+ return this.resumeQueueRetry;
+ }
+
+ public void setResumeQueueRetry(Retry resumeQueueRetry) {
+ this.resumeQueueRetry = resumeQueueRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+
+ public Retry getListTasksRetry() {
+ return this.listTasksRetry;
+ }
+
+ public void setListTasksRetry(Retry listTasksRetry) {
+ this.listTasksRetry = listTasksRetry;
+ }
+
+ public Retry getGetTaskRetry() {
+ return this.getTaskRetry;
+ }
+
+ public void setGetTaskRetry(Retry getTaskRetry) {
+ this.getTaskRetry = getTaskRetry;
+ }
+
+ public Retry getCreateTaskRetry() {
+ return this.createTaskRetry;
+ }
+
+ public void setCreateTaskRetry(Retry createTaskRetry) {
+ this.createTaskRetry = createTaskRetry;
+ }
+
+ public Retry getDeleteTaskRetry() {
+ return this.deleteTaskRetry;
+ }
+
+ public void setDeleteTaskRetry(Retry deleteTaskRetry) {
+ this.deleteTaskRetry = deleteTaskRetry;
+ }
+
+ public Retry getRunTaskRetry() {
+ return this.runTaskRetry;
+ }
+
+ public void setRunTaskRetry(Retry runTaskRetry) {
+ this.runTaskRetry = runTaskRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/package-info.java
new file mode 100644
index 0000000000..f03145ea4b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/java/com/google/cloud/tasks/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudtasks. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.tasks.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..2e58cdba6a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.tasks.v2.cloud-tasks.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudtasks/CloudTasks components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..4078be2c63
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tasks-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.tasks.v2.spring.CloudTasksSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/pom.xml
new file mode 100644
index 0000000000..eb109ca509
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified + * in TextToSpeechLongAudioSynthesizeSpringProperties. 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 TextToSpeechLongAudioSynthesizeSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings( + @Qualifier("defaultTextToSpeechLongAudioSynthesizeTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + TextToSpeechLongAudioSynthesizeSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = TextToSpeechLongAudioSynthesizeSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = TextToSpeechLongAudioSynthesizeSettings.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 = + TextToSpeechLongAudioSynthesizeSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a TextToSpeechLongAudioSynthesizeClient bean configured with + * TextToSpeechLongAudioSynthesizeSettings. + * + * @param textToSpeechLongAudioSynthesizeSettings settings to configure an instance of client + * bean. + * @return a {@link TextToSpeechLongAudioSynthesizeClient} bean configured with {@link + * TextToSpeechLongAudioSynthesizeSettings} + */ + @Bean + @ConditionalOnMissingBean + public TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient( + TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings) + throws IOException { + return TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-text-to-speech-long-audio-synthesize"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringProperties.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringProperties.java new file mode 100644 index 0000000000..af449903cc --- /dev/null +++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechLongAudioSynthesizeSpringProperties.java @@ -0,0 +1,82 @@ +/* + * Copyright 2022 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.texttospeech.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 TextToSpeechLongAudioSynthesize client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.texttospeech.v1.text-to-speech-long-audio-synthesize") +public class TextToSpeechLongAudioSynthesizeSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } +} diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java new file mode 100644 index 0000000000..e34b766c44 --- /dev/null +++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringAutoConfiguration.java @@ -0,0 +1,222 @@ +/* + * Copyright 2022 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.texttospeech.v1.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import com.google.cloud.texttospeech.v1.TextToSpeechClient; +import com.google.cloud.texttospeech.v1.TextToSpeechSettings; +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 TextToSpeechClient}. + * + *
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TextToSpeechSpringProperties. 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 TextToSpeechSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TextToSpeechSettings textToSpeechSettings(
+ @Qualifier("defaultTextToSpeechTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TextToSpeechSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TextToSpeechSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TextToSpeechSettings.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 =
+ TextToSpeechSettings.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 listVoicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVoicesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listVoicesSettings().setRetrySettings(listVoicesRetrySettings);
+
+ RetrySettings synthesizeSpeechRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.synthesizeSpeechSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .synthesizeSpeechSettings()
+ .setRetrySettings(synthesizeSpeechRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listVoicesRetry = clientProperties.getListVoicesRetry();
+ if (listVoicesRetry != null) {
+ RetrySettings listVoicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listVoicesSettings().getRetrySettings(), listVoicesRetry);
+ clientSettingsBuilder.listVoicesSettings().setRetrySettings(listVoicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listVoices from properties.");
+ }
+ }
+ Retry synthesizeSpeechRetry = clientProperties.getSynthesizeSpeechRetry();
+ if (synthesizeSpeechRetry != null) {
+ RetrySettings synthesizeSpeechRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.synthesizeSpeechSettings().getRetrySettings(),
+ synthesizeSpeechRetry);
+ clientSettingsBuilder
+ .synthesizeSpeechSettings()
+ .setRetrySettings(synthesizeSpeechRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for synthesizeSpeech from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TextToSpeechClient bean configured with TextToSpeechSettings.
+ *
+ * @param textToSpeechSettings settings to configure an instance of client bean.
+ * @return a {@link TextToSpeechClient} bean configured with {@link TextToSpeechSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TextToSpeechClient textToSpeechClient(TextToSpeechSettings textToSpeechSettings)
+ throws IOException {
+ return TextToSpeechClient.create(textToSpeechSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-text-to-speech";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringProperties.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringProperties.java
new file mode 100644
index 0000000000..edfc9e9b55
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/TextToSpeechSpringProperties.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2022 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.texttospeech.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 TextToSpeech client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.texttospeech.v1.text-to-speech")
+public class TextToSpeechSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listVoices. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listVoicesRetry;
+ /**
+ * Allow override of retry settings at method-level for synthesizeSpeech. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry synthesizeSpeechRetry;
+
+ @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 getListVoicesRetry() {
+ return this.listVoicesRetry;
+ }
+
+ public void setListVoicesRetry(Retry listVoicesRetry) {
+ this.listVoicesRetry = listVoicesRetry;
+ }
+
+ public Retry getSynthesizeSpeechRetry() {
+ return this.synthesizeSpeechRetry;
+ }
+
+ public void setSynthesizeSpeechRetry(Retry synthesizeSpeechRetry) {
+ this.synthesizeSpeechRetry = synthesizeSpeechRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/package-info.java
new file mode 100644
index 0000000000..a553b12030
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/java/com/google/cloud/texttospeech/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for texttospeech. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.texttospeech.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..255186dcc0
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,16 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.texttospeech.v1.text-to-speech.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud texttospeech/TextToSpeech components.",
+ "defaultValue": true
+ },
+ {
+ "name": "com.google.cloud.texttospeech.v1.text-to-speech-long-audio-synthesize.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud texttospeech/TextToSpeechLongAudioSynthesize components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..3f454815f7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-texttospeech-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,2 @@
+com.google.cloud.texttospeech.v1.spring.TextToSpeechSpringAutoConfiguration
+com.google.cloud.texttospeech.v1.spring.TextToSpeechLongAudioSynthesizeSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-tpu-spring-starter/pom.xml
new file mode 100644
index 0000000000..ae62c28be5
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TpuSpringProperties. 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 TpuSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TpuSettings tpuSettings(
+ @Qualifier("defaultTpuTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TpuSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TpuSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TpuSettings.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 =
+ TpuSettings.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 listNodesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNodesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listNodesSettings().setRetrySettings(listNodesRetrySettings);
+
+ RetrySettings getNodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNodeSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getNodeSettings().setRetrySettings(getNodeRetrySettings);
+
+ RetrySettings generateServiceIdentityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateServiceIdentitySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .generateServiceIdentitySettings()
+ .setRetrySettings(generateServiceIdentityRetrySettings);
+
+ RetrySettings listAcceleratorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAcceleratorTypesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listAcceleratorTypesSettings()
+ .setRetrySettings(listAcceleratorTypesRetrySettings);
+
+ RetrySettings getAcceleratorTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAcceleratorTypeSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getAcceleratorTypeSettings()
+ .setRetrySettings(getAcceleratorTypeRetrySettings);
+
+ RetrySettings listRuntimeVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRuntimeVersionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listRuntimeVersionsSettings()
+ .setRetrySettings(listRuntimeVersionsRetrySettings);
+
+ RetrySettings getRuntimeVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRuntimeVersionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getRuntimeVersionSettings()
+ .setRetrySettings(getRuntimeVersionRetrySettings);
+
+ RetrySettings getGuestAttributesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGuestAttributesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getGuestAttributesSettings()
+ .setRetrySettings(getGuestAttributesRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listNodesRetry = clientProperties.getListNodesRetry();
+ if (listNodesRetry != null) {
+ RetrySettings listNodesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listNodesSettings().getRetrySettings(), listNodesRetry);
+ clientSettingsBuilder.listNodesSettings().setRetrySettings(listNodesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listNodes from properties.");
+ }
+ }
+ Retry getNodeRetry = clientProperties.getGetNodeRetry();
+ if (getNodeRetry != null) {
+ RetrySettings getNodeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getNodeSettings().getRetrySettings(), getNodeRetry);
+ clientSettingsBuilder.getNodeSettings().setRetrySettings(getNodeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getNode from properties.");
+ }
+ }
+ Retry generateServiceIdentityRetry = clientProperties.getGenerateServiceIdentityRetry();
+ if (generateServiceIdentityRetry != null) {
+ RetrySettings generateServiceIdentityRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.generateServiceIdentitySettings().getRetrySettings(),
+ generateServiceIdentityRetry);
+ clientSettingsBuilder
+ .generateServiceIdentitySettings()
+ .setRetrySettings(generateServiceIdentityRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for generateServiceIdentity from properties.");
+ }
+ }
+ Retry listAcceleratorTypesRetry = clientProperties.getListAcceleratorTypesRetry();
+ if (listAcceleratorTypesRetry != null) {
+ RetrySettings listAcceleratorTypesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAcceleratorTypesSettings().getRetrySettings(),
+ listAcceleratorTypesRetry);
+ clientSettingsBuilder
+ .listAcceleratorTypesSettings()
+ .setRetrySettings(listAcceleratorTypesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listAcceleratorTypes from properties.");
+ }
+ }
+ Retry getAcceleratorTypeRetry = clientProperties.getGetAcceleratorTypeRetry();
+ if (getAcceleratorTypeRetry != null) {
+ RetrySettings getAcceleratorTypeRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAcceleratorTypeSettings().getRetrySettings(),
+ getAcceleratorTypeRetry);
+ clientSettingsBuilder
+ .getAcceleratorTypeSettings()
+ .setRetrySettings(getAcceleratorTypeRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getAcceleratorType from properties.");
+ }
+ }
+ Retry listRuntimeVersionsRetry = clientProperties.getListRuntimeVersionsRetry();
+ if (listRuntimeVersionsRetry != null) {
+ RetrySettings listRuntimeVersionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRuntimeVersionsSettings().getRetrySettings(),
+ listRuntimeVersionsRetry);
+ clientSettingsBuilder
+ .listRuntimeVersionsSettings()
+ .setRetrySettings(listRuntimeVersionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listRuntimeVersions from properties.");
+ }
+ }
+ Retry getRuntimeVersionRetry = clientProperties.getGetRuntimeVersionRetry();
+ if (getRuntimeVersionRetry != null) {
+ RetrySettings getRuntimeVersionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRuntimeVersionSettings().getRetrySettings(),
+ getRuntimeVersionRetry);
+ clientSettingsBuilder
+ .getRuntimeVersionSettings()
+ .setRetrySettings(getRuntimeVersionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getRuntimeVersion from properties.");
+ }
+ }
+ Retry getGuestAttributesRetry = clientProperties.getGetGuestAttributesRetry();
+ if (getGuestAttributesRetry != null) {
+ RetrySettings getGuestAttributesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGuestAttributesSettings().getRetrySettings(),
+ getGuestAttributesRetry);
+ clientSettingsBuilder
+ .getGuestAttributesSettings()
+ .setRetrySettings(getGuestAttributesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getGuestAttributes from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TpuClient bean configured with TpuSettings.
+ *
+ * @param tpuSettings settings to configure an instance of client bean.
+ * @return a {@link TpuClient} bean configured with {@link TpuSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TpuClient tpuClient(TpuSettings tpuSettings) throws IOException {
+ return TpuClient.create(tpuSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-tpu";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringProperties.java b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringProperties.java
new file mode 100644
index 0000000000..d89655095c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/TpuSpringProperties.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2022 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.tpu.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 Tpu client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.tpu.v2.tpu")
+public class TpuSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listNodes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listNodesRetry;
+ /**
+ * Allow override of retry settings at method-level for getNode. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getNodeRetry;
+ /**
+ * Allow override of retry settings at method-level for generateServiceIdentity. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry generateServiceIdentityRetry;
+ /**
+ * Allow override of retry settings at method-level for listAcceleratorTypes. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAcceleratorTypesRetry;
+ /**
+ * Allow override of retry settings at method-level for getAcceleratorType. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAcceleratorTypeRetry;
+ /**
+ * Allow override of retry settings at method-level for listRuntimeVersions. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRuntimeVersionsRetry;
+ /**
+ * Allow override of retry settings at method-level for getRuntimeVersion. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRuntimeVersionRetry;
+ /**
+ * Allow override of retry settings at method-level for getGuestAttributes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGuestAttributesRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListNodesRetry() {
+ return this.listNodesRetry;
+ }
+
+ public void setListNodesRetry(Retry listNodesRetry) {
+ this.listNodesRetry = listNodesRetry;
+ }
+
+ public Retry getGetNodeRetry() {
+ return this.getNodeRetry;
+ }
+
+ public void setGetNodeRetry(Retry getNodeRetry) {
+ this.getNodeRetry = getNodeRetry;
+ }
+
+ public Retry getGenerateServiceIdentityRetry() {
+ return this.generateServiceIdentityRetry;
+ }
+
+ public void setGenerateServiceIdentityRetry(Retry generateServiceIdentityRetry) {
+ this.generateServiceIdentityRetry = generateServiceIdentityRetry;
+ }
+
+ public Retry getListAcceleratorTypesRetry() {
+ return this.listAcceleratorTypesRetry;
+ }
+
+ public void setListAcceleratorTypesRetry(Retry listAcceleratorTypesRetry) {
+ this.listAcceleratorTypesRetry = listAcceleratorTypesRetry;
+ }
+
+ public Retry getGetAcceleratorTypeRetry() {
+ return this.getAcceleratorTypeRetry;
+ }
+
+ public void setGetAcceleratorTypeRetry(Retry getAcceleratorTypeRetry) {
+ this.getAcceleratorTypeRetry = getAcceleratorTypeRetry;
+ }
+
+ public Retry getListRuntimeVersionsRetry() {
+ return this.listRuntimeVersionsRetry;
+ }
+
+ public void setListRuntimeVersionsRetry(Retry listRuntimeVersionsRetry) {
+ this.listRuntimeVersionsRetry = listRuntimeVersionsRetry;
+ }
+
+ public Retry getGetRuntimeVersionRetry() {
+ return this.getRuntimeVersionRetry;
+ }
+
+ public void setGetRuntimeVersionRetry(Retry getRuntimeVersionRetry) {
+ this.getRuntimeVersionRetry = getRuntimeVersionRetry;
+ }
+
+ public Retry getGetGuestAttributesRetry() {
+ return this.getGuestAttributesRetry;
+ }
+
+ public void setGetGuestAttributesRetry(Retry getGuestAttributesRetry) {
+ this.getGuestAttributesRetry = getGuestAttributesRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/package-info.java
new file mode 100644
index 0000000000..0afff4e0d2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/java/com/google/cloud/tpu/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for tpu. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.tpu.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..83e186f0ab
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.tpu.v2.tpu.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud tpu/Tpu components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..b7208e6c9b
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-tpu-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.tpu.v2.spring.TpuSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-trace-spring-starter/pom.xml
new file mode 100644
index 0000000000..8b3030c18f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-trace-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TraceServiceSpringProperties. 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 TraceServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TraceServiceSettings traceServiceSettings(
+ @Qualifier("defaultTraceServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TraceServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TraceServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TraceServiceSettings.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 =
+ TraceServiceSettings.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 batchWriteSpansRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchWriteSpansSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .batchWriteSpansSettings()
+ .setRetrySettings(batchWriteSpansRetrySettings);
+
+ RetrySettings createSpanRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSpanSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createSpanSettings().setRetrySettings(createSpanRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry batchWriteSpansRetry = clientProperties.getBatchWriteSpansRetry();
+ if (batchWriteSpansRetry != null) {
+ RetrySettings batchWriteSpansRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.batchWriteSpansSettings().getRetrySettings(),
+ batchWriteSpansRetry);
+ clientSettingsBuilder
+ .batchWriteSpansSettings()
+ .setRetrySettings(batchWriteSpansRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for batchWriteSpans from properties.");
+ }
+ }
+ Retry createSpanRetry = clientProperties.getCreateSpanRetry();
+ if (createSpanRetry != null) {
+ RetrySettings createSpanRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSpanSettings().getRetrySettings(), createSpanRetry);
+ clientSettingsBuilder.createSpanSettings().setRetrySettings(createSpanRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createSpan from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TraceServiceClient bean configured with TraceServiceSettings.
+ *
+ * @param traceServiceSettings settings to configure an instance of client bean.
+ * @return a {@link TraceServiceClient} bean configured with {@link TraceServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TraceServiceClient traceServiceClient(TraceServiceSettings traceServiceSettings)
+ throws IOException {
+ return TraceServiceClient.create(traceServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-trace-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringProperties.java b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringProperties.java
new file mode 100644
index 0000000000..9347287ed2
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/TraceServiceSpringProperties.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2022 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.trace.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 TraceService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.trace.v2.trace-service")
+public class TraceServiceSpringProperties 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/trace.append");
+ /** 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 batchWriteSpans. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry batchWriteSpansRetry;
+ /**
+ * Allow override of retry settings at method-level for createSpan. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createSpanRetry;
+
+ @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 getBatchWriteSpansRetry() {
+ return this.batchWriteSpansRetry;
+ }
+
+ public void setBatchWriteSpansRetry(Retry batchWriteSpansRetry) {
+ this.batchWriteSpansRetry = batchWriteSpansRetry;
+ }
+
+ public Retry getCreateSpanRetry() {
+ return this.createSpanRetry;
+ }
+
+ public void setCreateSpanRetry(Retry createSpanRetry) {
+ this.createSpanRetry = createSpanRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/package-info.java b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/package-info.java
new file mode 100644
index 0000000000..7d1aa3e0ab
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/java/com/google/cloud/trace/v2/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for cloudtrace. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.trace.v2.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..fc9f74572d
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.trace.v2.trace-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud cloudtrace/TraceService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..1b1eaccd7e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-trace-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.trace.v2.spring.TraceServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/pom.xml
new file mode 100644
index 0000000000..0aea4ec2a6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VideoIntelligenceServiceSpringProperties. 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 VideoIntelligenceServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VideoIntelligenceServiceSettings videoIntelligenceServiceSettings(
+ @Qualifier("defaultVideoIntelligenceServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VideoIntelligenceServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = VideoIntelligenceServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = VideoIntelligenceServiceSettings.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 =
+ VideoIntelligenceServiceSettings.defaultExecutorProviderBuilder()
+ .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount())
+ .build();
+ clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Background executor thread count is "
+ + this.clientProperties.getExecutorThreadCount());
+ }
+ }
+ Retry serviceRetry = clientProperties.getRetry();
+ if (serviceRetry != null) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a VideoIntelligenceServiceClient bean configured with
+ * VideoIntelligenceServiceSettings.
+ *
+ * @param videoIntelligenceServiceSettings settings to configure an instance of client bean.
+ * @return a {@link VideoIntelligenceServiceClient} bean configured with {@link
+ * VideoIntelligenceServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VideoIntelligenceServiceClient videoIntelligenceServiceClient(
+ VideoIntelligenceServiceSettings videoIntelligenceServiceSettings) throws IOException {
+ return VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-video-intelligence-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringProperties.java b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringProperties.java
new file mode 100644
index 0000000000..02a587ad5a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/VideoIntelligenceServiceSpringProperties.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2022 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.videointelligence.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 VideoIntelligenceService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.videointelligence.v1.video-intelligence-service")
+public class VideoIntelligenceServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/package-info.java
new file mode 100644
index 0000000000..9c084910f1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/java/com/google/cloud/videointelligence/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for videointelligence. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.videointelligence.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..4b78cd7f29
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.videointelligence.v1.video-intelligence-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud videointelligence/VideoIntelligenceService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..30b7d237a9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-intelligence-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.videointelligence.v1.spring.VideoIntelligenceServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/pom.xml
new file mode 100644
index 0000000000..91ee54fb49
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in TranscoderServiceSpringProperties. 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 TranscoderServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TranscoderServiceSettings transcoderServiceSettings(
+ @Qualifier("defaultTranscoderServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ TranscoderServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = TranscoderServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = TranscoderServiceSettings.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 =
+ TranscoderServiceSettings.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 createJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings);
+
+ RetrySettings listJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings);
+
+ RetrySettings getJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings);
+
+ RetrySettings deleteJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings);
+
+ RetrySettings createJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobTemplateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createJobTemplateSettings()
+ .setRetrySettings(createJobTemplateRetrySettings);
+
+ RetrySettings listJobTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobTemplatesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listJobTemplatesSettings()
+ .setRetrySettings(listJobTemplatesRetrySettings);
+
+ RetrySettings getJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobTemplateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getJobTemplateSettings().setRetrySettings(getJobTemplateRetrySettings);
+
+ RetrySettings deleteJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobTemplateSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteJobTemplateSettings()
+ .setRetrySettings(deleteJobTemplateRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createJobRetry = clientProperties.getCreateJobRetry();
+ if (createJobRetry != null) {
+ RetrySettings createJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobSettings().getRetrySettings(), createJobRetry);
+ clientSettingsBuilder.createJobSettings().setRetrySettings(createJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createJob from properties.");
+ }
+ }
+ Retry listJobsRetry = clientProperties.getListJobsRetry();
+ if (listJobsRetry != null) {
+ RetrySettings listJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobsSettings().getRetrySettings(), listJobsRetry);
+ clientSettingsBuilder.listJobsSettings().setRetrySettings(listJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listJobs from properties.");
+ }
+ }
+ Retry getJobRetry = clientProperties.getGetJobRetry();
+ if (getJobRetry != null) {
+ RetrySettings getJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobSettings().getRetrySettings(), getJobRetry);
+ clientSettingsBuilder.getJobSettings().setRetrySettings(getJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJob from properties.");
+ }
+ }
+ Retry deleteJobRetry = clientProperties.getDeleteJobRetry();
+ if (deleteJobRetry != null) {
+ RetrySettings deleteJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobSettings().getRetrySettings(), deleteJobRetry);
+ clientSettingsBuilder.deleteJobSettings().setRetrySettings(deleteJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteJob from properties.");
+ }
+ }
+ Retry createJobTemplateRetry = clientProperties.getCreateJobTemplateRetry();
+ if (createJobTemplateRetry != null) {
+ RetrySettings createJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createJobTemplateSettings().getRetrySettings(),
+ createJobTemplateRetry);
+ clientSettingsBuilder
+ .createJobTemplateSettings()
+ .setRetrySettings(createJobTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createJobTemplate from properties.");
+ }
+ }
+ Retry listJobTemplatesRetry = clientProperties.getListJobTemplatesRetry();
+ if (listJobTemplatesRetry != null) {
+ RetrySettings listJobTemplatesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listJobTemplatesSettings().getRetrySettings(),
+ listJobTemplatesRetry);
+ clientSettingsBuilder
+ .listJobTemplatesSettings()
+ .setRetrySettings(listJobTemplatesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listJobTemplates from properties.");
+ }
+ }
+ Retry getJobTemplateRetry = clientProperties.getGetJobTemplateRetry();
+ if (getJobTemplateRetry != null) {
+ RetrySettings getJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getJobTemplateSettings().getRetrySettings(),
+ getJobTemplateRetry);
+ clientSettingsBuilder.getJobTemplateSettings().setRetrySettings(getJobTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getJobTemplate from properties.");
+ }
+ }
+ Retry deleteJobTemplateRetry = clientProperties.getDeleteJobTemplateRetry();
+ if (deleteJobTemplateRetry != null) {
+ RetrySettings deleteJobTemplateRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteJobTemplateSettings().getRetrySettings(),
+ deleteJobTemplateRetry);
+ clientSettingsBuilder
+ .deleteJobTemplateSettings()
+ .setRetrySettings(deleteJobTemplateRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteJobTemplate from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a TranscoderServiceClient bean configured with TranscoderServiceSettings.
+ *
+ * @param transcoderServiceSettings settings to configure an instance of client bean.
+ * @return a {@link TranscoderServiceClient} bean configured with {@link
+ * TranscoderServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public TranscoderServiceClient transcoderServiceClient(
+ TranscoderServiceSettings transcoderServiceSettings) throws IOException {
+ return TranscoderServiceClient.create(transcoderServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-transcoder-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringProperties.java b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringProperties.java
new file mode 100644
index 0000000000..6fdd8cba3a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/TranscoderServiceSpringProperties.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.video.transcoder.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 TranscoderService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.video.transcoder.v1.transcoder-service")
+public class TranscoderServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getJob. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJobRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteJobRetry;
+ /**
+ * Allow override of retry settings at method-level for createJobTemplate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createJobTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for listJobTemplates. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listJobTemplatesRetry;
+ /**
+ * Allow override of retry settings at method-level for getJobTemplate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getJobTemplateRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteJobTemplate. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteJobTemplateRetry;
+
+ @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 getCreateJobRetry() {
+ return this.createJobRetry;
+ }
+
+ public void setCreateJobRetry(Retry createJobRetry) {
+ this.createJobRetry = createJobRetry;
+ }
+
+ public Retry getListJobsRetry() {
+ return this.listJobsRetry;
+ }
+
+ public void setListJobsRetry(Retry listJobsRetry) {
+ this.listJobsRetry = listJobsRetry;
+ }
+
+ public Retry getGetJobRetry() {
+ return this.getJobRetry;
+ }
+
+ public void setGetJobRetry(Retry getJobRetry) {
+ this.getJobRetry = getJobRetry;
+ }
+
+ public Retry getDeleteJobRetry() {
+ return this.deleteJobRetry;
+ }
+
+ public void setDeleteJobRetry(Retry deleteJobRetry) {
+ this.deleteJobRetry = deleteJobRetry;
+ }
+
+ public Retry getCreateJobTemplateRetry() {
+ return this.createJobTemplateRetry;
+ }
+
+ public void setCreateJobTemplateRetry(Retry createJobTemplateRetry) {
+ this.createJobTemplateRetry = createJobTemplateRetry;
+ }
+
+ public Retry getListJobTemplatesRetry() {
+ return this.listJobTemplatesRetry;
+ }
+
+ public void setListJobTemplatesRetry(Retry listJobTemplatesRetry) {
+ this.listJobTemplatesRetry = listJobTemplatesRetry;
+ }
+
+ public Retry getGetJobTemplateRetry() {
+ return this.getJobTemplateRetry;
+ }
+
+ public void setGetJobTemplateRetry(Retry getJobTemplateRetry) {
+ this.getJobTemplateRetry = getJobTemplateRetry;
+ }
+
+ public Retry getDeleteJobTemplateRetry() {
+ return this.deleteJobTemplateRetry;
+ }
+
+ public void setDeleteJobTemplateRetry(Retry deleteJobTemplateRetry) {
+ this.deleteJobTemplateRetry = deleteJobTemplateRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/package-info.java
new file mode 100644
index 0000000000..88c090beea
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/java/com/google/cloud/video/transcoder/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for transcoder. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.video.transcoder.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..efa81c527f
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.video.transcoder.v1.transcoder-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud transcoder/TranscoderService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..79e7c0f312
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-video-transcoder-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.video.transcoder.v1.spring.TranscoderServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/pom.xml
new file mode 100644
index 0000000000..45b19e006e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VmMigrationSpringProperties. 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 VmMigrationSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VmMigrationSettings vmMigrationSettings(
+ @Qualifier("defaultVmMigrationTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VmMigrationSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = VmMigrationSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = VmMigrationSettings.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 =
+ VmMigrationSettings.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 listSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSourcesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listSourcesSettings().setRetrySettings(listSourcesRetrySettings);
+
+ RetrySettings getSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSourceSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getSourceSettings().setRetrySettings(getSourceRetrySettings);
+
+ RetrySettings fetchInventoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchInventorySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.fetchInventorySettings().setRetrySettings(fetchInventoryRetrySettings);
+
+ RetrySettings listUtilizationReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listUtilizationReportsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listUtilizationReportsSettings()
+ .setRetrySettings(listUtilizationReportsRetrySettings);
+
+ RetrySettings getUtilizationReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getUtilizationReportSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getUtilizationReportSettings()
+ .setRetrySettings(getUtilizationReportRetrySettings);
+
+ RetrySettings listDatacenterConnectorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDatacenterConnectorsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listDatacenterConnectorsSettings()
+ .setRetrySettings(listDatacenterConnectorsRetrySettings);
+
+ RetrySettings getDatacenterConnectorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDatacenterConnectorSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getDatacenterConnectorSettings()
+ .setRetrySettings(getDatacenterConnectorRetrySettings);
+
+ RetrySettings listMigratingVmsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMigratingVmsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listMigratingVmsSettings()
+ .setRetrySettings(listMigratingVmsRetrySettings);
+
+ RetrySettings getMigratingVmRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMigratingVmSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getMigratingVmSettings().setRetrySettings(getMigratingVmRetrySettings);
+
+ RetrySettings listCloneJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCloneJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listCloneJobsSettings().setRetrySettings(listCloneJobsRetrySettings);
+
+ RetrySettings getCloneJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCloneJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCloneJobSettings().setRetrySettings(getCloneJobRetrySettings);
+
+ RetrySettings listCutoverJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCutoverJobsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listCutoverJobsSettings()
+ .setRetrySettings(listCutoverJobsRetrySettings);
+
+ RetrySettings getCutoverJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCutoverJobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getCutoverJobSettings().setRetrySettings(getCutoverJobRetrySettings);
+
+ RetrySettings listGroupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGroupsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listGroupsSettings().setRetrySettings(listGroupsRetrySettings);
+
+ RetrySettings getGroupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGroupSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getGroupSettings().setRetrySettings(getGroupRetrySettings);
+
+ RetrySettings listTargetProjectsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTargetProjectsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listTargetProjectsSettings()
+ .setRetrySettings(listTargetProjectsRetrySettings);
+
+ RetrySettings getTargetProjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTargetProjectSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getTargetProjectSettings()
+ .setRetrySettings(getTargetProjectRetrySettings);
+
+ RetrySettings listReplicationCyclesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReplicationCyclesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listReplicationCyclesSettings()
+ .setRetrySettings(listReplicationCyclesRetrySettings);
+
+ RetrySettings getReplicationCycleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReplicationCycleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getReplicationCycleSettings()
+ .setRetrySettings(getReplicationCycleRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listSourcesRetry = clientProperties.getListSourcesRetry();
+ if (listSourcesRetry != null) {
+ RetrySettings listSourcesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listSourcesSettings().getRetrySettings(), listSourcesRetry);
+ clientSettingsBuilder.listSourcesSettings().setRetrySettings(listSourcesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listSources from properties.");
+ }
+ }
+ Retry getSourceRetry = clientProperties.getGetSourceRetry();
+ if (getSourceRetry != null) {
+ RetrySettings getSourceRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getSourceSettings().getRetrySettings(), getSourceRetry);
+ clientSettingsBuilder.getSourceSettings().setRetrySettings(getSourceRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getSource from properties.");
+ }
+ }
+ Retry fetchInventoryRetry = clientProperties.getFetchInventoryRetry();
+ if (fetchInventoryRetry != null) {
+ RetrySettings fetchInventoryRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.fetchInventorySettings().getRetrySettings(),
+ fetchInventoryRetry);
+ clientSettingsBuilder.fetchInventorySettings().setRetrySettings(fetchInventoryRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for fetchInventory from properties.");
+ }
+ }
+ Retry listUtilizationReportsRetry = clientProperties.getListUtilizationReportsRetry();
+ if (listUtilizationReportsRetry != null) {
+ RetrySettings listUtilizationReportsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listUtilizationReportsSettings().getRetrySettings(),
+ listUtilizationReportsRetry);
+ clientSettingsBuilder
+ .listUtilizationReportsSettings()
+ .setRetrySettings(listUtilizationReportsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listUtilizationReports from properties.");
+ }
+ }
+ Retry getUtilizationReportRetry = clientProperties.getGetUtilizationReportRetry();
+ if (getUtilizationReportRetry != null) {
+ RetrySettings getUtilizationReportRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getUtilizationReportSettings().getRetrySettings(),
+ getUtilizationReportRetry);
+ clientSettingsBuilder
+ .getUtilizationReportSettings()
+ .setRetrySettings(getUtilizationReportRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getUtilizationReport from properties.");
+ }
+ }
+ Retry listDatacenterConnectorsRetry = clientProperties.getListDatacenterConnectorsRetry();
+ if (listDatacenterConnectorsRetry != null) {
+ RetrySettings listDatacenterConnectorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listDatacenterConnectorsSettings().getRetrySettings(),
+ listDatacenterConnectorsRetry);
+ clientSettingsBuilder
+ .listDatacenterConnectorsSettings()
+ .setRetrySettings(listDatacenterConnectorsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listDatacenterConnectors from properties.");
+ }
+ }
+ Retry getDatacenterConnectorRetry = clientProperties.getGetDatacenterConnectorRetry();
+ if (getDatacenterConnectorRetry != null) {
+ RetrySettings getDatacenterConnectorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getDatacenterConnectorSettings().getRetrySettings(),
+ getDatacenterConnectorRetry);
+ clientSettingsBuilder
+ .getDatacenterConnectorSettings()
+ .setRetrySettings(getDatacenterConnectorRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getDatacenterConnector from properties.");
+ }
+ }
+ Retry listMigratingVmsRetry = clientProperties.getListMigratingVmsRetry();
+ if (listMigratingVmsRetry != null) {
+ RetrySettings listMigratingVmsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listMigratingVmsSettings().getRetrySettings(),
+ listMigratingVmsRetry);
+ clientSettingsBuilder
+ .listMigratingVmsSettings()
+ .setRetrySettings(listMigratingVmsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listMigratingVms from properties.");
+ }
+ }
+ Retry getMigratingVmRetry = clientProperties.getGetMigratingVmRetry();
+ if (getMigratingVmRetry != null) {
+ RetrySettings getMigratingVmRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getMigratingVmSettings().getRetrySettings(),
+ getMigratingVmRetry);
+ clientSettingsBuilder.getMigratingVmSettings().setRetrySettings(getMigratingVmRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getMigratingVm from properties.");
+ }
+ }
+ Retry listCloneJobsRetry = clientProperties.getListCloneJobsRetry();
+ if (listCloneJobsRetry != null) {
+ RetrySettings listCloneJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCloneJobsSettings().getRetrySettings(), listCloneJobsRetry);
+ clientSettingsBuilder.listCloneJobsSettings().setRetrySettings(listCloneJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listCloneJobs from properties.");
+ }
+ }
+ Retry getCloneJobRetry = clientProperties.getGetCloneJobRetry();
+ if (getCloneJobRetry != null) {
+ RetrySettings getCloneJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCloneJobSettings().getRetrySettings(), getCloneJobRetry);
+ clientSettingsBuilder.getCloneJobSettings().setRetrySettings(getCloneJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCloneJob from properties.");
+ }
+ }
+ Retry listCutoverJobsRetry = clientProperties.getListCutoverJobsRetry();
+ if (listCutoverJobsRetry != null) {
+ RetrySettings listCutoverJobsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCutoverJobsSettings().getRetrySettings(),
+ listCutoverJobsRetry);
+ clientSettingsBuilder
+ .listCutoverJobsSettings()
+ .setRetrySettings(listCutoverJobsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listCutoverJobs from properties.");
+ }
+ }
+ Retry getCutoverJobRetry = clientProperties.getGetCutoverJobRetry();
+ if (getCutoverJobRetry != null) {
+ RetrySettings getCutoverJobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getCutoverJobSettings().getRetrySettings(), getCutoverJobRetry);
+ clientSettingsBuilder.getCutoverJobSettings().setRetrySettings(getCutoverJobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getCutoverJob from properties.");
+ }
+ }
+ Retry listGroupsRetry = clientProperties.getListGroupsRetry();
+ if (listGroupsRetry != null) {
+ RetrySettings listGroupsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGroupsSettings().getRetrySettings(), listGroupsRetry);
+ clientSettingsBuilder.listGroupsSettings().setRetrySettings(listGroupsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listGroups from properties.");
+ }
+ }
+ Retry getGroupRetry = clientProperties.getGetGroupRetry();
+ if (getGroupRetry != null) {
+ RetrySettings getGroupRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGroupSettings().getRetrySettings(), getGroupRetry);
+ clientSettingsBuilder.getGroupSettings().setRetrySettings(getGroupRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getGroup from properties.");
+ }
+ }
+ Retry listTargetProjectsRetry = clientProperties.getListTargetProjectsRetry();
+ if (listTargetProjectsRetry != null) {
+ RetrySettings listTargetProjectsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listTargetProjectsSettings().getRetrySettings(),
+ listTargetProjectsRetry);
+ clientSettingsBuilder
+ .listTargetProjectsSettings()
+ .setRetrySettings(listTargetProjectsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listTargetProjects from properties.");
+ }
+ }
+ Retry getTargetProjectRetry = clientProperties.getGetTargetProjectRetry();
+ if (getTargetProjectRetry != null) {
+ RetrySettings getTargetProjectRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getTargetProjectSettings().getRetrySettings(),
+ getTargetProjectRetry);
+ clientSettingsBuilder
+ .getTargetProjectSettings()
+ .setRetrySettings(getTargetProjectRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getTargetProject from properties.");
+ }
+ }
+ Retry listReplicationCyclesRetry = clientProperties.getListReplicationCyclesRetry();
+ if (listReplicationCyclesRetry != null) {
+ RetrySettings listReplicationCyclesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listReplicationCyclesSettings().getRetrySettings(),
+ listReplicationCyclesRetry);
+ clientSettingsBuilder
+ .listReplicationCyclesSettings()
+ .setRetrySettings(listReplicationCyclesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listReplicationCycles from properties.");
+ }
+ }
+ Retry getReplicationCycleRetry = clientProperties.getGetReplicationCycleRetry();
+ if (getReplicationCycleRetry != null) {
+ RetrySettings getReplicationCycleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getReplicationCycleSettings().getRetrySettings(),
+ getReplicationCycleRetry);
+ clientSettingsBuilder
+ .getReplicationCycleSettings()
+ .setRetrySettings(getReplicationCycleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getReplicationCycle from properties.");
+ }
+ }
+ Retry listLocationsRetry = clientProperties.getListLocationsRetry();
+ if (listLocationsRetry != null) {
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), listLocationsRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listLocations from properties.");
+ }
+ }
+ Retry getLocationRetry = clientProperties.getGetLocationRetry();
+ if (getLocationRetry != null) {
+ RetrySettings getLocationRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getLocationSettings().getRetrySettings(), getLocationRetry);
+ clientSettingsBuilder.getLocationSettings().setRetrySettings(getLocationRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getLocation from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a VmMigrationClient bean configured with VmMigrationSettings.
+ *
+ * @param vmMigrationSettings settings to configure an instance of client bean.
+ * @return a {@link VmMigrationClient} bean configured with {@link VmMigrationSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VmMigrationClient vmMigrationClient(VmMigrationSettings vmMigrationSettings)
+ throws IOException {
+ return VmMigrationClient.create(vmMigrationSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-vm-migration";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringProperties.java b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringProperties.java
new file mode 100644
index 0000000000..e21bebeafa
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/VmMigrationSpringProperties.java
@@ -0,0 +1,355 @@
+/*
+ * Copyright 2022 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.vmmigration.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 VmMigration client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.vmmigration.v1.vm-migration")
+public class VmMigrationSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listSources. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listSourcesRetry;
+ /**
+ * Allow override of retry settings at method-level for getSource. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getSourceRetry;
+ /**
+ * Allow override of retry settings at method-level for fetchInventory. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry fetchInventoryRetry;
+ /**
+ * Allow override of retry settings at method-level for listUtilizationReports. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listUtilizationReportsRetry;
+ /**
+ * Allow override of retry settings at method-level for getUtilizationReport. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getUtilizationReportRetry;
+ /**
+ * Allow override of retry settings at method-level for listDatacenterConnectors. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listDatacenterConnectorsRetry;
+ /**
+ * Allow override of retry settings at method-level for getDatacenterConnector. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getDatacenterConnectorRetry;
+ /**
+ * Allow override of retry settings at method-level for listMigratingVms. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listMigratingVmsRetry;
+ /**
+ * Allow override of retry settings at method-level for getMigratingVm. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getMigratingVmRetry;
+ /**
+ * Allow override of retry settings at method-level for listCloneJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCloneJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getCloneJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCloneJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listCutoverJobs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCutoverJobsRetry;
+ /**
+ * Allow override of retry settings at method-level for getCutoverJob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getCutoverJobRetry;
+ /**
+ * Allow override of retry settings at method-level for listGroups. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listGroupsRetry;
+ /**
+ * Allow override of retry settings at method-level for getGroup. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGroupRetry;
+ /**
+ * Allow override of retry settings at method-level for listTargetProjects. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listTargetProjectsRetry;
+ /**
+ * Allow override of retry settings at method-level for getTargetProject. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getTargetProjectRetry;
+ /**
+ * Allow override of retry settings at method-level for listReplicationCycles. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listReplicationCyclesRetry;
+ /**
+ * Allow override of retry settings at method-level for getReplicationCycle. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getReplicationCycleRetry;
+ /**
+ * Allow override of retry settings at method-level for listLocations. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listLocationsRetry;
+ /**
+ * Allow override of retry settings at method-level for getLocation. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getLocationRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListSourcesRetry() {
+ return this.listSourcesRetry;
+ }
+
+ public void setListSourcesRetry(Retry listSourcesRetry) {
+ this.listSourcesRetry = listSourcesRetry;
+ }
+
+ public Retry getGetSourceRetry() {
+ return this.getSourceRetry;
+ }
+
+ public void setGetSourceRetry(Retry getSourceRetry) {
+ this.getSourceRetry = getSourceRetry;
+ }
+
+ public Retry getFetchInventoryRetry() {
+ return this.fetchInventoryRetry;
+ }
+
+ public void setFetchInventoryRetry(Retry fetchInventoryRetry) {
+ this.fetchInventoryRetry = fetchInventoryRetry;
+ }
+
+ public Retry getListUtilizationReportsRetry() {
+ return this.listUtilizationReportsRetry;
+ }
+
+ public void setListUtilizationReportsRetry(Retry listUtilizationReportsRetry) {
+ this.listUtilizationReportsRetry = listUtilizationReportsRetry;
+ }
+
+ public Retry getGetUtilizationReportRetry() {
+ return this.getUtilizationReportRetry;
+ }
+
+ public void setGetUtilizationReportRetry(Retry getUtilizationReportRetry) {
+ this.getUtilizationReportRetry = getUtilizationReportRetry;
+ }
+
+ public Retry getListDatacenterConnectorsRetry() {
+ return this.listDatacenterConnectorsRetry;
+ }
+
+ public void setListDatacenterConnectorsRetry(Retry listDatacenterConnectorsRetry) {
+ this.listDatacenterConnectorsRetry = listDatacenterConnectorsRetry;
+ }
+
+ public Retry getGetDatacenterConnectorRetry() {
+ return this.getDatacenterConnectorRetry;
+ }
+
+ public void setGetDatacenterConnectorRetry(Retry getDatacenterConnectorRetry) {
+ this.getDatacenterConnectorRetry = getDatacenterConnectorRetry;
+ }
+
+ public Retry getListMigratingVmsRetry() {
+ return this.listMigratingVmsRetry;
+ }
+
+ public void setListMigratingVmsRetry(Retry listMigratingVmsRetry) {
+ this.listMigratingVmsRetry = listMigratingVmsRetry;
+ }
+
+ public Retry getGetMigratingVmRetry() {
+ return this.getMigratingVmRetry;
+ }
+
+ public void setGetMigratingVmRetry(Retry getMigratingVmRetry) {
+ this.getMigratingVmRetry = getMigratingVmRetry;
+ }
+
+ public Retry getListCloneJobsRetry() {
+ return this.listCloneJobsRetry;
+ }
+
+ public void setListCloneJobsRetry(Retry listCloneJobsRetry) {
+ this.listCloneJobsRetry = listCloneJobsRetry;
+ }
+
+ public Retry getGetCloneJobRetry() {
+ return this.getCloneJobRetry;
+ }
+
+ public void setGetCloneJobRetry(Retry getCloneJobRetry) {
+ this.getCloneJobRetry = getCloneJobRetry;
+ }
+
+ public Retry getListCutoverJobsRetry() {
+ return this.listCutoverJobsRetry;
+ }
+
+ public void setListCutoverJobsRetry(Retry listCutoverJobsRetry) {
+ this.listCutoverJobsRetry = listCutoverJobsRetry;
+ }
+
+ public Retry getGetCutoverJobRetry() {
+ return this.getCutoverJobRetry;
+ }
+
+ public void setGetCutoverJobRetry(Retry getCutoverJobRetry) {
+ this.getCutoverJobRetry = getCutoverJobRetry;
+ }
+
+ public Retry getListGroupsRetry() {
+ return this.listGroupsRetry;
+ }
+
+ public void setListGroupsRetry(Retry listGroupsRetry) {
+ this.listGroupsRetry = listGroupsRetry;
+ }
+
+ public Retry getGetGroupRetry() {
+ return this.getGroupRetry;
+ }
+
+ public void setGetGroupRetry(Retry getGroupRetry) {
+ this.getGroupRetry = getGroupRetry;
+ }
+
+ public Retry getListTargetProjectsRetry() {
+ return this.listTargetProjectsRetry;
+ }
+
+ public void setListTargetProjectsRetry(Retry listTargetProjectsRetry) {
+ this.listTargetProjectsRetry = listTargetProjectsRetry;
+ }
+
+ public Retry getGetTargetProjectRetry() {
+ return this.getTargetProjectRetry;
+ }
+
+ public void setGetTargetProjectRetry(Retry getTargetProjectRetry) {
+ this.getTargetProjectRetry = getTargetProjectRetry;
+ }
+
+ public Retry getListReplicationCyclesRetry() {
+ return this.listReplicationCyclesRetry;
+ }
+
+ public void setListReplicationCyclesRetry(Retry listReplicationCyclesRetry) {
+ this.listReplicationCyclesRetry = listReplicationCyclesRetry;
+ }
+
+ public Retry getGetReplicationCycleRetry() {
+ return this.getReplicationCycleRetry;
+ }
+
+ public void setGetReplicationCycleRetry(Retry getReplicationCycleRetry) {
+ this.getReplicationCycleRetry = getReplicationCycleRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+
+ public Retry getGetLocationRetry() {
+ return this.getLocationRetry;
+ }
+
+ public void setGetLocationRetry(Retry getLocationRetry) {
+ this.getLocationRetry = getLocationRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/package-info.java
new file mode 100644
index 0000000000..5644969cf6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/java/com/google/cloud/vmmigration/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for vmmigration. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.vmmigration.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..4a0384e286
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.vmmigration.v1.vm-migration.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud vmmigration/VmMigration components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..867135ac1a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vmmigration-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.vmmigration.v1.spring.VmMigrationSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/pom.xml
new file mode 100644
index 0000000000..0fe1296bd3
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in VpcAccessServiceSpringProperties. 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 VpcAccessServiceSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VpcAccessServiceSettings vpcAccessServiceSettings(
+ @Qualifier("defaultVpcAccessServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ VpcAccessServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = VpcAccessServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = VpcAccessServiceSettings.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 =
+ VpcAccessServiceSettings.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 getConnectorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectorSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getConnectorSettings().setRetrySettings(getConnectorRetrySettings);
+
+ RetrySettings listConnectorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectorsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listConnectorsSettings().setRetrySettings(listConnectorsRetrySettings);
+
+ RetrySettings listLocationsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listLocationsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listLocationsSettings().setRetrySettings(listLocationsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry getConnectorRetry = clientProperties.getGetConnectorRetry();
+ if (getConnectorRetry != null) {
+ RetrySettings getConnectorRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getConnectorSettings().getRetrySettings(), getConnectorRetry);
+ clientSettingsBuilder.getConnectorSettings().setRetrySettings(getConnectorRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getConnector from properties.");
+ }
+ }
+ Retry listConnectorsRetry = clientProperties.getListConnectorsRetry();
+ if (listConnectorsRetry != null) {
+ RetrySettings listConnectorsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listConnectorsSettings().getRetrySettings(),
+ listConnectorsRetry);
+ clientSettingsBuilder.listConnectorsSettings().setRetrySettings(listConnectorsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listConnectors 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.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a VpcAccessServiceClient bean configured with VpcAccessServiceSettings.
+ *
+ * @param vpcAccessServiceSettings settings to configure an instance of client bean.
+ * @return a {@link VpcAccessServiceClient} bean configured with {@link VpcAccessServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public VpcAccessServiceClient vpcAccessServiceClient(
+ VpcAccessServiceSettings vpcAccessServiceSettings) throws IOException {
+ return VpcAccessServiceClient.create(vpcAccessServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-vpc-access-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringProperties.java b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringProperties.java
new file mode 100644
index 0000000000..6b3a9dee28
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/VpcAccessServiceSpringProperties.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2022 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.vpcaccess.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 VpcAccessService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.vpcaccess.v1.vpc-access-service")
+public class VpcAccessServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for getConnector. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getConnectorRetry;
+ /**
+ * Allow override of retry settings at method-level for listConnectors. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listConnectorsRetry;
+ /**
+ * 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;
+
+ @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 getGetConnectorRetry() {
+ return this.getConnectorRetry;
+ }
+
+ public void setGetConnectorRetry(Retry getConnectorRetry) {
+ this.getConnectorRetry = getConnectorRetry;
+ }
+
+ public Retry getListConnectorsRetry() {
+ return this.listConnectorsRetry;
+ }
+
+ public void setListConnectorsRetry(Retry listConnectorsRetry) {
+ this.listConnectorsRetry = listConnectorsRetry;
+ }
+
+ public Retry getListLocationsRetry() {
+ return this.listLocationsRetry;
+ }
+
+ public void setListLocationsRetry(Retry listLocationsRetry) {
+ this.listLocationsRetry = listLocationsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/package-info.java
new file mode 100644
index 0000000000..951175d531
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/java/com/google/cloud/vpcaccess/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for vpcaccess. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.vpcaccess.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..4d20804042
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.vpcaccess.v1.vpc-access-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud vpcaccess/VpcAccessService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..bb4d51efce
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-vpcaccess-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.vpcaccess.v1.spring.VpcAccessServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-webrisk-spring-starter/pom.xml
new file mode 100644
index 0000000000..8be9b8c08e
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in WebRiskServiceSpringProperties. 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 WebRiskServiceSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WebRiskServiceSettings webRiskServiceSettings(
+ @Qualifier("defaultWebRiskServiceTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ WebRiskServiceSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = WebRiskServiceSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = WebRiskServiceSettings.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 =
+ WebRiskServiceSettings.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 computeThreatListDiffRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.computeThreatListDiffSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(computeThreatListDiffRetrySettings);
+
+ RetrySettings searchUrisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchUrisSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.searchUrisSettings().setRetrySettings(searchUrisRetrySettings);
+
+ RetrySettings searchHashesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchHashesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.searchHashesSettings().setRetrySettings(searchHashesRetrySettings);
+
+ RetrySettings createSubmissionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSubmissionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createSubmissionSettings()
+ .setRetrySettings(createSubmissionRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry computeThreatListDiffRetry = clientProperties.getComputeThreatListDiffRetry();
+ if (computeThreatListDiffRetry != null) {
+ RetrySettings computeThreatListDiffRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.computeThreatListDiffSettings().getRetrySettings(),
+ computeThreatListDiffRetry);
+ clientSettingsBuilder
+ .computeThreatListDiffSettings()
+ .setRetrySettings(computeThreatListDiffRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for computeThreatListDiff from properties.");
+ }
+ }
+ Retry searchUrisRetry = clientProperties.getSearchUrisRetry();
+ if (searchUrisRetry != null) {
+ RetrySettings searchUrisRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchUrisSettings().getRetrySettings(), searchUrisRetry);
+ clientSettingsBuilder.searchUrisSettings().setRetrySettings(searchUrisRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for searchUris from properties.");
+ }
+ }
+ Retry searchHashesRetry = clientProperties.getSearchHashesRetry();
+ if (searchHashesRetry != null) {
+ RetrySettings searchHashesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.searchHashesSettings().getRetrySettings(), searchHashesRetry);
+ clientSettingsBuilder.searchHashesSettings().setRetrySettings(searchHashesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for searchHashes from properties.");
+ }
+ }
+ Retry createSubmissionRetry = clientProperties.getCreateSubmissionRetry();
+ if (createSubmissionRetry != null) {
+ RetrySettings createSubmissionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createSubmissionSettings().getRetrySettings(),
+ createSubmissionRetry);
+ clientSettingsBuilder
+ .createSubmissionSettings()
+ .setRetrySettings(createSubmissionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createSubmission from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a WebRiskServiceClient bean configured with WebRiskServiceSettings.
+ *
+ * @param webRiskServiceSettings settings to configure an instance of client bean.
+ * @return a {@link WebRiskServiceClient} bean configured with {@link WebRiskServiceSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WebRiskServiceClient webRiskServiceClient(WebRiskServiceSettings webRiskServiceSettings)
+ throws IOException {
+ return WebRiskServiceClient.create(webRiskServiceSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-web-risk-service";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringProperties.java b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringProperties.java
new file mode 100644
index 0000000000..2f794e6d97
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/WebRiskServiceSpringProperties.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 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.webrisk.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 WebRiskService client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.webrisk.v1.web-risk-service")
+public class WebRiskServiceSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for computeThreatListDiff. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry computeThreatListDiffRetry;
+ /**
+ * Allow override of retry settings at method-level for searchUris. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchUrisRetry;
+ /**
+ * Allow override of retry settings at method-level for searchHashes. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry searchHashesRetry;
+ /**
+ * Allow override of retry settings at method-level for createSubmission. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createSubmissionRetry;
+
+ @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 getComputeThreatListDiffRetry() {
+ return this.computeThreatListDiffRetry;
+ }
+
+ public void setComputeThreatListDiffRetry(Retry computeThreatListDiffRetry) {
+ this.computeThreatListDiffRetry = computeThreatListDiffRetry;
+ }
+
+ public Retry getSearchUrisRetry() {
+ return this.searchUrisRetry;
+ }
+
+ public void setSearchUrisRetry(Retry searchUrisRetry) {
+ this.searchUrisRetry = searchUrisRetry;
+ }
+
+ public Retry getSearchHashesRetry() {
+ return this.searchHashesRetry;
+ }
+
+ public void setSearchHashesRetry(Retry searchHashesRetry) {
+ this.searchHashesRetry = searchHashesRetry;
+ }
+
+ public Retry getCreateSubmissionRetry() {
+ return this.createSubmissionRetry;
+ }
+
+ public void setCreateSubmissionRetry(Retry createSubmissionRetry) {
+ this.createSubmissionRetry = createSubmissionRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/package-info.java
new file mode 100644
index 0000000000..81edc06544
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/java/com/google/cloud/webrisk/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for webrisk. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.webrisk.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..13711ed817
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.webrisk.v1.web-risk-service.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud webrisk/WebRiskService components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..ecf36f19b9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-webrisk-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.webrisk.v1.spring.WebRiskServiceSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/pom.xml
new file mode 100644
index 0000000000..0a79054581
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in WebSecurityScannerSpringProperties. 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 WebSecurityScannerSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WebSecurityScannerSettings webSecurityScannerSettings(
+ @Qualifier("defaultWebSecurityScannerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ WebSecurityScannerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = WebSecurityScannerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = WebSecurityScannerSettings.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 =
+ WebSecurityScannerSettings.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 createScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createScanConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createScanConfigSettings()
+ .setRetrySettings(createScanConfigRetrySettings);
+
+ RetrySettings deleteScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteScanConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .deleteScanConfigSettings()
+ .setRetrySettings(deleteScanConfigRetrySettings);
+
+ RetrySettings getScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScanConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getScanConfigSettings().setRetrySettings(getScanConfigRetrySettings);
+
+ RetrySettings listScanConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listScanConfigsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listScanConfigsSettings()
+ .setRetrySettings(listScanConfigsRetrySettings);
+
+ RetrySettings updateScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateScanConfigSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .updateScanConfigSettings()
+ .setRetrySettings(updateScanConfigRetrySettings);
+
+ RetrySettings startScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startScanRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.startScanRunSettings().setRetrySettings(startScanRunRetrySettings);
+
+ RetrySettings getScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScanRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getScanRunSettings().setRetrySettings(getScanRunRetrySettings);
+
+ RetrySettings listScanRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listScanRunsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listScanRunsSettings().setRetrySettings(listScanRunsRetrySettings);
+
+ RetrySettings stopScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopScanRunSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.stopScanRunSettings().setRetrySettings(stopScanRunRetrySettings);
+
+ RetrySettings listCrawledUrlsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCrawledUrlsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listCrawledUrlsSettings()
+ .setRetrySettings(listCrawledUrlsRetrySettings);
+
+ RetrySettings getFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFindingSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getFindingSettings().setRetrySettings(getFindingRetrySettings);
+
+ RetrySettings listFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listFindingsSettings().setRetrySettings(listFindingsRetrySettings);
+
+ RetrySettings listFindingTypeStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingTypeStatsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listFindingTypeStatsSettings()
+ .setRetrySettings(listFindingTypeStatsRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry createScanConfigRetry = clientProperties.getCreateScanConfigRetry();
+ if (createScanConfigRetry != null) {
+ RetrySettings createScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createScanConfigSettings().getRetrySettings(),
+ createScanConfigRetry);
+ clientSettingsBuilder
+ .createScanConfigSettings()
+ .setRetrySettings(createScanConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createScanConfig from properties.");
+ }
+ }
+ Retry deleteScanConfigRetry = clientProperties.getDeleteScanConfigRetry();
+ if (deleteScanConfigRetry != null) {
+ RetrySettings deleteScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteScanConfigSettings().getRetrySettings(),
+ deleteScanConfigRetry);
+ clientSettingsBuilder
+ .deleteScanConfigSettings()
+ .setRetrySettings(deleteScanConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteScanConfig from properties.");
+ }
+ }
+ Retry getScanConfigRetry = clientProperties.getGetScanConfigRetry();
+ if (getScanConfigRetry != null) {
+ RetrySettings getScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScanConfigSettings().getRetrySettings(), getScanConfigRetry);
+ clientSettingsBuilder.getScanConfigSettings().setRetrySettings(getScanConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getScanConfig from properties.");
+ }
+ }
+ Retry listScanConfigsRetry = clientProperties.getListScanConfigsRetry();
+ if (listScanConfigsRetry != null) {
+ RetrySettings listScanConfigsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listScanConfigsSettings().getRetrySettings(),
+ listScanConfigsRetry);
+ clientSettingsBuilder
+ .listScanConfigsSettings()
+ .setRetrySettings(listScanConfigsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listScanConfigs from properties.");
+ }
+ }
+ Retry updateScanConfigRetry = clientProperties.getUpdateScanConfigRetry();
+ if (updateScanConfigRetry != null) {
+ RetrySettings updateScanConfigRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateScanConfigSettings().getRetrySettings(),
+ updateScanConfigRetry);
+ clientSettingsBuilder
+ .updateScanConfigSettings()
+ .setRetrySettings(updateScanConfigRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateScanConfig from properties.");
+ }
+ }
+ Retry startScanRunRetry = clientProperties.getStartScanRunRetry();
+ if (startScanRunRetry != null) {
+ RetrySettings startScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.startScanRunSettings().getRetrySettings(), startScanRunRetry);
+ clientSettingsBuilder.startScanRunSettings().setRetrySettings(startScanRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for startScanRun from properties.");
+ }
+ }
+ Retry getScanRunRetry = clientProperties.getGetScanRunRetry();
+ if (getScanRunRetry != null) {
+ RetrySettings getScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getScanRunSettings().getRetrySettings(), getScanRunRetry);
+ clientSettingsBuilder.getScanRunSettings().setRetrySettings(getScanRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getScanRun from properties.");
+ }
+ }
+ Retry listScanRunsRetry = clientProperties.getListScanRunsRetry();
+ if (listScanRunsRetry != null) {
+ RetrySettings listScanRunsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listScanRunsSettings().getRetrySettings(), listScanRunsRetry);
+ clientSettingsBuilder.listScanRunsSettings().setRetrySettings(listScanRunsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listScanRuns from properties.");
+ }
+ }
+ Retry stopScanRunRetry = clientProperties.getStopScanRunRetry();
+ if (stopScanRunRetry != null) {
+ RetrySettings stopScanRunRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.stopScanRunSettings().getRetrySettings(), stopScanRunRetry);
+ clientSettingsBuilder.stopScanRunSettings().setRetrySettings(stopScanRunRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for stopScanRun from properties.");
+ }
+ }
+ Retry listCrawledUrlsRetry = clientProperties.getListCrawledUrlsRetry();
+ if (listCrawledUrlsRetry != null) {
+ RetrySettings listCrawledUrlsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listCrawledUrlsSettings().getRetrySettings(),
+ listCrawledUrlsRetry);
+ clientSettingsBuilder
+ .listCrawledUrlsSettings()
+ .setRetrySettings(listCrawledUrlsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listCrawledUrls from properties.");
+ }
+ }
+ Retry getFindingRetry = clientProperties.getGetFindingRetry();
+ if (getFindingRetry != null) {
+ RetrySettings getFindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getFindingSettings().getRetrySettings(), getFindingRetry);
+ clientSettingsBuilder.getFindingSettings().setRetrySettings(getFindingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getFinding from properties.");
+ }
+ }
+ Retry listFindingsRetry = clientProperties.getListFindingsRetry();
+ if (listFindingsRetry != null) {
+ RetrySettings listFindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingsSettings().getRetrySettings(), listFindingsRetry);
+ clientSettingsBuilder.listFindingsSettings().setRetrySettings(listFindingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listFindings from properties.");
+ }
+ }
+ Retry listFindingTypeStatsRetry = clientProperties.getListFindingTypeStatsRetry();
+ if (listFindingTypeStatsRetry != null) {
+ RetrySettings listFindingTypeStatsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listFindingTypeStatsSettings().getRetrySettings(),
+ listFindingTypeStatsRetry);
+ clientSettingsBuilder
+ .listFindingTypeStatsSettings()
+ .setRetrySettings(listFindingTypeStatsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listFindingTypeStats from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a WebSecurityScannerClient bean configured with WebSecurityScannerSettings.
+ *
+ * @param webSecurityScannerSettings settings to configure an instance of client bean.
+ * @return a {@link WebSecurityScannerClient} bean configured with {@link
+ * WebSecurityScannerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WebSecurityScannerClient webSecurityScannerClient(
+ WebSecurityScannerSettings webSecurityScannerSettings) throws IOException {
+ return WebSecurityScannerClient.create(webSecurityScannerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-web-security-scanner";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringProperties.java b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringProperties.java
new file mode 100644
index 0000000000..ca4686a7a9
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/WebSecurityScannerSpringProperties.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2022 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.websecurityscanner.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 WebSecurityScanner client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.websecurityscanner.v1.web-security-scanner")
+public class WebSecurityScannerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for createScanConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createScanConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteScanConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteScanConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for getScanConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getScanConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for listScanConfigs. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listScanConfigsRetry;
+ /**
+ * Allow override of retry settings at method-level for updateScanConfig. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateScanConfigRetry;
+ /**
+ * Allow override of retry settings at method-level for startScanRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry startScanRunRetry;
+ /**
+ * Allow override of retry settings at method-level for getScanRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getScanRunRetry;
+ /**
+ * Allow override of retry settings at method-level for listScanRuns. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listScanRunsRetry;
+ /**
+ * Allow override of retry settings at method-level for stopScanRun. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry stopScanRunRetry;
+ /**
+ * Allow override of retry settings at method-level for listCrawledUrls. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listCrawledUrlsRetry;
+ /**
+ * Allow override of retry settings at method-level for getFinding. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getFindingRetry;
+ /**
+ * Allow override of retry settings at method-level for listFindings. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFindingsRetry;
+ /**
+ * Allow override of retry settings at method-level for listFindingTypeStats. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listFindingTypeStatsRetry;
+
+ @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 getCreateScanConfigRetry() {
+ return this.createScanConfigRetry;
+ }
+
+ public void setCreateScanConfigRetry(Retry createScanConfigRetry) {
+ this.createScanConfigRetry = createScanConfigRetry;
+ }
+
+ public Retry getDeleteScanConfigRetry() {
+ return this.deleteScanConfigRetry;
+ }
+
+ public void setDeleteScanConfigRetry(Retry deleteScanConfigRetry) {
+ this.deleteScanConfigRetry = deleteScanConfigRetry;
+ }
+
+ public Retry getGetScanConfigRetry() {
+ return this.getScanConfigRetry;
+ }
+
+ public void setGetScanConfigRetry(Retry getScanConfigRetry) {
+ this.getScanConfigRetry = getScanConfigRetry;
+ }
+
+ public Retry getListScanConfigsRetry() {
+ return this.listScanConfigsRetry;
+ }
+
+ public void setListScanConfigsRetry(Retry listScanConfigsRetry) {
+ this.listScanConfigsRetry = listScanConfigsRetry;
+ }
+
+ public Retry getUpdateScanConfigRetry() {
+ return this.updateScanConfigRetry;
+ }
+
+ public void setUpdateScanConfigRetry(Retry updateScanConfigRetry) {
+ this.updateScanConfigRetry = updateScanConfigRetry;
+ }
+
+ public Retry getStartScanRunRetry() {
+ return this.startScanRunRetry;
+ }
+
+ public void setStartScanRunRetry(Retry startScanRunRetry) {
+ this.startScanRunRetry = startScanRunRetry;
+ }
+
+ public Retry getGetScanRunRetry() {
+ return this.getScanRunRetry;
+ }
+
+ public void setGetScanRunRetry(Retry getScanRunRetry) {
+ this.getScanRunRetry = getScanRunRetry;
+ }
+
+ public Retry getListScanRunsRetry() {
+ return this.listScanRunsRetry;
+ }
+
+ public void setListScanRunsRetry(Retry listScanRunsRetry) {
+ this.listScanRunsRetry = listScanRunsRetry;
+ }
+
+ public Retry getStopScanRunRetry() {
+ return this.stopScanRunRetry;
+ }
+
+ public void setStopScanRunRetry(Retry stopScanRunRetry) {
+ this.stopScanRunRetry = stopScanRunRetry;
+ }
+
+ public Retry getListCrawledUrlsRetry() {
+ return this.listCrawledUrlsRetry;
+ }
+
+ public void setListCrawledUrlsRetry(Retry listCrawledUrlsRetry) {
+ this.listCrawledUrlsRetry = listCrawledUrlsRetry;
+ }
+
+ public Retry getGetFindingRetry() {
+ return this.getFindingRetry;
+ }
+
+ public void setGetFindingRetry(Retry getFindingRetry) {
+ this.getFindingRetry = getFindingRetry;
+ }
+
+ public Retry getListFindingsRetry() {
+ return this.listFindingsRetry;
+ }
+
+ public void setListFindingsRetry(Retry listFindingsRetry) {
+ this.listFindingsRetry = listFindingsRetry;
+ }
+
+ public Retry getListFindingTypeStatsRetry() {
+ return this.listFindingTypeStatsRetry;
+ }
+
+ public void setListFindingTypeStatsRetry(Retry listFindingTypeStatsRetry) {
+ this.listFindingTypeStatsRetry = listFindingTypeStatsRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/package-info.java
new file mode 100644
index 0000000000..deb1c13856
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/java/com/google/cloud/websecurityscanner/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for websecurityscanner. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.websecurityscanner.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..8b6901b340
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.websecurityscanner.v1.web-security-scanner.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud websecurityscanner/WebSecurityScanner components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..52f76abcff
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-websecurityscanner-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.websecurityscanner.v1.spring.WebSecurityScannerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/pom.xml
new file mode 100644
index 0000000000..de056494f4
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in ExecutionsSpringProperties. 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 ExecutionsSettings} bean configured with {@link TransportChannelProvider}
+ * bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ExecutionsSettings executionsSettings(
+ @Qualifier("defaultExecutionsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ ExecutionsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = ExecutionsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = ExecutionsSettings.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 =
+ ExecutionsSettings.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 listExecutionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listExecutionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings);
+
+ RetrySettings createExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createExecutionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .createExecutionSettings()
+ .setRetrySettings(createExecutionRetrySettings);
+
+ RetrySettings getExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getExecutionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings);
+
+ RetrySettings cancelExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelExecutionSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .cancelExecutionSettings()
+ .setRetrySettings(cancelExecutionRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listExecutionsRetry = clientProperties.getListExecutionsRetry();
+ if (listExecutionsRetry != null) {
+ RetrySettings listExecutionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listExecutionsSettings().getRetrySettings(),
+ listExecutionsRetry);
+ clientSettingsBuilder.listExecutionsSettings().setRetrySettings(listExecutionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listExecutions from properties.");
+ }
+ }
+ Retry createExecutionRetry = clientProperties.getCreateExecutionRetry();
+ if (createExecutionRetry != null) {
+ RetrySettings createExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createExecutionSettings().getRetrySettings(),
+ createExecutionRetry);
+ clientSettingsBuilder
+ .createExecutionSettings()
+ .setRetrySettings(createExecutionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createExecution from properties.");
+ }
+ }
+ Retry getExecutionRetry = clientProperties.getGetExecutionRetry();
+ if (getExecutionRetry != null) {
+ RetrySettings getExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getExecutionSettings().getRetrySettings(), getExecutionRetry);
+ clientSettingsBuilder.getExecutionSettings().setRetrySettings(getExecutionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getExecution from properties.");
+ }
+ }
+ Retry cancelExecutionRetry = clientProperties.getCancelExecutionRetry();
+ if (cancelExecutionRetry != null) {
+ RetrySettings cancelExecutionRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.cancelExecutionSettings().getRetrySettings(),
+ cancelExecutionRetry);
+ clientSettingsBuilder
+ .cancelExecutionSettings()
+ .setRetrySettings(cancelExecutionRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for cancelExecution from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a ExecutionsClient bean configured with ExecutionsSettings.
+ *
+ * @param executionsSettings settings to configure an instance of client bean.
+ * @return a {@link ExecutionsClient} bean configured with {@link ExecutionsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ExecutionsClient executionsClient(ExecutionsSettings executionsSettings)
+ throws IOException {
+ return ExecutionsClient.create(executionsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-executions";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringProperties.java b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringProperties.java
new file mode 100644
index 0000000000..901e63a3a1
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/ExecutionsSpringProperties.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 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.workflows.executions.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 Executions client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.workflows.executions.v1.executions")
+public class ExecutionsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listExecutions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listExecutionsRetry;
+ /**
+ * Allow override of retry settings at method-level for createExecution. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createExecutionRetry;
+ /**
+ * Allow override of retry settings at method-level for getExecution. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getExecutionRetry;
+ /**
+ * Allow override of retry settings at method-level for cancelExecution. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry cancelExecutionRetry;
+
+ @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 getListExecutionsRetry() {
+ return this.listExecutionsRetry;
+ }
+
+ public void setListExecutionsRetry(Retry listExecutionsRetry) {
+ this.listExecutionsRetry = listExecutionsRetry;
+ }
+
+ public Retry getCreateExecutionRetry() {
+ return this.createExecutionRetry;
+ }
+
+ public void setCreateExecutionRetry(Retry createExecutionRetry) {
+ this.createExecutionRetry = createExecutionRetry;
+ }
+
+ public Retry getGetExecutionRetry() {
+ return this.getExecutionRetry;
+ }
+
+ public void setGetExecutionRetry(Retry getExecutionRetry) {
+ this.getExecutionRetry = getExecutionRetry;
+ }
+
+ public Retry getCancelExecutionRetry() {
+ return this.cancelExecutionRetry;
+ }
+
+ public void setCancelExecutionRetry(Retry cancelExecutionRetry) {
+ this.cancelExecutionRetry = cancelExecutionRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/package-info.java
new file mode 100644
index 0000000000..95ee96fe34
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/java/com/google/cloud/workflows/executions/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for workflowexecutions. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.workflows.executions.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..5bd70e771a
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.workflows.executions.v1.executions.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud workflowexecutions/Executions components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..74af3d12f6
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflow-executions-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.workflows.executions.v1.spring.ExecutionsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/pom.xml b/spring-cloud-previews/google-cloud-workflows-spring-starter/pom.xml
new file mode 100644
index 0000000000..4d6e86d20c
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in WorkflowsSpringProperties. 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 WorkflowsSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WorkflowsSettings workflowsSettings(
+ @Qualifier("defaultWorkflowsTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ WorkflowsSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = WorkflowsSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = WorkflowsSettings.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 =
+ WorkflowsSettings.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 listWorkflowsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkflowsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listWorkflowsSettings().setRetrySettings(listWorkflowsRetrySettings);
+
+ RetrySettings getWorkflowRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkflowSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getWorkflowSettings().setRetrySettings(getWorkflowRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listWorkflowsRetry = clientProperties.getListWorkflowsRetry();
+ if (listWorkflowsRetry != null) {
+ RetrySettings listWorkflowsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listWorkflowsSettings().getRetrySettings(), listWorkflowsRetry);
+ clientSettingsBuilder.listWorkflowsSettings().setRetrySettings(listWorkflowsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listWorkflows from properties.");
+ }
+ }
+ Retry getWorkflowRetry = clientProperties.getGetWorkflowRetry();
+ if (getWorkflowRetry != null) {
+ RetrySettings getWorkflowRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getWorkflowSettings().getRetrySettings(), getWorkflowRetry);
+ clientSettingsBuilder.getWorkflowSettings().setRetrySettings(getWorkflowRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getWorkflow from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a WorkflowsClient bean configured with WorkflowsSettings.
+ *
+ * @param workflowsSettings settings to configure an instance of client bean.
+ * @return a {@link WorkflowsClient} bean configured with {@link WorkflowsSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public WorkflowsClient workflowsClient(WorkflowsSettings workflowsSettings) throws IOException {
+ return WorkflowsClient.create(workflowsSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-workflows";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringProperties.java b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringProperties.java
new file mode 100644
index 0000000000..0a27e4de13
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/WorkflowsSpringProperties.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2022 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.workflows.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 Workflows client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.workflows.v1.workflows")
+public class WorkflowsSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listWorkflows. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listWorkflowsRetry;
+ /**
+ * Allow override of retry settings at method-level for getWorkflow. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getWorkflowRetry;
+
+ @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 getListWorkflowsRetry() {
+ return this.listWorkflowsRetry;
+ }
+
+ public void setListWorkflowsRetry(Retry listWorkflowsRetry) {
+ this.listWorkflowsRetry = listWorkflowsRetry;
+ }
+
+ public Retry getGetWorkflowRetry() {
+ return this.getWorkflowRetry;
+ }
+
+ public void setGetWorkflowRetry(Retry getWorkflowRetry) {
+ this.getWorkflowRetry = getWorkflowRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/package-info.java b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/package-info.java
new file mode 100644
index 0000000000..a0319d62e7
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/java/com/google/cloud/workflows/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for workflows. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.workflows.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..0376184dd8
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.workflows.v1.workflows.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud workflows/Workflows components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..fcdd9208fe
--- /dev/null
+++ b/spring-cloud-previews/google-cloud-workflows-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.workflows.v1.spring.WorkflowsSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/pom.xml b/spring-cloud-previews/google-iam-admin-spring-starter/pom.xml
new file mode 100644
index 0000000000..1e00ed2df7
--- /dev/null
+++ b/spring-cloud-previews/google-iam-admin-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in IAMSpringProperties. 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 IAMSettings} bean configured with {@link TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IAMSettings iAMSettings(
+ @Qualifier("defaultIAMTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ IAMSettings.Builder clientSettingsBuilder = IAMSettings.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 =
+ IAMSettings.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 listServiceAccountsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceAccountsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listServiceAccountsSettings()
+ .setRetrySettings(listServiceAccountsRetrySettings);
+
+ RetrySettings getServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceAccountSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getServiceAccountSettings()
+ .setRetrySettings(getServiceAccountRetrySettings);
+
+ RetrySettings createServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createServiceAccountSettings()
+ .setRetrySettings(createServiceAccountRetrySettings);
+
+ RetrySettings updateServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .updateServiceAccountSettings()
+ .setRetrySettings(updateServiceAccountRetrySettings);
+
+ RetrySettings patchServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.patchServiceAccountSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .patchServiceAccountSettings()
+ .setRetrySettings(patchServiceAccountRetrySettings);
+
+ RetrySettings deleteServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteServiceAccountSettings()
+ .setRetrySettings(deleteServiceAccountRetrySettings);
+
+ RetrySettings undeleteServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.undeleteServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .undeleteServiceAccountSettings()
+ .setRetrySettings(undeleteServiceAccountRetrySettings);
+
+ RetrySettings enableServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enableServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .enableServiceAccountSettings()
+ .setRetrySettings(enableServiceAccountRetrySettings);
+
+ RetrySettings disableServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.disableServiceAccountSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .disableServiceAccountSettings()
+ .setRetrySettings(disableServiceAccountRetrySettings);
+
+ RetrySettings listServiceAccountKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceAccountKeysSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listServiceAccountKeysSettings()
+ .setRetrySettings(listServiceAccountKeysRetrySettings);
+
+ RetrySettings getServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getServiceAccountKeySettings()
+ .setRetrySettings(getServiceAccountKeyRetrySettings);
+
+ RetrySettings createServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .createServiceAccountKeySettings()
+ .setRetrySettings(createServiceAccountKeyRetrySettings);
+
+ RetrySettings uploadServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.uploadServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .uploadServiceAccountKeySettings()
+ .setRetrySettings(uploadServiceAccountKeyRetrySettings);
+
+ RetrySettings deleteServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .deleteServiceAccountKeySettings()
+ .setRetrySettings(deleteServiceAccountKeyRetrySettings);
+
+ RetrySettings disableServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.disableServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .disableServiceAccountKeySettings()
+ .setRetrySettings(disableServiceAccountKeyRetrySettings);
+
+ RetrySettings enableServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enableServiceAccountKeySettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .enableServiceAccountKeySettings()
+ .setRetrySettings(enableServiceAccountKeyRetrySettings);
+
+ RetrySettings signBlobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signBlobSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.signBlobSettings().setRetrySettings(signBlobRetrySettings);
+
+ RetrySettings signJwtRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signJwtSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.signJwtSettings().setRetrySettings(signJwtRetrySettings);
+
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+
+ RetrySettings queryGrantableRolesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryGrantableRolesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .queryGrantableRolesSettings()
+ .setRetrySettings(queryGrantableRolesRetrySettings);
+
+ RetrySettings listRolesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRolesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.listRolesSettings().setRetrySettings(listRolesRetrySettings);
+
+ RetrySettings getRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRoleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getRoleSettings().setRetrySettings(getRoleRetrySettings);
+
+ RetrySettings createRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createRoleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.createRoleSettings().setRetrySettings(createRoleRetrySettings);
+
+ RetrySettings updateRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRoleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.updateRoleSettings().setRetrySettings(updateRoleRetrySettings);
+
+ RetrySettings deleteRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteRoleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.deleteRoleSettings().setRetrySettings(deleteRoleRetrySettings);
+
+ RetrySettings undeleteRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.undeleteRoleSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.undeleteRoleSettings().setRetrySettings(undeleteRoleRetrySettings);
+
+ RetrySettings queryTestablePermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryTestablePermissionsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .queryTestablePermissionsSettings()
+ .setRetrySettings(queryTestablePermissionsRetrySettings);
+
+ RetrySettings queryAuditableServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryAuditableServicesSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .queryAuditableServicesSettings()
+ .setRetrySettings(queryAuditableServicesRetrySettings);
+
+ RetrySettings lintPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lintPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.lintPolicySettings().setRetrySettings(lintPolicyRetrySettings);
+
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured service-level retry settings from properties.");
+ }
+ }
+ Retry listServiceAccountsRetry = clientProperties.getListServiceAccountsRetry();
+ if (listServiceAccountsRetry != null) {
+ RetrySettings listServiceAccountsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceAccountsSettings().getRetrySettings(),
+ listServiceAccountsRetry);
+ clientSettingsBuilder
+ .listServiceAccountsSettings()
+ .setRetrySettings(listServiceAccountsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listServiceAccounts from properties.");
+ }
+ }
+ Retry getServiceAccountRetry = clientProperties.getGetServiceAccountRetry();
+ if (getServiceAccountRetry != null) {
+ RetrySettings getServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceAccountSettings().getRetrySettings(),
+ getServiceAccountRetry);
+ clientSettingsBuilder
+ .getServiceAccountSettings()
+ .setRetrySettings(getServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getServiceAccount from properties.");
+ }
+ }
+ Retry createServiceAccountRetry = clientProperties.getCreateServiceAccountRetry();
+ if (createServiceAccountRetry != null) {
+ RetrySettings createServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceAccountSettings().getRetrySettings(),
+ createServiceAccountRetry);
+ clientSettingsBuilder
+ .createServiceAccountSettings()
+ .setRetrySettings(createServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createServiceAccount from properties.");
+ }
+ }
+ Retry updateServiceAccountRetry = clientProperties.getUpdateServiceAccountRetry();
+ if (updateServiceAccountRetry != null) {
+ RetrySettings updateServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateServiceAccountSettings().getRetrySettings(),
+ updateServiceAccountRetry);
+ clientSettingsBuilder
+ .updateServiceAccountSettings()
+ .setRetrySettings(updateServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for updateServiceAccount from properties.");
+ }
+ }
+ Retry patchServiceAccountRetry = clientProperties.getPatchServiceAccountRetry();
+ if (patchServiceAccountRetry != null) {
+ RetrySettings patchServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.patchServiceAccountSettings().getRetrySettings(),
+ patchServiceAccountRetry);
+ clientSettingsBuilder
+ .patchServiceAccountSettings()
+ .setRetrySettings(patchServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for patchServiceAccount from properties.");
+ }
+ }
+ Retry deleteServiceAccountRetry = clientProperties.getDeleteServiceAccountRetry();
+ if (deleteServiceAccountRetry != null) {
+ RetrySettings deleteServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceAccountSettings().getRetrySettings(),
+ deleteServiceAccountRetry);
+ clientSettingsBuilder
+ .deleteServiceAccountSettings()
+ .setRetrySettings(deleteServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteServiceAccount from properties.");
+ }
+ }
+ Retry undeleteServiceAccountRetry = clientProperties.getUndeleteServiceAccountRetry();
+ if (undeleteServiceAccountRetry != null) {
+ RetrySettings undeleteServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.undeleteServiceAccountSettings().getRetrySettings(),
+ undeleteServiceAccountRetry);
+ clientSettingsBuilder
+ .undeleteServiceAccountSettings()
+ .setRetrySettings(undeleteServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for undeleteServiceAccount from properties.");
+ }
+ }
+ Retry enableServiceAccountRetry = clientProperties.getEnableServiceAccountRetry();
+ if (enableServiceAccountRetry != null) {
+ RetrySettings enableServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enableServiceAccountSettings().getRetrySettings(),
+ enableServiceAccountRetry);
+ clientSettingsBuilder
+ .enableServiceAccountSettings()
+ .setRetrySettings(enableServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for enableServiceAccount from properties.");
+ }
+ }
+ Retry disableServiceAccountRetry = clientProperties.getDisableServiceAccountRetry();
+ if (disableServiceAccountRetry != null) {
+ RetrySettings disableServiceAccountRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.disableServiceAccountSettings().getRetrySettings(),
+ disableServiceAccountRetry);
+ clientSettingsBuilder
+ .disableServiceAccountSettings()
+ .setRetrySettings(disableServiceAccountRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for disableServiceAccount from properties.");
+ }
+ }
+ Retry listServiceAccountKeysRetry = clientProperties.getListServiceAccountKeysRetry();
+ if (listServiceAccountKeysRetry != null) {
+ RetrySettings listServiceAccountKeysRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServiceAccountKeysSettings().getRetrySettings(),
+ listServiceAccountKeysRetry);
+ clientSettingsBuilder
+ .listServiceAccountKeysSettings()
+ .setRetrySettings(listServiceAccountKeysRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listServiceAccountKeys from properties.");
+ }
+ }
+ Retry getServiceAccountKeyRetry = clientProperties.getGetServiceAccountKeyRetry();
+ if (getServiceAccountKeyRetry != null) {
+ RetrySettings getServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServiceAccountKeySettings().getRetrySettings(),
+ getServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .getServiceAccountKeySettings()
+ .setRetrySettings(getServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getServiceAccountKey from properties.");
+ }
+ }
+ Retry createServiceAccountKeyRetry = clientProperties.getCreateServiceAccountKeyRetry();
+ if (createServiceAccountKeyRetry != null) {
+ RetrySettings createServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createServiceAccountKeySettings().getRetrySettings(),
+ createServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .createServiceAccountKeySettings()
+ .setRetrySettings(createServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for createServiceAccountKey from properties.");
+ }
+ }
+ Retry uploadServiceAccountKeyRetry = clientProperties.getUploadServiceAccountKeyRetry();
+ if (uploadServiceAccountKeyRetry != null) {
+ RetrySettings uploadServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.uploadServiceAccountKeySettings().getRetrySettings(),
+ uploadServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .uploadServiceAccountKeySettings()
+ .setRetrySettings(uploadServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for uploadServiceAccountKey from properties.");
+ }
+ }
+ Retry deleteServiceAccountKeyRetry = clientProperties.getDeleteServiceAccountKeyRetry();
+ if (deleteServiceAccountKeyRetry != null) {
+ RetrySettings deleteServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteServiceAccountKeySettings().getRetrySettings(),
+ deleteServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .deleteServiceAccountKeySettings()
+ .setRetrySettings(deleteServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for deleteServiceAccountKey from properties.");
+ }
+ }
+ Retry disableServiceAccountKeyRetry = clientProperties.getDisableServiceAccountKeyRetry();
+ if (disableServiceAccountKeyRetry != null) {
+ RetrySettings disableServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.disableServiceAccountKeySettings().getRetrySettings(),
+ disableServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .disableServiceAccountKeySettings()
+ .setRetrySettings(disableServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for disableServiceAccountKey from properties.");
+ }
+ }
+ Retry enableServiceAccountKeyRetry = clientProperties.getEnableServiceAccountKeyRetry();
+ if (enableServiceAccountKeyRetry != null) {
+ RetrySettings enableServiceAccountKeyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.enableServiceAccountKeySettings().getRetrySettings(),
+ enableServiceAccountKeyRetry);
+ clientSettingsBuilder
+ .enableServiceAccountKeySettings()
+ .setRetrySettings(enableServiceAccountKeyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for enableServiceAccountKey from properties.");
+ }
+ }
+ Retry signBlobRetry = clientProperties.getSignBlobRetry();
+ if (signBlobRetry != null) {
+ RetrySettings signBlobRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signBlobSettings().getRetrySettings(), signBlobRetry);
+ clientSettingsBuilder.signBlobSettings().setRetrySettings(signBlobRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for signBlob from properties.");
+ }
+ }
+ Retry signJwtRetry = clientProperties.getSignJwtRetry();
+ if (signJwtRetry != null) {
+ RetrySettings signJwtRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.signJwtSettings().getRetrySettings(), signJwtRetry);
+ clientSettingsBuilder.signJwtSettings().setRetrySettings(signJwtRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for signJwt from properties.");
+ }
+ }
+ Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
+ if (getIamPolicyRetry != null) {
+ RetrySettings getIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
+ clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
+ }
+ }
+ Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
+ if (setIamPolicyRetry != null) {
+ RetrySettings setIamPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
+ clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
+ }
+ }
+ Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
+ if (testIamPermissionsRetry != null) {
+ RetrySettings testIamPermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
+ testIamPermissionsRetry);
+ clientSettingsBuilder
+ .testIamPermissionsSettings()
+ .setRetrySettings(testIamPermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for testIamPermissions from properties.");
+ }
+ }
+ Retry queryGrantableRolesRetry = clientProperties.getQueryGrantableRolesRetry();
+ if (queryGrantableRolesRetry != null) {
+ RetrySettings queryGrantableRolesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryGrantableRolesSettings().getRetrySettings(),
+ queryGrantableRolesRetry);
+ clientSettingsBuilder
+ .queryGrantableRolesSettings()
+ .setRetrySettings(queryGrantableRolesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for queryGrantableRoles from properties.");
+ }
+ }
+ Retry listRolesRetry = clientProperties.getListRolesRetry();
+ if (listRolesRetry != null) {
+ RetrySettings listRolesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listRolesSettings().getRetrySettings(), listRolesRetry);
+ clientSettingsBuilder.listRolesSettings().setRetrySettings(listRolesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for listRoles from properties.");
+ }
+ }
+ Retry getRoleRetry = clientProperties.getGetRoleRetry();
+ if (getRoleRetry != null) {
+ RetrySettings getRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getRoleSettings().getRetrySettings(), getRoleRetry);
+ clientSettingsBuilder.getRoleSettings().setRetrySettings(getRoleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getRole from properties.");
+ }
+ }
+ Retry createRoleRetry = clientProperties.getCreateRoleRetry();
+ if (createRoleRetry != null) {
+ RetrySettings createRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.createRoleSettings().getRetrySettings(), createRoleRetry);
+ clientSettingsBuilder.createRoleSettings().setRetrySettings(createRoleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for createRole from properties.");
+ }
+ }
+ Retry updateRoleRetry = clientProperties.getUpdateRoleRetry();
+ if (updateRoleRetry != null) {
+ RetrySettings updateRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.updateRoleSettings().getRetrySettings(), updateRoleRetry);
+ clientSettingsBuilder.updateRoleSettings().setRetrySettings(updateRoleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for updateRole from properties.");
+ }
+ }
+ Retry deleteRoleRetry = clientProperties.getDeleteRoleRetry();
+ if (deleteRoleRetry != null) {
+ RetrySettings deleteRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.deleteRoleSettings().getRetrySettings(), deleteRoleRetry);
+ clientSettingsBuilder.deleteRoleSettings().setRetrySettings(deleteRoleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for deleteRole from properties.");
+ }
+ }
+ Retry undeleteRoleRetry = clientProperties.getUndeleteRoleRetry();
+ if (undeleteRoleRetry != null) {
+ RetrySettings undeleteRoleRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.undeleteRoleSettings().getRetrySettings(), undeleteRoleRetry);
+ clientSettingsBuilder.undeleteRoleSettings().setRetrySettings(undeleteRoleRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for undeleteRole from properties.");
+ }
+ }
+ Retry queryTestablePermissionsRetry = clientProperties.getQueryTestablePermissionsRetry();
+ if (queryTestablePermissionsRetry != null) {
+ RetrySettings queryTestablePermissionsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryTestablePermissionsSettings().getRetrySettings(),
+ queryTestablePermissionsRetry);
+ clientSettingsBuilder
+ .queryTestablePermissionsSettings()
+ .setRetrySettings(queryTestablePermissionsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for queryTestablePermissions from properties.");
+ }
+ }
+ Retry queryAuditableServicesRetry = clientProperties.getQueryAuditableServicesRetry();
+ if (queryAuditableServicesRetry != null) {
+ RetrySettings queryAuditableServicesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.queryAuditableServicesSettings().getRetrySettings(),
+ queryAuditableServicesRetry);
+ clientSettingsBuilder
+ .queryAuditableServicesSettings()
+ .setRetrySettings(queryAuditableServicesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for queryAuditableServices from properties.");
+ }
+ }
+ Retry lintPolicyRetry = clientProperties.getLintPolicyRetry();
+ if (lintPolicyRetry != null) {
+ RetrySettings lintPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.lintPolicySettings().getRetrySettings(), lintPolicyRetry);
+ clientSettingsBuilder.lintPolicySettings().setRetrySettings(lintPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for lintPolicy from properties.");
+ }
+ }
+ return clientSettingsBuilder.build();
+ }
+
+ /**
+ * Provides a IAMClient bean configured with IAMSettings.
+ *
+ * @param iAMSettings settings to configure an instance of client bean.
+ * @return a {@link IAMClient} bean configured with {@link IAMSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IAMClient iAMClient(IAMSettings iAMSettings) throws IOException {
+ return IAMClient.create(iAMSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-i-a-m";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringProperties.java b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringProperties.java
new file mode 100644
index 0000000000..e49c2c3454
--- /dev/null
+++ b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/IAMSpringProperties.java
@@ -0,0 +1,475 @@
+/*
+ * Copyright 2022 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.iam.admin.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 IAM client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.cloud.iam.admin.v1.i-a-m")
+public class IAMSpringProperties 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 listServiceAccounts. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServiceAccountsRetry;
+ /**
+ * Allow override of retry settings at method-level for getServiceAccount. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for createServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for updateServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for patchServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry patchServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for undeleteServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry undeleteServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for enableServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry enableServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for disableServiceAccount. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry disableServiceAccountRetry;
+ /**
+ * Allow override of retry settings at method-level for listServiceAccountKeys. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServiceAccountKeysRetry;
+ /**
+ * Allow override of retry settings at method-level for getServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for createServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for uploadServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry uploadServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for disableServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry disableServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for enableServiceAccountKey. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry enableServiceAccountKeyRetry;
+ /**
+ * Allow override of retry settings at method-level for signBlob. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry signBlobRetry;
+ /**
+ * Allow override of retry settings at method-level for signJwt. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry signJwtRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for queryGrantableRoles. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry queryGrantableRolesRetry;
+ /**
+ * Allow override of retry settings at method-level for listRoles. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listRolesRetry;
+ /**
+ * Allow override of retry settings at method-level for getRole. If defined, this takes precedence
+ * over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getRoleRetry;
+ /**
+ * Allow override of retry settings at method-level for createRole. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry createRoleRetry;
+ /**
+ * Allow override of retry settings at method-level for updateRole. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry updateRoleRetry;
+ /**
+ * Allow override of retry settings at method-level for deleteRole. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry deleteRoleRetry;
+ /**
+ * Allow override of retry settings at method-level for undeleteRole. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry undeleteRoleRetry;
+ /**
+ * Allow override of retry settings at method-level for queryTestablePermissions. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry queryTestablePermissionsRetry;
+ /**
+ * Allow override of retry settings at method-level for queryAuditableServices. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry queryAuditableServicesRetry;
+ /**
+ * Allow override of retry settings at method-level for lintPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry lintPolicyRetry;
+
+ @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 getListServiceAccountsRetry() {
+ return this.listServiceAccountsRetry;
+ }
+
+ public void setListServiceAccountsRetry(Retry listServiceAccountsRetry) {
+ this.listServiceAccountsRetry = listServiceAccountsRetry;
+ }
+
+ public Retry getGetServiceAccountRetry() {
+ return this.getServiceAccountRetry;
+ }
+
+ public void setGetServiceAccountRetry(Retry getServiceAccountRetry) {
+ this.getServiceAccountRetry = getServiceAccountRetry;
+ }
+
+ public Retry getCreateServiceAccountRetry() {
+ return this.createServiceAccountRetry;
+ }
+
+ public void setCreateServiceAccountRetry(Retry createServiceAccountRetry) {
+ this.createServiceAccountRetry = createServiceAccountRetry;
+ }
+
+ public Retry getUpdateServiceAccountRetry() {
+ return this.updateServiceAccountRetry;
+ }
+
+ public void setUpdateServiceAccountRetry(Retry updateServiceAccountRetry) {
+ this.updateServiceAccountRetry = updateServiceAccountRetry;
+ }
+
+ public Retry getPatchServiceAccountRetry() {
+ return this.patchServiceAccountRetry;
+ }
+
+ public void setPatchServiceAccountRetry(Retry patchServiceAccountRetry) {
+ this.patchServiceAccountRetry = patchServiceAccountRetry;
+ }
+
+ public Retry getDeleteServiceAccountRetry() {
+ return this.deleteServiceAccountRetry;
+ }
+
+ public void setDeleteServiceAccountRetry(Retry deleteServiceAccountRetry) {
+ this.deleteServiceAccountRetry = deleteServiceAccountRetry;
+ }
+
+ public Retry getUndeleteServiceAccountRetry() {
+ return this.undeleteServiceAccountRetry;
+ }
+
+ public void setUndeleteServiceAccountRetry(Retry undeleteServiceAccountRetry) {
+ this.undeleteServiceAccountRetry = undeleteServiceAccountRetry;
+ }
+
+ public Retry getEnableServiceAccountRetry() {
+ return this.enableServiceAccountRetry;
+ }
+
+ public void setEnableServiceAccountRetry(Retry enableServiceAccountRetry) {
+ this.enableServiceAccountRetry = enableServiceAccountRetry;
+ }
+
+ public Retry getDisableServiceAccountRetry() {
+ return this.disableServiceAccountRetry;
+ }
+
+ public void setDisableServiceAccountRetry(Retry disableServiceAccountRetry) {
+ this.disableServiceAccountRetry = disableServiceAccountRetry;
+ }
+
+ public Retry getListServiceAccountKeysRetry() {
+ return this.listServiceAccountKeysRetry;
+ }
+
+ public void setListServiceAccountKeysRetry(Retry listServiceAccountKeysRetry) {
+ this.listServiceAccountKeysRetry = listServiceAccountKeysRetry;
+ }
+
+ public Retry getGetServiceAccountKeyRetry() {
+ return this.getServiceAccountKeyRetry;
+ }
+
+ public void setGetServiceAccountKeyRetry(Retry getServiceAccountKeyRetry) {
+ this.getServiceAccountKeyRetry = getServiceAccountKeyRetry;
+ }
+
+ public Retry getCreateServiceAccountKeyRetry() {
+ return this.createServiceAccountKeyRetry;
+ }
+
+ public void setCreateServiceAccountKeyRetry(Retry createServiceAccountKeyRetry) {
+ this.createServiceAccountKeyRetry = createServiceAccountKeyRetry;
+ }
+
+ public Retry getUploadServiceAccountKeyRetry() {
+ return this.uploadServiceAccountKeyRetry;
+ }
+
+ public void setUploadServiceAccountKeyRetry(Retry uploadServiceAccountKeyRetry) {
+ this.uploadServiceAccountKeyRetry = uploadServiceAccountKeyRetry;
+ }
+
+ public Retry getDeleteServiceAccountKeyRetry() {
+ return this.deleteServiceAccountKeyRetry;
+ }
+
+ public void setDeleteServiceAccountKeyRetry(Retry deleteServiceAccountKeyRetry) {
+ this.deleteServiceAccountKeyRetry = deleteServiceAccountKeyRetry;
+ }
+
+ public Retry getDisableServiceAccountKeyRetry() {
+ return this.disableServiceAccountKeyRetry;
+ }
+
+ public void setDisableServiceAccountKeyRetry(Retry disableServiceAccountKeyRetry) {
+ this.disableServiceAccountKeyRetry = disableServiceAccountKeyRetry;
+ }
+
+ public Retry getEnableServiceAccountKeyRetry() {
+ return this.enableServiceAccountKeyRetry;
+ }
+
+ public void setEnableServiceAccountKeyRetry(Retry enableServiceAccountKeyRetry) {
+ this.enableServiceAccountKeyRetry = enableServiceAccountKeyRetry;
+ }
+
+ public Retry getSignBlobRetry() {
+ return this.signBlobRetry;
+ }
+
+ public void setSignBlobRetry(Retry signBlobRetry) {
+ this.signBlobRetry = signBlobRetry;
+ }
+
+ public Retry getSignJwtRetry() {
+ return this.signJwtRetry;
+ }
+
+ public void setSignJwtRetry(Retry signJwtRetry) {
+ this.signJwtRetry = signJwtRetry;
+ }
+
+ public Retry getGetIamPolicyRetry() {
+ return this.getIamPolicyRetry;
+ }
+
+ public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
+ this.getIamPolicyRetry = getIamPolicyRetry;
+ }
+
+ public Retry getSetIamPolicyRetry() {
+ return this.setIamPolicyRetry;
+ }
+
+ public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
+ this.setIamPolicyRetry = setIamPolicyRetry;
+ }
+
+ public Retry getTestIamPermissionsRetry() {
+ return this.testIamPermissionsRetry;
+ }
+
+ public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
+ this.testIamPermissionsRetry = testIamPermissionsRetry;
+ }
+
+ public Retry getQueryGrantableRolesRetry() {
+ return this.queryGrantableRolesRetry;
+ }
+
+ public void setQueryGrantableRolesRetry(Retry queryGrantableRolesRetry) {
+ this.queryGrantableRolesRetry = queryGrantableRolesRetry;
+ }
+
+ public Retry getListRolesRetry() {
+ return this.listRolesRetry;
+ }
+
+ public void setListRolesRetry(Retry listRolesRetry) {
+ this.listRolesRetry = listRolesRetry;
+ }
+
+ public Retry getGetRoleRetry() {
+ return this.getRoleRetry;
+ }
+
+ public void setGetRoleRetry(Retry getRoleRetry) {
+ this.getRoleRetry = getRoleRetry;
+ }
+
+ public Retry getCreateRoleRetry() {
+ return this.createRoleRetry;
+ }
+
+ public void setCreateRoleRetry(Retry createRoleRetry) {
+ this.createRoleRetry = createRoleRetry;
+ }
+
+ public Retry getUpdateRoleRetry() {
+ return this.updateRoleRetry;
+ }
+
+ public void setUpdateRoleRetry(Retry updateRoleRetry) {
+ this.updateRoleRetry = updateRoleRetry;
+ }
+
+ public Retry getDeleteRoleRetry() {
+ return this.deleteRoleRetry;
+ }
+
+ public void setDeleteRoleRetry(Retry deleteRoleRetry) {
+ this.deleteRoleRetry = deleteRoleRetry;
+ }
+
+ public Retry getUndeleteRoleRetry() {
+ return this.undeleteRoleRetry;
+ }
+
+ public void setUndeleteRoleRetry(Retry undeleteRoleRetry) {
+ this.undeleteRoleRetry = undeleteRoleRetry;
+ }
+
+ public Retry getQueryTestablePermissionsRetry() {
+ return this.queryTestablePermissionsRetry;
+ }
+
+ public void setQueryTestablePermissionsRetry(Retry queryTestablePermissionsRetry) {
+ this.queryTestablePermissionsRetry = queryTestablePermissionsRetry;
+ }
+
+ public Retry getQueryAuditableServicesRetry() {
+ return this.queryAuditableServicesRetry;
+ }
+
+ public void setQueryAuditableServicesRetry(Retry queryAuditableServicesRetry) {
+ this.queryAuditableServicesRetry = queryAuditableServicesRetry;
+ }
+
+ public Retry getLintPolicyRetry() {
+ return this.lintPolicyRetry;
+ }
+
+ public void setLintPolicyRetry(Retry lintPolicyRetry) {
+ this.lintPolicyRetry = lintPolicyRetry;
+ }
+}
diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/package-info.java b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/package-info.java
new file mode 100644
index 0000000000..1edce55dd7
--- /dev/null
+++ b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/java/com/google/cloud/iam/admin/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for iam. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.cloud.iam.admin.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..cad4a7e6be
--- /dev/null
+++ b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.cloud.iam.admin.v1.i-a-m.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud iam/IAM components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..5395a16ed3
--- /dev/null
+++ b/spring-cloud-previews/google-iam-admin-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.cloud.iam.admin.v1.spring.IAMSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/pom.xml b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/pom.xml
new file mode 100644
index 0000000000..8fef97761c
--- /dev/null
+++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/pom.xml
@@ -0,0 +1,35 @@
+
+
Provides auto-configuration for Spring Boot + * + *
The default instance has everything set to sensible defaults: + * + *
Retry settings are also configured from service-level and method-level properties specified
+ * in AccessContextManagerSpringProperties. 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 AccessContextManagerSettings} bean configured with {@link
+ * TransportChannelProvider} bean.
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AccessContextManagerSettings accessContextManagerSettings(
+ @Qualifier("defaultAccessContextManagerTransportChannelProvider")
+ TransportChannelProvider defaultTransportChannelProvider)
+ throws IOException {
+ AccessContextManagerSettings.Builder clientSettingsBuilder;
+ if (this.clientProperties.getUseRest()) {
+ clientSettingsBuilder = AccessContextManagerSettings.newHttpJsonBuilder();
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Using REST (HTTP/JSON) transport.");
+ }
+ } else {
+ clientSettingsBuilder = AccessContextManagerSettings.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 =
+ AccessContextManagerSettings.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 listAccessPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAccessPoliciesSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listAccessPoliciesSettings()
+ .setRetrySettings(listAccessPoliciesRetrySettings);
+
+ RetrySettings getAccessPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessPolicySettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getAccessPolicySettings()
+ .setRetrySettings(getAccessPolicyRetrySettings);
+
+ RetrySettings listAccessLevelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAccessLevelsSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .listAccessLevelsSettings()
+ .setRetrySettings(listAccessLevelsRetrySettings);
+
+ RetrySettings getAccessLevelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessLevelSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder.getAccessLevelSettings().setRetrySettings(getAccessLevelRetrySettings);
+
+ RetrySettings listServicePerimetersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicePerimetersSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listServicePerimetersSettings()
+ .setRetrySettings(listServicePerimetersRetrySettings);
+
+ RetrySettings getServicePerimeterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServicePerimeterSettings().getRetrySettings(), serviceRetry);
+ clientSettingsBuilder
+ .getServicePerimeterSettings()
+ .setRetrySettings(getServicePerimeterRetrySettings);
+
+ RetrySettings listGcpUserAccessBindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGcpUserAccessBindingsSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .listGcpUserAccessBindingsSettings()
+ .setRetrySettings(listGcpUserAccessBindingsRetrySettings);
+
+ RetrySettings getGcpUserAccessBindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGcpUserAccessBindingSettings().getRetrySettings(),
+ serviceRetry);
+ clientSettingsBuilder
+ .getGcpUserAccessBindingSettings()
+ .setRetrySettings(getGcpUserAccessBindingRetrySettings);
+
+ 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 listAccessPoliciesRetry = clientProperties.getListAccessPoliciesRetry();
+ if (listAccessPoliciesRetry != null) {
+ RetrySettings listAccessPoliciesRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAccessPoliciesSettings().getRetrySettings(),
+ listAccessPoliciesRetry);
+ clientSettingsBuilder
+ .listAccessPoliciesSettings()
+ .setRetrySettings(listAccessPoliciesRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listAccessPolicies from properties.");
+ }
+ }
+ Retry getAccessPolicyRetry = clientProperties.getGetAccessPolicyRetry();
+ if (getAccessPolicyRetry != null) {
+ RetrySettings getAccessPolicyRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessPolicySettings().getRetrySettings(),
+ getAccessPolicyRetry);
+ clientSettingsBuilder
+ .getAccessPolicySettings()
+ .setRetrySettings(getAccessPolicyRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getAccessPolicy from properties.");
+ }
+ }
+ Retry listAccessLevelsRetry = clientProperties.getListAccessLevelsRetry();
+ if (listAccessLevelsRetry != null) {
+ RetrySettings listAccessLevelsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listAccessLevelsSettings().getRetrySettings(),
+ listAccessLevelsRetry);
+ clientSettingsBuilder
+ .listAccessLevelsSettings()
+ .setRetrySettings(listAccessLevelsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listAccessLevels from properties.");
+ }
+ }
+ Retry getAccessLevelRetry = clientProperties.getGetAccessLevelRetry();
+ if (getAccessLevelRetry != null) {
+ RetrySettings getAccessLevelRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getAccessLevelSettings().getRetrySettings(),
+ getAccessLevelRetry);
+ clientSettingsBuilder.getAccessLevelSettings().setRetrySettings(getAccessLevelRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Configured method-level retry settings for getAccessLevel from properties.");
+ }
+ }
+ Retry listServicePerimetersRetry = clientProperties.getListServicePerimetersRetry();
+ if (listServicePerimetersRetry != null) {
+ RetrySettings listServicePerimetersRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listServicePerimetersSettings().getRetrySettings(),
+ listServicePerimetersRetry);
+ clientSettingsBuilder
+ .listServicePerimetersSettings()
+ .setRetrySettings(listServicePerimetersRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listServicePerimeters from properties.");
+ }
+ }
+ Retry getServicePerimeterRetry = clientProperties.getGetServicePerimeterRetry();
+ if (getServicePerimeterRetry != null) {
+ RetrySettings getServicePerimeterRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getServicePerimeterSettings().getRetrySettings(),
+ getServicePerimeterRetry);
+ clientSettingsBuilder
+ .getServicePerimeterSettings()
+ .setRetrySettings(getServicePerimeterRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getServicePerimeter from properties.");
+ }
+ }
+ Retry listGcpUserAccessBindingsRetry = clientProperties.getListGcpUserAccessBindingsRetry();
+ if (listGcpUserAccessBindingsRetry != null) {
+ RetrySettings listGcpUserAccessBindingsRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.listGcpUserAccessBindingsSettings().getRetrySettings(),
+ listGcpUserAccessBindingsRetry);
+ clientSettingsBuilder
+ .listGcpUserAccessBindingsSettings()
+ .setRetrySettings(listGcpUserAccessBindingsRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for listGcpUserAccessBindings from properties.");
+ }
+ }
+ Retry getGcpUserAccessBindingRetry = clientProperties.getGetGcpUserAccessBindingRetry();
+ if (getGcpUserAccessBindingRetry != null) {
+ RetrySettings getGcpUserAccessBindingRetrySettings =
+ RetryUtil.updateRetrySettings(
+ clientSettingsBuilder.getGcpUserAccessBindingSettings().getRetrySettings(),
+ getGcpUserAccessBindingRetry);
+ clientSettingsBuilder
+ .getGcpUserAccessBindingSettings()
+ .setRetrySettings(getGcpUserAccessBindingRetrySettings);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(
+ "Configured method-level retry settings for getGcpUserAccessBinding 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 AccessContextManagerClient bean configured with AccessContextManagerSettings.
+ *
+ * @param accessContextManagerSettings settings to configure an instance of client bean.
+ * @return a {@link AccessContextManagerClient} bean configured with {@link
+ * AccessContextManagerSettings}
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public AccessContextManagerClient accessContextManagerClient(
+ AccessContextManagerSettings accessContextManagerSettings) throws IOException {
+ return AccessContextManagerClient.create(accessContextManagerSettings);
+ }
+
+ private HeaderProvider userAgentHeaderProvider() {
+ String springLibrary = "spring-autogen-access-context-manager";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version);
+ }
+}
diff --git a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringProperties.java b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringProperties.java
new file mode 100644
index 0000000000..df44864957
--- /dev/null
+++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/AccessContextManagerSpringProperties.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2022 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.identity.accesscontextmanager.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 AccessContextManager client bean */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+@ConfigurationProperties("com.google.identity.accesscontextmanager.v1.access-context-manager")
+public class AccessContextManagerSpringProperties implements CredentialsSupplier {
+ /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
+ @NestedConfigurationProperty
+ private final Credentials credentials =
+ new Credentials("https://www.googleapis.com/auth/cloud-platform");
+ /** Quota project to use for billing. */
+ private String quotaProjectId;
+ /** Number of threads used for executors. */
+ private Integer executorThreadCount;
+ /** Allow override of default transport channel provider to use REST instead of gRPC. */
+ private boolean useRest = false;
+ /** Allow override of retry settings at service level, applying to all of its RPC methods. */
+ @NestedConfigurationProperty private Retry retry;
+ /**
+ * Allow override of retry settings at method-level for listAccessPolicies. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAccessPoliciesRetry;
+ /**
+ * Allow override of retry settings at method-level for getAccessPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAccessPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for listAccessLevels. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listAccessLevelsRetry;
+ /**
+ * Allow override of retry settings at method-level for getAccessLevel. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getAccessLevelRetry;
+ /**
+ * Allow override of retry settings at method-level for listServicePerimeters. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listServicePerimetersRetry;
+ /**
+ * Allow override of retry settings at method-level for getServicePerimeter. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getServicePerimeterRetry;
+ /**
+ * Allow override of retry settings at method-level for listGcpUserAccessBindings. If defined,
+ * this takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry listGcpUserAccessBindingsRetry;
+ /**
+ * Allow override of retry settings at method-level for getGcpUserAccessBinding. If defined, this
+ * takes precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getGcpUserAccessBindingRetry;
+ /**
+ * Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry setIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry getIamPolicyRetry;
+ /**
+ * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
+ * precedence over service-level retry configurations for that RPC method.
+ */
+ @NestedConfigurationProperty private Retry testIamPermissionsRetry;
+
+ @Override
+ public Credentials getCredentials() {
+ return this.credentials;
+ }
+
+ public String getQuotaProjectId() {
+ return this.quotaProjectId;
+ }
+
+ public void setQuotaProjectId(String quotaProjectId) {
+ this.quotaProjectId = quotaProjectId;
+ }
+
+ public boolean getUseRest() {
+ return this.useRest;
+ }
+
+ public void setUseRest(boolean useRest) {
+ this.useRest = useRest;
+ }
+
+ public Integer getExecutorThreadCount() {
+ return this.executorThreadCount;
+ }
+
+ public void setExecutorThreadCount(Integer executorThreadCount) {
+ this.executorThreadCount = executorThreadCount;
+ }
+
+ public Retry getRetry() {
+ return this.retry;
+ }
+
+ public void setRetry(Retry retry) {
+ this.retry = retry;
+ }
+
+ public Retry getListAccessPoliciesRetry() {
+ return this.listAccessPoliciesRetry;
+ }
+
+ public void setListAccessPoliciesRetry(Retry listAccessPoliciesRetry) {
+ this.listAccessPoliciesRetry = listAccessPoliciesRetry;
+ }
+
+ public Retry getGetAccessPolicyRetry() {
+ return this.getAccessPolicyRetry;
+ }
+
+ public void setGetAccessPolicyRetry(Retry getAccessPolicyRetry) {
+ this.getAccessPolicyRetry = getAccessPolicyRetry;
+ }
+
+ public Retry getListAccessLevelsRetry() {
+ return this.listAccessLevelsRetry;
+ }
+
+ public void setListAccessLevelsRetry(Retry listAccessLevelsRetry) {
+ this.listAccessLevelsRetry = listAccessLevelsRetry;
+ }
+
+ public Retry getGetAccessLevelRetry() {
+ return this.getAccessLevelRetry;
+ }
+
+ public void setGetAccessLevelRetry(Retry getAccessLevelRetry) {
+ this.getAccessLevelRetry = getAccessLevelRetry;
+ }
+
+ public Retry getListServicePerimetersRetry() {
+ return this.listServicePerimetersRetry;
+ }
+
+ public void setListServicePerimetersRetry(Retry listServicePerimetersRetry) {
+ this.listServicePerimetersRetry = listServicePerimetersRetry;
+ }
+
+ public Retry getGetServicePerimeterRetry() {
+ return this.getServicePerimeterRetry;
+ }
+
+ public void setGetServicePerimeterRetry(Retry getServicePerimeterRetry) {
+ this.getServicePerimeterRetry = getServicePerimeterRetry;
+ }
+
+ public Retry getListGcpUserAccessBindingsRetry() {
+ return this.listGcpUserAccessBindingsRetry;
+ }
+
+ public void setListGcpUserAccessBindingsRetry(Retry listGcpUserAccessBindingsRetry) {
+ this.listGcpUserAccessBindingsRetry = listGcpUserAccessBindingsRetry;
+ }
+
+ public Retry getGetGcpUserAccessBindingRetry() {
+ return this.getGcpUserAccessBindingRetry;
+ }
+
+ public void setGetGcpUserAccessBindingRetry(Retry getGcpUserAccessBindingRetry) {
+ this.getGcpUserAccessBindingRetry = getGcpUserAccessBindingRetry;
+ }
+
+ 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-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/package-info.java b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/package-info.java
new file mode 100644
index 0000000000..2758b1fd14
--- /dev/null
+++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/java/com/google/identity/accesscontextmanager/v1/spring/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Spring Boot auto-configurations for accesscontextmanager. */
+@Generated("by google-cloud-spring-generator")
+@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
+package com.google.identity.accesscontextmanager.v1.spring;
+
+import com.google.api.core.BetaApi;
+import javax.annotation.Generated;
diff --git a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000000..e144d5f2fe
--- /dev/null
+++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "com.google.identity.accesscontextmanager.v1.access-context-manager.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Auto-configure Google Cloud accesscontextmanager/AccessContextManager components.",
+ "defaultValue": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000000..de2fb1bbbc
--- /dev/null
+++ b/spring-cloud-previews/google-identity-accesscontextmanager-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.google.identity.accesscontextmanager.v1.spring.AccessContextManagerSpringAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-previews/pom.xml b/spring-cloud-previews/pom.xml
index 44c8ad7c74..83935e2fe1 100644
--- a/spring-cloud-previews/pom.xml
+++ b/spring-cloud-previews/pom.xml
@@ -13,6 +13,93 @@