Skip to content

Commit

Permalink
chore: update starter modules in spring-cloud-previews (#2580)
Browse files Browse the repository at this point in the history
* chore: update starter modules in spring-cloud-previews

* chore: Add endpointcontext mock

* chore: Add endpointcontext mock to test template

---------

Co-authored-by: Cloud Java Bot <cloud-java-bot@google.com>
  • Loading branch information
lqiu96 and cloud-java-bot authored Feb 5, 2024
1 parent ebcd8ff commit e9378a9
Show file tree
Hide file tree
Showing 34 changed files with 1,811 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void testCustomTransportChannelProviderUsedWhenProvided() throws IOException {
when(mockTransportChannel.getEmptyCallContext()).thenReturn(mockApiCallContext);
when(mockApiCallContext.withCredentials(any())).thenReturn(mockApiCallContext);
when(mockApiCallContext.withTransportChannel(any())).thenReturn(mockApiCallContext);
when(mockApiCallContext.withEndpointContext(any())).thenReturn(mockApiCallContext);

contextRunner
.withBean(
Expand Down
174 changes: 87 additions & 87 deletions spring-cloud-previews/README.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.aiplatform.v1.spring;

import com.google.api.core.BetaApi;
import com.google.cloud.spring.core.Credentials;
import com.google.cloud.spring.core.CredentialsSupplier;
import com.google.cloud.spring.core.Retry;
import javax.annotation.Generated;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/** Provides default property values for DeploymentResourcePoolService client bean */
@Generated("by google-cloud-spring-generator")
@BetaApi("Autogenerated Spring autoconfiguration is not yet stable")
@ConfigurationProperties("com.google.cloud.aiplatform.v1.deployment-resource-pool-service")
public class DeploymentResourcePoolServiceSpringProperties implements CredentialsSupplier {
/** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */
@NestedConfigurationProperty
private final Credentials credentials =
new Credentials("https://www.googleapis.com/auth/cloud-platform");
/** Quota project to use for billing. */
private String quotaProjectId;
/** Number of threads used for executors. */
private Integer executorThreadCount;
/** Allow override of retry settings at service level, applying to all of its RPC methods. */
@NestedConfigurationProperty private Retry retry;
/**
* Allow override of retry settings at method-level for getDeploymentResourcePool. If defined,
* this takes precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry getDeploymentResourcePoolRetry;
/**
* Allow override of retry settings at method-level for listDeploymentResourcePools. If defined,
* this takes precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry listDeploymentResourcePoolsRetry;
/**
* Allow override of retry settings at method-level for queryDeployedModels. If defined, this
* takes precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry queryDeployedModelsRetry;
/**
* Allow override of retry settings at method-level for listLocations. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry listLocationsRetry;
/**
* Allow override of retry settings at method-level for getLocation. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry getLocationRetry;
/**
* Allow override of retry settings at method-level for setIamPolicy. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry setIamPolicyRetry;
/**
* Allow override of retry settings at method-level for getIamPolicy. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry getIamPolicyRetry;
/**
* Allow override of retry settings at method-level for testIamPermissions. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry testIamPermissionsRetry;

@Override
public Credentials getCredentials() {
return this.credentials;
}

public String getQuotaProjectId() {
return this.quotaProjectId;
}

public void setQuotaProjectId(String quotaProjectId) {
this.quotaProjectId = quotaProjectId;
}

public Integer getExecutorThreadCount() {
return this.executorThreadCount;
}

public void setExecutorThreadCount(Integer executorThreadCount) {
this.executorThreadCount = executorThreadCount;
}

public Retry getRetry() {
return this.retry;
}

public void setRetry(Retry retry) {
this.retry = retry;
}

public Retry getGetDeploymentResourcePoolRetry() {
return this.getDeploymentResourcePoolRetry;
}

public void setGetDeploymentResourcePoolRetry(Retry getDeploymentResourcePoolRetry) {
this.getDeploymentResourcePoolRetry = getDeploymentResourcePoolRetry;
}

public Retry getListDeploymentResourcePoolsRetry() {
return this.listDeploymentResourcePoolsRetry;
}

public void setListDeploymentResourcePoolsRetry(Retry listDeploymentResourcePoolsRetry) {
this.listDeploymentResourcePoolsRetry = listDeploymentResourcePoolsRetry;
}

public Retry getQueryDeployedModelsRetry() {
return this.queryDeployedModelsRetry;
}

public void setQueryDeployedModelsRetry(Retry queryDeployedModelsRetry) {
this.queryDeployedModelsRetry = queryDeployedModelsRetry;
}

public Retry getListLocationsRetry() {
return this.listLocationsRetry;
}

public void setListLocationsRetry(Retry listLocationsRetry) {
this.listLocationsRetry = listLocationsRetry;
}

public Retry getGetLocationRetry() {
return this.getLocationRetry;
}

public void setGetLocationRetry(Retry getLocationRetry) {
this.getLocationRetry = getLocationRetry;
}

public Retry getSetIamPolicyRetry() {
return this.setIamPolicyRetry;
}

public void setSetIamPolicyRetry(Retry setIamPolicyRetry) {
this.setIamPolicyRetry = setIamPolicyRetry;
}

public Retry getGetIamPolicyRetry() {
return this.getIamPolicyRetry;
}

public void setGetIamPolicyRetry(Retry getIamPolicyRetry) {
this.getIamPolicyRetry = getIamPolicyRetry;
}

public Retry getTestIamPermissionsRetry() {
return this.testIamPermissionsRetry;
}

public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
this.testIamPermissionsRetry = testIamPermissionsRetry;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"description": "Auto-configure Google Cloud aiplatform/DatasetService components.",
"defaultValue": true
},
{
"name": "com.google.cloud.aiplatform.v1.deployment-resource-pool-service.enabled",
"type": "java.lang.Boolean",
"description": "Auto-configure Google Cloud aiplatform/DeploymentResourcePoolService components.",
"defaultValue": true
},
{
"name": "com.google.cloud.aiplatform.v1.endpoint-service.enabled",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
com.google.cloud.aiplatform.v1.spring.DatasetServiceSpringAutoConfiguration
com.google.cloud.aiplatform.v1.spring.DeploymentResourcePoolServiceSpringAutoConfiguration
com.google.cloud.aiplatform.v1.spring.EndpointServiceSpringAutoConfiguration
com.google.cloud.aiplatform.v1.spring.FeatureOnlineStoreAdminServiceSpringAutoConfiguration
com.google.cloud.aiplatform.v1.spring.FeatureOnlineStoreServiceSpringAutoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ public CloudBillingSettings cloudBillingSettings(
.testIamPermissionsSettings()
.setRetrySettings(testIamPermissionsRetrySettings);

RetrySettings moveBillingAccountRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.moveBillingAccountSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder
.moveBillingAccountSettings()
.setRetrySettings(moveBillingAccountRetrySettings);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Configured service-level retry settings from properties.");
}
Expand Down Expand Up @@ -366,6 +373,20 @@ public CloudBillingSettings cloudBillingSettings(
"Configured method-level retry settings for testIamPermissions from properties.");
}
}
Retry moveBillingAccountRetry = clientProperties.getMoveBillingAccountRetry();
if (moveBillingAccountRetry != null) {
RetrySettings moveBillingAccountRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.moveBillingAccountSettings().getRetrySettings(),
moveBillingAccountRetry);
clientSettingsBuilder
.moveBillingAccountSettings()
.setRetrySettings(moveBillingAccountRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for moveBillingAccount from properties.");
}
}
return clientSettingsBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public class CloudBillingSpringProperties implements CredentialsSupplier {
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry testIamPermissionsRetry;
/**
* Allow override of retry settings at method-level for moveBillingAccount. If defined, this takes
* precedence over service-level retry configurations for that RPC method.
*/
@NestedConfigurationProperty private Retry moveBillingAccountRetry;

@Override
public Credentials getCredentials() {
Expand Down Expand Up @@ -212,4 +217,12 @@ public Retry getTestIamPermissionsRetry() {
public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) {
this.testIamPermissionsRetry = testIamPermissionsRetry;
}

public Retry getMoveBillingAccountRetry() {
return this.moveBillingAccountRetry;
}

public void setMoveBillingAccountRetry(Retry moveBillingAccountRetry) {
this.moveBillingAccountRetry = moveBillingAccountRetry;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,28 @@ public BackendBucketsSettings backendBucketsSettings(
clientSettingsBuilder.getSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder.getSettings().setRetrySettings(getRetrySettings);

RetrySettings getIamPolicyRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);

RetrySettings listRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.listSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder.listSettings().setRetrySettings(listRetrySettings);

RetrySettings setIamPolicyRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);

RetrySettings testIamPermissionsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry);
clientSettingsBuilder
.testIamPermissionsSettings()
.setRetrySettings(testIamPermissionsRetrySettings);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Configured service-level retry settings from properties.");
}
Expand All @@ -172,6 +189,16 @@ public BackendBucketsSettings backendBucketsSettings(
LOGGER.trace("Configured method-level retry settings for get from properties.");
}
}
Retry getIamPolicyRetry = clientProperties.getGetIamPolicyRetry();
if (getIamPolicyRetry != null) {
RetrySettings getIamPolicyRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), getIamPolicyRetry);
clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties.");
}
}
Retry listRetry = clientProperties.getListRetry();
if (listRetry != null) {
RetrySettings listRetrySettings =
Expand All @@ -182,6 +209,30 @@ public BackendBucketsSettings backendBucketsSettings(
LOGGER.trace("Configured method-level retry settings for list from properties.");
}
}
Retry setIamPolicyRetry = clientProperties.getSetIamPolicyRetry();
if (setIamPolicyRetry != null) {
RetrySettings setIamPolicyRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.setIamPolicySettings().getRetrySettings(), setIamPolicyRetry);
clientSettingsBuilder.setIamPolicySettings().setRetrySettings(setIamPolicyRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Configured method-level retry settings for setIamPolicy from properties.");
}
}
Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry();
if (testIamPermissionsRetry != null) {
RetrySettings testIamPermissionsRetrySettings =
RetryUtil.updateRetrySettings(
clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(),
testIamPermissionsRetry);
clientSettingsBuilder
.testIamPermissionsSettings()
.setRetrySettings(testIamPermissionsRetrySettings);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Configured method-level retry settings for testIamPermissions from properties.");
}
}
return clientSettingsBuilder.build();
}

Expand Down
Loading

0 comments on commit e9378a9

Please sign in to comment.