In [ ]:
./bin/spark-shell --packages alvsanand:spark-generic-connector:0.2.0-spark_2x-s_2.11
In [ ]:
import es.alvsanand.sgc.google.GoogleHelper
In [ ]:
val json = """{
"type": "service_account",
"project_id": "XXX",
"private_key_id": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY",
"private_key": "-----BEGIN PRIVATE KEY-----........................-----END PRIVATE KEY-----\n",
"client_email": "XXX@appspot.gserviceaccount.com",
"client_id": "ZZZZZZZZZZZZZZZZZZZZZ",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/XXX%40appspot.gserviceaccount.com"
}"""
In [ ]:
val credentialsZipUrl = "/var/lib/gdc/credentials.zip"
In [ ]:
val credentialsZipUrl = "hdfs://127.0.0.1:8020/var/lib/gdc/credentials.zip"
In [ ]:
val result = GoogleHelper.createCredentialsZip(json, credentialsZipUrl)
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=XXX-XXX.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/devstorage.read_only%20https://www.googleapis.com/auth/cloud-platform.read-only%20https://www.googleapis.com/auth/devstorage.full_control%20https://www.googleapis.com/auth/cloud-platform%20https://www.googleapis.com/auth/devstorage.read_write
Attempting to open that address in the default browser now...
Please enter code: Created new window in existing browser session.
In [ ]:
if (result.isFailute) {
println("Error creating credentials zip")
}
else {
println(s"Created credentials zip[$credentialsZipUrl]")
}