use of com.thoughtworks.go.apiv1.pipelineoperations.exceptions.InvalidGoCipherTextException in project gocd by gocd.
the class EnvrionmentVariableRepresenter method fromJSON.
public static EnvironmentVariableConfig fromJSON(JsonReader jsonReader) {
String name = jsonReader.getString("name");
Boolean secure = jsonReader.optBoolean("secure").orElse(false);
String value = secure ? jsonReader.optString("value").orElse(null) : jsonReader.getString("value");
String encryptedValue = jsonReader.optString("encrypted_value").orElse(null);
try {
EnvironmentVariableConfig environmentVariableConfig = new EnvironmentVariableConfig();
environmentVariableConfig.deserialize(name, value, secure, encryptedValue);
return environmentVariableConfig;
} catch (InvalidCipherTextException e) {
throw new InvalidGoCipherTextException(e.getMessage(), e);
}
}
Aggregations