Skip to content

Commit

Permalink
feat(RAIN-74824): support queryLanguage when creating query
Browse files Browse the repository at this point in the history
  • Loading branch information
qdfuxiao committed Nov 6, 2023
1 parent f44bf6f commit 22edb19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions api/lql.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import (
)

type NewQuery struct {
QueryID string `json:"queryId" yaml:"queryId"`
QueryText string `json:"queryText" yaml:"queryText"`
QueryID string `json:"queryId" yaml:"queryId"`
QueryLanguage string `json:"queryLanguage" yaml:"queryLanguage"`
QueryText string `json:"queryText" yaml:"queryText"`
}

func ParseNewQuery(s string) (NewQuery, error) {
Expand Down
12 changes: 8 additions & 4 deletions api/lql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,22 @@ import (

var (
queryID = "my_lql"
lqlLanguage = "lql"
newQueryText = `my_lql { source { CloudTrailRawEvents } return { INSERT_ID } }`
newQuery = api.NewQuery{
QueryID: queryID,
QueryText: newQueryText,
QueryID: queryID,
QueryLanguage: lqlLanguage,
QueryText: newQueryText,
}
newQueryJSON = fmt.Sprintf(`{
"queryId": "%s",
"queryLanguage": "%s",
"queryText": "%s"
}`, queryID, newQueryText)
}`, queryID, lqlLanguage, newQueryText)
newQueryYAML = fmt.Sprintf(`---
queryId: %s
queryText: %s`, newQuery.QueryID, newQuery.QueryText)
queryLanguage: %s
queryText: %s`, newQuery.QueryID, newQuery.QueryLanguage, newQuery.QueryText)
lqlErrorReponse = `{ "message": "This is an error message" }`
)

Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/lql_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ import (

var (
newQuery = api.NewQuery{
QueryID: "my_lql",
QueryText: `my_lql { source { CloudTrailRawEvents } return { INSERT_ID } }`,
QueryID: "my_lql",
QueryLanguage: "lql",
QueryText: `my_lql { source { CloudTrailRawEvents } return { INSERT_ID } }`,
}
)

Expand Down

0 comments on commit 22edb19

Please sign in to comment.