fix: align thothctl operator envelope with the workspace-maintenance contract
This commit is contained in:
@@ -103,15 +103,15 @@ func (EvidenceRequest) operatorCommand() string { return "preprocess-evidence
|
|||||||
func (RunRequest) operatorCommand() string { return "preprocess-run" }
|
func (RunRequest) operatorCommand() string { return "preprocess-run" }
|
||||||
|
|
||||||
func (r InspectRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r InspectRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
return requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace}, nil
|
return requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r DwhRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r DwhRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
return requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace, Resume: r.Resume}, nil
|
return requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace, Resume: r.Resume}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r SuggestFksRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r SuggestFksRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
envelope := requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace, Assume: append([]string(nil), r.Assume...)}
|
envelope := requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace, Assume: append([]string(nil), r.Assume...)}
|
||||||
totalBytes := 0
|
totalBytes := 0
|
||||||
for _, path := range r.FromSQL {
|
for _, path := range r.FromSQL {
|
||||||
contents, err := safeio.ReadCanonicalUTF8(path, 1<<20)
|
contents, err := safeio.ReadCanonicalUTF8(path, 1<<20)
|
||||||
@@ -134,7 +134,6 @@ func (r CheckSchemaRequest) stdinEnvelope() (requestEnvelope, error) {
|
|||||||
}
|
}
|
||||||
return requestEnvelope{
|
return requestEnvelope{
|
||||||
SchemaVersion: 1,
|
SchemaVersion: 1,
|
||||||
Operation: r.operatorCommand(),
|
|
||||||
WorkspaceID: r.Workspace,
|
WorkspaceID: r.Workspace,
|
||||||
Annotations: annotations,
|
Annotations: annotations,
|
||||||
ReviewedCandidates: r.ReviewedCandidates,
|
ReviewedCandidates: r.ReviewedCandidates,
|
||||||
@@ -142,27 +141,26 @@ func (r CheckSchemaRequest) stdinEnvelope() (requestEnvelope, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r IndexSchemaRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r IndexSchemaRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
return requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace}, nil
|
return requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r EvidenceRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r EvidenceRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
return requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace, Resume: r.Resume, DryRun: r.DryRun}, nil
|
return requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace, Resume: r.Resume, DryRun: r.DryRun}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r RunRequest) stdinEnvelope() (requestEnvelope, error) {
|
func (r RunRequest) stdinEnvelope() (requestEnvelope, error) {
|
||||||
return requestEnvelope{SchemaVersion: 1, Operation: r.operatorCommand(), WorkspaceID: r.Workspace, Resume: r.Resume}, nil
|
return requestEnvelope{SchemaVersion: 1, WorkspaceID: r.Workspace, Resume: r.Resume}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type requestEnvelope struct {
|
type requestEnvelope struct {
|
||||||
SchemaVersion int `json:"schemaVersion"`
|
SchemaVersion int `json:"schemaVersion"`
|
||||||
Operation string `json:"operation"`
|
|
||||||
WorkspaceID string `json:"workspaceId"`
|
WorkspaceID string `json:"workspaceId"`
|
||||||
Resume string `json:"resume,omitempty"`
|
Resume string `json:"resumeRunId,omitempty"`
|
||||||
DryRun bool `json:"dryRun,omitempty"`
|
DryRun bool `json:"dryRun,omitempty"`
|
||||||
Assume []string `json:"assume,omitempty"`
|
Assume []string `json:"assume,omitempty"`
|
||||||
SQLFiles []inputFile `json:"sqlFiles,omitempty"`
|
SQLFiles []inputFile `json:"fromSql,omitempty"`
|
||||||
Annotations string `json:"annotations,omitempty"`
|
Annotations string `json:"annotationsYaml,omitempty"`
|
||||||
ReviewedCandidates string `json:"reviewedCandidates,omitempty"`
|
ReviewedCandidates string `json:"reviewedCandidatesDigest,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type inputFile struct {
|
type inputFile struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user