솔라나 문서코드형 인프라표준 라이브러리

표준 액션

이 액션들은 표준 라이브러리의 일부로 모든 Runbook에서 사용할 수 있습니다.

send_http_request

std::send_http_request 액션은 지정된 URL로 HTTP 요청을 보냅니다.

입력

이름필수 여부타입설명
url필수string요청을 보낼 URL
method선택stringHTTP 메서드 (GET, POST, PUT, DELETE). 기본값: GET
headers선택map요청에 포함할 HTTP 헤더
body선택string요청 본문 (POST/PUT 요청용)
timeout_ms선택integer요청 타임아웃 (밀리초)

출력

이름타입설명
status_codeintegerHTTP 상태 코드
bodystring응답 본문
headersmap응답 헤더
action "api_call" "std::send_http_request" {
description = "Fetch data from API"
url = "https://api.example.com/data"
method = "GET"
headers = {
"Authorization" = "Bearer ${variable.token}"
}
}
output "response" {
value = action.api_call.body
}
output "status" {
value = action.api_call.status_code
}

POST 요청 예시

action "create_resource" "std::send_http_request" {
description = "Create a new resource"
url = "https://api.example.com/resources"
method = "POST"
headers = {
"Content-Type" = "application/json"
}
body = {
"name" = variable.name,
"value" = variable.value
}
}

Is this page helpful?

목차

페이지 편집