curl --request POST \
--url http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore \
--header 'x-api-key: <api-key>'import requests
url = "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"kind": "dataQuality",
"instruction": "<string>",
"script": "<string>",
"generatedAt": "2023-11-07T05:31:56Z",
"model": "<string>",
"modelIsCurrent": true,
"status": "ready",
"pendingReason": "<string>",
"origin": "save",
"version": 123,
"fingerprint": "<string>",
"storage": "<string>",
"repoPath": "<string>",
"commitSha": "<string>",
"drift": true,
"headSha": "<string>",
"conflict": true,
"conflictReason": "<string>"
}Restore a CodeGen script version
Makes the text of version the script the pipeline runs, through the same store path as a regenerate but with no model call: it becomes a NEW latest version (origin restore-version) and keeps the model that wrote it. A built-in script object is replaced; a repository-backed script gets a new commit. The pipeline’s definition version does not change. When the version’s text is already the live script, nothing is written (no version, no commit) and the current entry is returned with noop: true. Refused, with nothing changed, when the version was written for a different instruction or source schema than the pipeline has now, or for another script contract version (422), and when the repository file was edited since the recorded commit (409). Requires pipeline:update (agent-policy action pipeline:update:codegen-scripts). Audited as codegen-script-restore-version:<kind>.
curl --request POST \
--url http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore \
--header 'x-api-key: <api-key>'import requests
url = "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/api/v1/pipelines/{name}/codegen-scripts/{kind}/versions/{version}/restore")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"kind": "dataQuality",
"instruction": "<string>",
"script": "<string>",
"generatedAt": "2023-11-07T05:31:56Z",
"model": "<string>",
"modelIsCurrent": true,
"status": "ready",
"pendingReason": "<string>",
"origin": "save",
"version": 123,
"fingerprint": "<string>",
"storage": "<string>",
"repoPath": "<string>",
"commitSha": "<string>",
"drift": true,
"headSha": "<string>",
"conflict": true,
"conflictReason": "<string>"
}Authorizations
Optional API key for authentication (enabled via application.yaml)
Path Parameters
dataQuality, transformation Response
The script entry, now carrying the new version
A stored CodeGen script (AI data-quality rule or AI transformation).
dataQuality, transformation The CodeGen model that wrote the script.
False when the CodeGen model setting has changed since.
ready, pending How the current script was recorded. repository means an edit made in the code repository was adopted with the pull endpoint; restore means it was imported from a catalog archive; restore-version means an earlier script version was restored.
save, run, regenerate, repository, restore, restore-version Number of the live script in its version history. Absent for a script stored before script versioning (it is numbered 1 on the first change or history read).
sha-256 of the instruction and source schema the script was written for; a restore keeps the archived value.
Script store: minio for the built-in object store, github for the configured code repository.
Code repository only. Path of the script file on the configured branch: <pathPrefix>pipelines/<pipeline>/data-quality.py or .../transformation.py.
Code repository only. The commit every run executes.
True when the file at the head of the configured branch differs from the recorded commit (it was edited in the repository). Runs keep using the recorded commit until the edit is pulled. Always false for built-in storage.
Present when drift is true. The branch-head commit the pull endpoint would record.
True while a new script was not committed because the file was edited in the code repository since the recorded commit. Runs keep executing the recorded commit, without the new instruction or schema and with no model call, until the edit is pulled or the script is regenerated with overwrite=true. Present when the script has a record.
Present when conflict is true. The warning the save or regenerate returned.
