Search in sources :

Example 1 with SecretManagerServiceSettings

use of com.google.cloud.secretmanager.v1.SecretManagerServiceSettings in project nomulus by google.

the class SecretManagerModule method provideSecretManagerClient.

@Provides
@Singleton
static SecretManagerClient provideSecretManagerClient(SecretManagerServiceSettings serviceSettings, @Config("projectId") String project, Retrier retrier) {
    try {
        SecretManagerServiceClient stub = SecretManagerServiceClient.create(serviceSettings);
        Runtime.getRuntime().addShutdownHook(new Thread(stub::close));
        return new SecretManagerClientImpl(project, stub, retrier);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : SecretManagerServiceClient(com.google.cloud.secretmanager.v1.SecretManagerServiceClient) IOException(java.io.IOException) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

SecretManagerServiceClient (com.google.cloud.secretmanager.v1.SecretManagerServiceClient)1 Provides (dagger.Provides)1 IOException (java.io.IOException)1 Singleton (javax.inject.Singleton)1