All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.iam.admin.v1.spring.IAMSpringAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 5.6.1-preview
Show newest version
/*
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF 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.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.iam.admin.v1.IAMClient;
import com.google.cloud.iam.admin.v1.IAMSettings;
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 IAMClient}.
 *
 * 

Provides auto-configuration for Spring Boot * *

The default instance has everything set to sensible defaults: * *

    *
  • The default transport provider is used. *
  • Credentials are acquired automatically through Application Default Credentials. *
  • Retries are configured for idempotent methods but not for non-idempotent methods. *
*/ @Generated("by google-cloud-spring-generator") @BetaApi("Autogenerated Spring autoconfiguration is not yet stable") @AutoConfiguration @AutoConfigureAfter(GcpContextAutoConfiguration.class) @ConditionalOnClass(IAMClient.class) @ConditionalOnProperty(value = "com.google.cloud.iam.admin.v1.i-a-m.enabled", matchIfMissing = true) @EnableConfigurationProperties(IAMSpringProperties.class) public class IAMSpringAutoConfiguration { private final IAMSpringProperties clientProperties; private final CredentialsProvider credentialsProvider; private static final Log LOGGER = LogFactory.getLog(IAMSpringAutoConfiguration.class); protected IAMSpringAutoConfiguration( IAMSpringProperties clientProperties, CredentialsProvider credentialsProvider) throws IOException { this.clientProperties = clientProperties; if (this.clientProperties.getCredentials().hasKey()) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Using credentials from IAM-specific configuration"); } this.credentialsProvider = ((CredentialsProvider) new DefaultCredentialsProvider(this.clientProperties)); } else { this.credentialsProvider = credentialsProvider; } } /** * Provides a default transport channel provider bean. The default is gRPC and will default to it * unless the useRest option is supported and provided to use HTTP transport instead * * @return a default transport channel provider. */ @Bean @ConditionalOnMissingBean(name = "defaultIAMTransportChannelProvider") public TransportChannelProvider defaultIAMTransportChannelProvider() { return IAMSettings.defaultTransportChannelProvider(); } /** * Provides a IAMSettings bean configured to use a DefaultCredentialsProvider and the client * library's default transport channel provider (defaultIAMTransportChannelProvider()). It also * configures the quota project ID and executor thread count, if provided through properties. * *

Retry settings are also configured from service-level and method-level properties specified * in 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); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy