Search in sources :

Example 1 with ClusterControllerSettings

use of com.google.cloud.dataproc.v1.ClusterControllerSettings in project cdap by caskdata.

the class DataprocClient method getClusterControllerClient.

/*
   * Using the input Google Credentials retrieve the Dataproc Cluster controller client
   */
private static ClusterControllerClient getClusterControllerClient(DataprocConf conf) throws IOException {
    CredentialsProvider credentialsProvider = FixedCredentialsProvider.create(conf.getDataprocCredentials());
    String rootUrl = Optional.ofNullable(conf.getRootUrl()).orElse(ClusterControllerSettings.getDefaultEndpoint());
    String regionalEndpoint = conf.getRegion() + "-" + rootUrl;
    ClusterControllerSettings controllerSettings = ClusterControllerSettings.newBuilder().setCredentialsProvider(credentialsProvider).setEndpoint(regionalEndpoint).build();
    return ClusterControllerClient.create(controllerSettings);
}
Also used : FixedCredentialsProvider(com.google.api.gax.core.FixedCredentialsProvider) CredentialsProvider(com.google.api.gax.core.CredentialsProvider) ClusterControllerSettings(com.google.cloud.dataproc.v1.ClusterControllerSettings)

Aggregations

CredentialsProvider (com.google.api.gax.core.CredentialsProvider)1 FixedCredentialsProvider (com.google.api.gax.core.FixedCredentialsProvider)1 ClusterControllerSettings (com.google.cloud.dataproc.v1.ClusterControllerSettings)1