스케줄 구성 교체(Replace Schedule) (V2)
지정한 스케줄의 구성을 교체합니다. 필수 action과 함께 교체 후 유지할 이름, 설명, 트리거 및 실행 범위를 준비합니다. 생략한 필드를 자동 보존하는 부분 수정 요청으로 가정하지 않습니다.
사용자 범위에서는 연결된 사용자가 접근할 수 있는 리소스를 기준으로 출력 대상을 찾습니다. 사용자의 권한이 바뀌면 빌드 대상이 달라지거나 실행이 실패할 수 있으므로 프로젝트 범위를 검토합니다.
이 엔드포인트는 미리보기 기능이며 언제든 변경되거나 제거될 수 있습니다. 사용하려면 preview=true를 지정합니다.
HTTP 요청
PUT /api/v2/orchestration/schedules/{scheduleRid}
작업 식별자는 v2.replaceSchedule입니다. OAuth2로 호출하는 타사 애플리케이션에는 api:orchestration-write 권한 범위가 필요합니다. 각 요청에 Authorization: Bearer <접근 토큰>을 전달합니다.
경로 매개변수
| 이름 | 자료형 | 필수 여부 | 의미와 조건 | 예시 값 |
|---|---|---|---|---|
scheduleRid | string | 필수 | 스케줄의 RID입니다. | ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871 |
쿼리 매개변수
| 이름 | 자료형 | 필수 여부 | 의미와 조건 | 예시 값 |
|---|---|---|---|---|
preview | boolean | 선택 | 미리보기 기능 사용을 활성화합니다. | true |
요청 본문
본문 형식은 ReplaceScheduleRequest이며 필수입니다.
| 이름 | 자료형 | 필수 여부 | 의미와 조건 | 예시 값 |
|---|---|---|---|---|
displayName | string | 선택 | My Daily Schedule | |
description | string | 선택 | Run all the transforms at midnight | |
action | object | 필수 | 본문 예시 참조 | |
trigger | union | 선택 | 스케줄을 실행할 조건입니다. | 본문 예시 참조 |
scopeMode | union<project, user> | 선택 | 스케줄이 빌드할 수 있는 범위입니다. | 본문 예시 참조 |
action의 구조
모든 설정 필드와 입력의 필수 여부는 스케줄 액션을 따릅니다.
trigger의 구조
11가지 분기와 조합 조건은 트리거 참조를 따릅니다.
scopeMode의 구조
프로젝트 및 사용자 모드의 전체 필드는 실행 범위를 따릅니다.
다음은 교체할 스케줄 구성을 지정하는 요청 본문 예시입니다.
{
"displayName": "My Daily Schedule",
"description": "Run all the transforms at midnight",
"action": {
"abortOnFailure": false,
"forceBuild": false,
"retryBackoffDuration": {
"unit": "SECONDS",
"value": 30
},
"retryCount": 1,
"fallbackBranches": [],
"branchName": "master",
"notificationsEnabled": false,
"target": {
"type": "manual",
"targetRids": [
"ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e",
"ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43"
]
}
},
"trigger": {
"type": "time",
"cronExpression": "0 0 * * *",
"timeZone": "UTC"
},
"scopeMode": {
"type": "user"
}
}
응답
응답 형식은 Schedule입니다.
교체한 스케줄입니다.
전체 필드는 Schedule 모델을 따릅니다.
구성을 교체한 스케줄의 응답 예시입니다.
{
"updatedTime": "2024-09-25T17:29:35.974Z",
"paused": false,
"updatedBy": "f05f8da4-b84c-4fca-9c77-8af0b13d11de",
"createdBy": "f05f8da4-b84c-4fca-9c77-8af0b13d11de",
"displayName": "My Daily Schedule",
"currentVersionRid": "ri.scheduler.main.schedule-version.4d1eb55f-6c13-411c-a911-5d84e08d8017",
"description": "Run all the transforms at midnight",
"createdTime": "2024-09-25T17:29:35.974Z",
"action": {
"abortOnFailure": false,
"forceBuild": false,
"retryBackoffDuration": {
"unit": "SECONDS",
"value": 30
},
"retryCount": 1,
"fallbackBranches": [],
"branchName": "master",
"notificationsEnabled": false,
"target": {
"type": "manual",
"targetRids": [
"ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e",
"ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43"
]
}
},
"trigger": {
"type": "time",
"cronExpression": "0 0 * * *",
"timeZone": "UTC"
},
"rid": "ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871",
"scopeMode": {
"type": "user"
}
}
개별 오류
| 오류 이름 | 오류 코드 | HTTP | 의미와 조건 | 추가 매개변수 |
|---|---|---|---|---|
ReplaceSchedulePermissionDenied | PERMISSION_DENIED | 403 | 스케줄을 교체할 권한이 없습니다. | scheduleRid |
요청 예제
FOUNDRY_HOST에는 https://를 제외한 Foundry 호스트를, FOUNDRY_TOKEN에는 유효한 토큰을 환경 변수로 제공합니다. 예시 식별자와 매개변수 값은 실제 작업 대상에 맞게 바꿉니다.
스케줄을 UTC 자정의 사용자 범위 구성으로 교체하는 예제입니다. 실제 스케줄에 적용할 전체 구성을 준비합니다. 알림은 false로 설정되어 있습니다.
cURL
curl -X PUT \
-H "Content-type: application/json" \
-H "Authorization: Bearer ${FOUNDRY_TOKEN}" \
"https://${FOUNDRY_HOST}/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true" \
-d '{"displayName":"My Daily Schedule","description":"Run all the transforms at midnight","action":{"abortOnFailure":false,"forceBuild":false,"retryBackoffDuration":{"unit":"SECONDS","value":30},"retryCount":1,"fallbackBranches":[],"branchName":"master","notificationsEnabled":false,"target":{"type":"manual","targetRids":["ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e","ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43"]}},"trigger":{"type":"time","cronExpression":"0 0 * * *","timeZone":"UTC"},"scopeMode":{"type":"user"}}'
Python
Requests 라이브러리가 설치된 Python 환경에서 사용합니다.
import os
import requests
HOSTNAME = os.environ["FOUNDRY_HOST"]
TOKEN = os.environ["FOUNDRY_TOKEN"]
headers = {
"content-type": "application/json",
"authorization": "Bearer {}".format(TOKEN)
}
request_body = {
"displayName": "My Daily Schedule",
"description": "Run all the transforms at midnight",
"action": {
"abortOnFailure": False,
"forceBuild": False,
"retryBackoffDuration": {
"unit": "SECONDS",
"value": 30
},
"retryCount": 1,
"fallbackBranches": [],
"branchName": "master",
"notificationsEnabled": False,
"target": {
"type": "manual",
"targetRids": [
"ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e",
"ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43"
]
}
},
"trigger": {
"type": "time",
"cronExpression": "0 0 * * *",
"timeZone": "UTC"
},
"scopeMode": {
"type": "user"
}
}
response = requests.put('https://{}/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true'.format(HOSTNAME), headers=headers, json=request_body)
print(response)
Java
Apache HttpClient 4.5 API와 try-with-resources를 사용합니다. 클래스 이름에 맞는 ReplaceScheduleExample.java 파일에서 사용합니다.
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
public class ReplaceScheduleExample {
public static void main(String[] args) throws Exception {
String HOSTNAME = System.getenv("FOUNDRY_HOST");
String TOKEN = System.getenv("FOUNDRY_TOKEN");
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
HttpPut request = new HttpPut("https://" + HOSTNAME + "/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true");
request.addHeader("content-type", "application/json");
request.addHeader("authorization", String.format("Bearer %s", TOKEN));
request.setEntity(new StringEntity("{\"displayName\":\"My Daily Schedule\",\"description\":\"Run all the transforms at midnight\",\"action\":{\"abortOnFailure\":false,\"forceBuild\":false,\"retryBackoffDuration\":{\"unit\":\"SECONDS\",\"value\":30},\"retryCount\":1,\"fallbackBranches\":[],\"branchName\":\"master\",\"notificationsEnabled\":false,\"target\":{\"type\":\"manual\",\"targetRids\":[\"ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e\",\"ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43\"]}},\"trigger\":{\"type\":\"time\",\"cronExpression\":\"0 0 * * *\",\"timeZone\":\"UTC\"},\"scopeMode\":{\"type\":\"user\"}}", ContentType.APPLICATION_JSON));
try (CloseableHttpResponse response = httpClient.execute(request)) {
System.out.println(response);
}
}
}
}
JavaScript
fetch를 제공하는 Node.js 환경에서 사용합니다. 서비스 사용자 토큰을 브라우저로 전달하지 않습니다.
const HOSTNAME = process.env.FOUNDRY_HOST;
const TOKEN = process.env.FOUNDRY_TOKEN;
fetch(`https://${HOSTNAME}/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${TOKEN}`,
},
body: '{"displayName":"My Daily Schedule","description":"Run all the transforms at midnight","action":{"abortOnFailure":false,"forceBuild":false,"retryBackoffDuration":{"unit":"SECONDS","value":30},"retryCount":1,"fallbackBranches":[],"branchName":"master","notificationsEnabled":false,"target":{"type":"manual","targetRids":["ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e","ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43"]}},"trigger":{"type":"time","cronExpression":"0 0 * * *","timeZone":"UTC"},"scopeMode":{"type":"user"}}'
}).then((response) => {
console.log(response)
});
PowerShell
$ErrorActionPreference = 'Stop'
$TOKEN = $env:FOUNDRY_TOKEN
$HOSTNAME = $env:FOUNDRY_HOST
$headers = @{
"authorization" = "Bearer $TOKEN"
}
$response = Invoke-WebRequest -Uri "https://$HOSTNAME/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true" `
-Method Put `
-Headers $headers `
-ContentType application/json `
-Body "{`"displayName`":`"My Daily Schedule`",`"description`":`"Run all the transforms at midnight`",`"action`":{`"abortOnFailure`":false,`"forceBuild`":false,`"retryBackoffDuration`":{`"unit`":`"SECONDS`",`"value`":30},`"retryCount`":1,`"fallbackBranches`":[],`"branchName`":`"master`",`"notificationsEnabled`":false,`"target`":{`"type`":`"manual`",`"targetRids`":[`"ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e`",`"ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43`"]}},`"trigger`":{`"type`":`"time`",`"cronExpression`":`"0 0 * * *`",`"timeZone`":`"UTC`"},`"scopeMode`":{`"type`":`"user`"}}"
$response.content