mirror of
https://github.com/kubevela/kubevela.git
synced 2026-07-28 18:01:24 +00:00
Fix: Fixes the request workflowstep (#6804)
* Fix: Fixes the request workflowstep Signed-off-by: Brian Kane <briankane1@gmail.com> * Fix: Fixes the request workflowstep Signed-off-by: Brian Kane <briankane1@gmail.com> --------- Signed-off-by: Brian Kane <briankane1@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@ apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
custom.definition.oam.dev/category: External Intergration
|
||||
custom.definition.oam.dev/category: External Integration
|
||||
definition.oam.dev/alias: ""
|
||||
definition.oam.dev/description: Send request to the url
|
||||
name: request
|
||||
@@ -14,8 +14,8 @@ spec:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
"vela/http"
|
||||
"vela/builtin"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
@@ -33,14 +33,22 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
fail: {
|
||||
if http.$returns.response.statusCode > 400 {
|
||||
requestFail: builtin.#Fail & {
|
||||
$params: message: "request of \(parameter.url) is fail: \(http.response.statusCode)"
|
||||
|
||||
wait: op.#ConditionalWait & {
|
||||
continue: req.$returns != _|_
|
||||
message?: "Waiting for response from \(parameter.url)"
|
||||
}
|
||||
|
||||
fail: op.#Steps & {
|
||||
if req.$returns.statusCode > 400 {
|
||||
requestFail: op.#Fail & {
|
||||
message: "request of \(parameter.url) is fail: \(req.$returns.statusCode)"
|
||||
}
|
||||
}
|
||||
}
|
||||
response: json.Unmarshal(http.$returns.response.body)
|
||||
|
||||
response: json.Unmarshal(req.$returns.body)
|
||||
|
||||
parameter: {
|
||||
url: string
|
||||
method: *"GET" | "POST" | "PUT" | "DELETE"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import (
|
||||
"vela/op"
|
||||
"vela/http"
|
||||
"vela/builtin"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ request: {
|
||||
attributes: {}
|
||||
description: "Send request to the url"
|
||||
annotations: {
|
||||
"category": "External Intergration"
|
||||
"category": "External Integration"
|
||||
}
|
||||
labels: {}
|
||||
type: "workflow-step"
|
||||
@@ -30,14 +30,22 @@ template: {
|
||||
}
|
||||
}
|
||||
}
|
||||
fail: {
|
||||
if http.$returns.response.statusCode > 400 {
|
||||
requestFail: builtin.#Fail & {
|
||||
$params: message: "request of \(parameter.url) is fail: \(http.response.statusCode)"
|
||||
|
||||
wait: op.#ConditionalWait & {
|
||||
continue: req.$returns != _|_
|
||||
message?: "Waiting for response from \(parameter.url)"
|
||||
}
|
||||
|
||||
fail: op.#Steps & {
|
||||
if req.$returns.statusCode > 400 {
|
||||
requestFail: op.#Fail & {
|
||||
message: "request of \(parameter.url) is fail: \(req.$returns.statusCode)"
|
||||
}
|
||||
}
|
||||
}
|
||||
response: json.Unmarshal(http.$returns.response.body)
|
||||
|
||||
response: json.Unmarshal(req.$returns.body)
|
||||
|
||||
parameter: {
|
||||
url: string
|
||||
method: *"GET" | "POST" | "PUT" | "DELETE"
|
||||
|
||||
Reference in New Issue
Block a user