Search in sources :

Example 11 with CallCredentials

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.CallCredentials in project spring-cloud-gcp by spring-cloud.

the class FirestoreIntegrationTestsConfiguration method firestoreStub.

@Bean
FirestoreGrpc.FirestoreStub firestoreStub() throws IOException {
    GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();
    CallCredentials callCredentials = MoreCallCredentials.from(credentials);
    // Create a channel
    ManagedChannel channel = ManagedChannelBuilder.forTarget("dns:///firestore.googleapis.com:443").build();
    return FirestoreGrpc.newStub(channel).withCallCredentials(callCredentials);
}
Also used : GoogleCredentials(com.google.auth.oauth2.GoogleCredentials) ManagedChannel(io.grpc.ManagedChannel) CallCredentials(io.grpc.CallCredentials) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

CallCredentials (io.grpc.CallCredentials)10 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)4 Test (org.junit.Test)4 Credentials (com.google.auth.Credentials)3 MoreCallCredentials (io.grpc.auth.MoreCallCredentials)3 AccessToken (com.google.auth.oauth2.AccessToken)2 OAuth2Credentials (com.google.auth.oauth2.OAuth2Credentials)2 ServiceAccountCredentials (com.google.auth.oauth2.ServiceAccountCredentials)2 ManagedChannel (io.grpc.ManagedChannel)2 Metadata (io.grpc.Metadata)2 Status (io.grpc.Status)2 Date (java.util.Date)2 Function (com.google.common.base.Function)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 MoreExecutors.directExecutor (com.google.common.util.concurrent.MoreExecutors.directExecutor)1 SubscriberFutureStub (com.google.pubsub.v1.SubscriberGrpc.SubscriberFutureStub)1 Attributes (io.grpc.Attributes)1 ChannelCredentials (io.grpc.ChannelCredentials)1 CompositeChannelCredentials (io.grpc.CompositeChannelCredentials)1 MethodDescriptor (io.grpc.MethodDescriptor)1