From b788d79f0845cd9f5a78777541b3b70ce1e08af4 Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Fri, 21 Jun 2024 20:52:56 +0200 Subject: [PATCH] feat: add validation helper --- go/action_kit_test/CHANGELOG.md | 4 ++++ go/action_kit_test/validate/validate.go | 27 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 go/action_kit_test/validate/validate.go diff --git a/go/action_kit_test/CHANGELOG.md b/go/action_kit_test/CHANGELOG.md index ddfa2c1..a670940 100644 --- a/go/action_kit_test/CHANGELOG.md +++ b/go/action_kit_test/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.2.15 + +- Add endpoint validation helper + ## 1.2.14 - Fix: Nil pointer deref diff --git a/go/action_kit_test/validate/validate.go b/go/action_kit_test/validate/validate.go new file mode 100644 index 0000000..faaefce --- /dev/null +++ b/go/action_kit_test/validate/validate.go @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +// SPDX-FileCopyrightText: 2024 Steadybit GmbH + +package validate + +import ( + "errors" + "github.com/go-resty/resty/v2" + "github.com/steadybit/action-kit/go/action_kit_test/client" +) + +func ValidateEndpointReferences(path string, restyClient *resty.Client) error { + c := client.NewActionClient(path, restyClient) + var allErr []error + + list, err := c.ListActions() + if err != nil { + allErr = append(allErr, err) + } + + for _, action := range list.Actions { + _, err := c.DescribeAction(action) + allErr = append(allErr, err) + } + + return errors.Join(allErr...) +}