(response output.ResponseInfo, wait string)
| 388 | } |
| 389 | |
| 390 | func (b CommandBuilder) evaluateWaitCondition(response output.ResponseInfo, wait string) (bool, error) { |
| 391 | body, err := io.ReadAll(response.Body) |
| 392 | if err != nil { |
| 393 | return false, nil |
| 394 | } |
| 395 | var data interface{} |
| 396 | err = json.Unmarshal(body, &data) |
| 397 | if err != nil { |
| 398 | return false, nil |
| 399 | } |
| 400 | transformer := output.NewJmesPathTransformer(wait) |
| 401 | result, err := transformer.Execute(data) |
| 402 | if err != nil { |
| 403 | return false, err |
| 404 | } |
| 405 | value, ok := result.(bool) |
| 406 | if !ok { |
| 407 | return false, errors.New("Error in wait condition: JMESPath expression needs to return boolean") |
| 408 | } |
| 409 | return value, nil |
| 410 | } |
| 411 | |
| 412 | func (b CommandBuilder) execute(ctx executor.ExecutionContext, outputFormat string, query string, outputWriter output.OutputWriter) error { |
| 413 | var wg sync.WaitGroup |
no test coverage detected