Skip to content

Commit

Permalink
Add Header provider to Google Batch client
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Jan 31, 2023
1 parent a7282d6 commit 2097992
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package nextflow.cloud.google.batch.client

import com.google.api.gax.core.CredentialsProvider
import com.google.api.gax.rpc.FixedHeaderProvider
import com.google.auth.Credentials
import com.google.cloud.batch.v1.BatchServiceClient
import com.google.cloud.batch.v1.BatchServiceSettings
Expand Down Expand Up @@ -64,7 +65,12 @@ class BatchClient {
final provider = createCredentialsProvider(config)
if( provider ) {
log.debug "[GOOGLE BATCH] Creating service client with config credentials"
final settings = BatchServiceSettings.newBuilder().setCredentialsProvider(provider).build()
final userAgent = FixedHeaderProvider.create('user-agent', 'Nextflow')
final settings = BatchServiceSettings
.newBuilder()
.setHeaderProvider(userAgent)
.setCredentialsProvider(provider)
.build()
return BatchServiceClient.create(settings)
}
else {
Expand Down

0 comments on commit 2097992

Please sign in to comment.