Class GoogleCredentialsBuilder

java.lang.Object
io.aiven.kafka.connect.gcs.GoogleCredentialsBuilder

public final class GoogleCredentialsBuilder extends Object
  • Method Details

    • build

      public static com.google.auth.oauth2.GoogleCredentials build(String credentialsPath, String credentialsJson) throws IOException
      Builds GoogleCredentials using the provided credentials path and credentials JSON.

      credentialsPath and credentialsJson are mutually exclusive. So if both are provided (are non-null), this is an error.

      If either credentialsPath or credentialsJson is provided, it's used to construct the credentials.

      If none are provided, the default GCP SDK credentials acquisition mechanism is used.

      Parameters:
      credentialsPath - the credential path, can be null.
      credentialsJson - the credential JSON string, can be null.
      Returns:
      a GoogleCredentials constructed based on the input.
      Throws:
      IOException - if some error getting the credentials happen.
      IllegalArgumentException - if both credentialsPath and credentialsJson are non-null.