예약된 쿼리 수정
기존 예약된 쿼리를 수정합니다. 이 작업은 관리자 권한을 요구합니다.
HTTP 요청
PUT /api/sonar/scheduled-queries/:guid
cURL 예시
curl -H "Authorization: Bearer <API_KEY>" \
-d name="test" \
-d query="table duration=1m sonar_cpu_logs | search idle <= 10" \
-d type="cron" \
-d cron_schedule="* * * * *" \
-X PUT https://HOSTNAME/api/sonar/scheduled-queries/95e17283-1d08-44f0-bac7-b734813d2dcd
요청 매개변수
경로 매개변수
| 키 | 타입 | 설명 | 비고 |
|---|---|---|---|
| guid | 문자열 | 예약된 쿼리 GUID |
요청 본문 매개변수
| 키 | 필수 | 타입 | 설명 | 비고 |
|---|---|---|---|---|
| name | O | 문자열 | 이름 | 최대 255자 |
| description | X | 문자열 | 설명 | 최대 2,000자 |
| enabled | X | 불리언 | 활성화 여부 | 기본값: false |
| query | O | 문자열 | 쿼리문 | |
| trigger_type | O | 문자열 | 실행 방식 | cron(예약 실행)과 workflow(다른 쿼리의 결과에 따라 실행) 중 선택 |
| cron_schedule | O | 문자열 | 실행 조건 | trigger_type이 cron일 때 필수 |
| preceding_guid | X | 문자열 | 선행 예약된 쿼리의 GUID | trigger_type이 workflow일 때 필수 |
| preceding_action | X | 문자열 | 선행 예약된 쿼리의 실행 상태 | trigger_type이 workflow일 때 succeeded, failed, finished 중 하나 지정 |
| node_types | X | 문자열 목록 | 실행 위치 | control(분석 노드) 또는 data(수집 노드)를 쉼표(,)로 구분하여 기입 |
| output_parameter | X | 불리언 | 매개변수 출력 제어 | 기본값: false |
정상 응답
{}
오류 응답
필수 매개변수 값이 없는 경우
HTTP 상태코드 400 응답
{
"error_code": "null-argument",
"error_msg": "name should be not null"
}
매개변수 값 길이가 긴 경우
HTTP 상태코드 400 응답
{
"error_code": "invalid-argument",
"error_msg": "'name' must be shorter than or equal to 255 characters."
}
같은 이름의 예약 쿼리가 있는 경우
HTTP 상태코드 500 응답
{
"error_code": "illegal-state",
"error_msg": "duplicated name: test"
}
trigger_type이 cron일 때, cron_schedule에 값이 없는 경우
HTTP 상태코드 400 응답
{
"error_code": "null-argument",
"error_msg": "cron_schedule should be not null"
}
trigger_type이 workflow일 때, preceding_action에 값이 없는 경우
HTTP 상태코드 400 응답
{
"error_code": "null-argument",
"error_msg": "preceding_action should be not null"
}
trigger_type이 workflow일 때, preceding_action에 허용되지 않은 값이 입력 된 경우
HTTP 상태코드 400 응답
{
"error_code": "invalid-argument",
"error_msg": "preceding_action value must be one of 'finished', 'succeeded', 'failed'."
}
관리자 권한이 아닌 경우
HTTP 상태코드 500 응답
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}