> +
> +   private GoogleComputeEngineCredentialSupplierFromJson(String jsonString){
> +      creds = parseJsonKeyString(jsonString);
> +   }
> +
> +   /**
> +    * Function for parsing JSON Key file downloaded from GCP developers 
> console.
> +    *
> +    * @param pathToJsonFile.
> +    * @return Credentials object with Credentials.identity and 
> Credentials.credential correctly set.
> +    */
> +   public static Credentials parseJsonKeyString(String jsonString) {
> +      // Parse JsonFile to extract Service Account and PrivateKey.
> +      final JsonObject json = new 
> JsonParser().parse(jsonString).getAsJsonObject();
> +      String client_email = 
> json.get("client_email").toString().replace("\"", "");
> +      String private_key = 
> StringEscapeUtils.unescapeJava(json.get("private_key").toString().replace("\"",
>  ""));

Out of curiosity: is the `unescapeJava` needed here but not when parsing the 
client email?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/124/files#r23723454

Reply via email to