public static ManagedChannel fromCreds ( GoogleCredentials creds , String fields ) throws SSLException { List < ClientInterceptor > interceptors = new ArrayList ( ) ; interceptors . add ( new ClientAuthInterceptor ( creds . createScoped ( Arrays . asList ( GENOMICS_SCOPE ) ) , Executors . newSingleThreadExecutor ( ) ) ) ; if ( ! Strings . isNullOrEmpty ( fields ) ) { Metadata headers = new Metadata ( ) ; Metadata . Key < String > partialResponseHeader = Metadata . Key . of ( PARTIAL_RESPONSE_HEADER , Metadata . ASCII_STRING_MARSHALLER ) ; headers . put ( partialResponseHeader , fields ) ; interceptors . add ( MetadataUtils . newAttachHeadersInterceptor ( headers ) ) ; } return getGenomicsManagedChannel ( interceptors ) ; }
Create a new gRPC channel to the Google Genomics API using the provided credentials for auth .