From c7f15fa7f422cf93fdb34b36991f61bbc143aed4 Mon Sep 17 00:00:00 2001 From: Eray Ates Date: Sat, 17 Sep 2022 20:09:54 +0200 Subject: [PATCH] fix: rename check to client Signed-off-by: Eray Ates --- .goreleaser.yaml | 4 ++-- README.md | 4 ++-- internal/load/load.go | 16 ++++++++-------- internal/model/module.go | 4 ++-- internal/route/route.go | 2 +- testdata/ansible/roles/imagecheck/tasks/main.yml | 2 +- testdata/test.yaml | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8cc4d34..bba3d57 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -14,8 +14,8 @@ builds: - CGO_ENABLED=0 goos: - linux - # - windows - # - darwin + - windows + - darwin main: ./cmd/pong ldflags: - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} diff --git a/README.md b/README.md index 87e794e..4607064 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Give a json or yaml file with the following structure: # LogLevel is the log level, default info log_level: "debug" -check: +client: rest: - concurrent: 1 check: @@ -62,7 +62,7 @@ Example of playbook ```yaml - name: Check image exists pong: - check: + client: rest: - concurrent: 1 check: diff --git a/internal/load/load.go b/internal/load/load.go index e8313b5..be66253 100644 --- a/internal/load/load.go +++ b/internal/load/load.go @@ -41,16 +41,16 @@ func ReadConfig(file string) (*model.ModuleArgs, error) { } func defaultArgs(args *model.ModuleArgs) { - for i := range args.Check.Rest { - if args.Check.Rest[i].Concurrent == 0 { - args.Check.Rest[i].Concurrent = model.DefaultRestClient.Concurrent + for i := range args.Client.Rest { + if args.Client.Rest[i].Concurrent == 0 { + args.Client.Rest[i].Concurrent = model.DefaultRestClient.Concurrent } - for j := range args.Check.Rest[i].Check { - if args.Check.Rest[i].Check[j].Method == "" { - args.Check.Rest[i].Check[j].Method = model.DefaultRestCheck.Method + for j := range args.Client.Rest[i].Check { + if args.Client.Rest[i].Check[j].Method == "" { + args.Client.Rest[i].Check[j].Method = model.DefaultRestCheck.Method } - if args.Check.Rest[i].Check[j].Status == 0 { - args.Check.Rest[i].Check[j].Status = model.DefaultRestCheck.Status + if args.Client.Rest[i].Check[j].Status == 0 { + args.Client.Rest[i].Check[j].Status = model.DefaultRestCheck.Status } } } diff --git a/internal/model/module.go b/internal/model/module.go index 4ee4a1a..7b3751f 100644 --- a/internal/model/module.go +++ b/internal/model/module.go @@ -17,12 +17,12 @@ type RestClient struct { Check []RestCheck `json:"check" yaml:"check"` } -type Check struct { +type Client struct { Rest []RestClient `json:"rest" yaml:"rest"` } type ModuleArgs struct { - Check Check `json:"check" yaml:"check"` + Client Client `json:"client" yaml:"client"` // LogLevel is the log level, default info LogLevel string `json:"log_level" yaml:"log_level"` } diff --git a/internal/route/route.go b/internal/route/route.go index 47c9cd5..1a63c21 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -16,7 +16,7 @@ func Request(ctx context.Context, args *model.ModuleArgs) []error { // call rest requests wg.Add(1) - go RestRequest(ctx, wg, errs, args.Check.Rest) + go RestRequest(ctx, wg, errs, args.Client.Rest) wg.Wait() diff --git a/testdata/ansible/roles/imagecheck/tasks/main.yml b/testdata/ansible/roles/imagecheck/tasks/main.yml index afc9e06..84480ac 100644 --- a/testdata/ansible/roles/imagecheck/tasks/main.yml +++ b/testdata/ansible/roles/imagecheck/tasks/main.yml @@ -18,7 +18,7 @@ - name: Check image exists pong: - check: + client: rest: - concurrent: 1 check: diff --git a/testdata/test.yaml b/testdata/test.yaml index fd8e0a4..8df5c6e 100644 --- a/testdata/test.yaml +++ b/testdata/test.yaml @@ -1,5 +1,5 @@ log_level: "warn" -check: +client: rest: - concurrent: 5 check: