Skip to content

Conversation

@cgoetz-inovex
Copy link
Contributor

@cgoetz-inovex cgoetz-inovex commented Nov 19, 2025

Description

Issue: STACKITCLI-70

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@cgoetz-inovex cgoetz-inovex requested a review from a team as a code owner November 19, 2025 16:39
@rubenhoenle
Copy link
Member

Btw, please always add the Jira issue ID to your PR description if possible :)

cgoetz-inovex and others added 2 commits December 5, 2025 15:44
- replace single char names with more descriptive ones
- remove predefined mod functions
- deduplicate ParseOriginRequestHeaders and test it
- deduplicate ParseGeofencing and test it
- add test FlagTo* funcs
@github-actions
Copy link

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions
Copy link

Merging this branch changes the coverage (1 decrease, 10 increase)

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create 74.38% (+74.38%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete 26.67% (+26.67%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe 88.79% (+88.79%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list 80.60% (+80.60%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update 77.86% (+77.86%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/config/set 90.08% (+0.23%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/config/unset 35.34% (-0.05%) 👎
github.com/stackitcloud/stackit-cli/internal/pkg/config 71.48% (+0.11%) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/flags 59.15% (+0.86%) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils 81.82% (+81.82%) 🌟
github.com/stackitcloud/stackit-cli/internal/pkg/testutils 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/utils 59.79% (+2.65%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/beta.go 0.00% (ø) 8 (+1) 0 8 (+1)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/cdn.go 0.00% (ø) 4 (+4) 0 4 (+4)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create/create.go 74.38% (+74.38%) 121 (+121) 90 (+90) 31 (+31) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete/delete.go 26.67% (+26.67%) 30 (+30) 8 (+8) 22 (+22) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe/describe.go 88.79% (+88.79%) 116 (+116) 103 (+103) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/distribution.go 0.00% (ø) 8 (+8) 0 8 (+8)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list/list.go 80.60% (+80.60%) 67 (+67) 54 (+54) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update/update.go 77.86% (+77.86%) 140 (+140) 109 (+109) 31 (+31) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/config/set/set.go 90.08% (+0.23%) 131 (+3) 118 (+3) 13 👍
github.com/stackitcloud/stackit-cli/internal/cmd/config/unset/unset.go 35.34% (-0.05%) 116 (+3) 41 (+1) 75 (+2) 👎
github.com/stackitcloud/stackit-cli/internal/pkg/config/config.go 90.48% (+0.15%) 63 (+1) 57 (+1) 6 👍
github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value.go 25.81% (+8.08%) 93 (+14) 24 (+10) 69 (+4) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client/client.go 0.00% (ø) 1 (+1) 0 1 (+1)
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils/utils.go 81.82% (+81.82%) 22 (+22) 18 (+18) 4 (+4) 🌟
github.com/stackitcloud/stackit-cli/internal/pkg/testutils/testutils.go 0.00% (ø) 54 (+10) 0 54 (+10)
github.com/stackitcloud/stackit-cli/internal/pkg/utils/strings.go 58.62% (+10.79%) 29 (+6) 17 (+6) 12 🎉

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update/update_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/config/unset/unset_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils/utils_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/utils/strings_test.go

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Merging this branch changes the coverage (1 decrease, 10 increase)

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create 74.38% (+74.38%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete 26.67% (+26.67%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe 88.89% (+88.89%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list 80.60% (+80.60%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update 77.86% (+77.86%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/config/set 90.30% (+0.22%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/config/unset 35.29% (-0.05%) 👎
github.com/stackitcloud/stackit-cli/internal/pkg/config 71.48% (+0.11%) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/flags 59.15% (+0.86%) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils 81.82% (+81.82%) 🌟
github.com/stackitcloud/stackit-cli/internal/pkg/testutils 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/utils 61.39% (+4.24%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/beta.go 0.00% (ø) 9 (+1) 0 9 (+1)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/cdn.go 0.00% (ø) 4 (+4) 0 4 (+4)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create/create.go 74.38% (+74.38%) 121 (+121) 90 (+90) 31 (+31) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete/delete.go 26.67% (+26.67%) 30 (+30) 8 (+8) 22 (+22) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe/describe.go 88.89% (+88.89%) 117 (+117) 104 (+104) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/distribution.go 0.00% (ø) 8 (+8) 0 8 (+8)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list/list.go 80.60% (+80.60%) 67 (+67) 54 (+54) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update/update.go 77.86% (+77.86%) 140 (+140) 109 (+109) 31 (+31) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/config/set/set.go 90.30% (+0.22%) 134 (+3) 121 (+3) 13 👍
github.com/stackitcloud/stackit-cli/internal/cmd/config/unset/unset.go 35.29% (-0.05%) 119 (+3) 42 (+1) 77 (+2) 👎
github.com/stackitcloud/stackit-cli/internal/pkg/config/config.go 90.48% (+0.15%) 63 (+1) 57 (+1) 6 👍
github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value.go 25.81% (+8.08%) 93 (+14) 24 (+10) 69 (+4) 👍
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client/client.go 0.00% (ø) 1 (+1) 0 1 (+1)
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils/utils.go 81.82% (+81.82%) 22 (+22) 18 (+18) 4 (+4) 🌟
github.com/stackitcloud/stackit-cli/internal/pkg/testutils/testutils.go 0.00% (ø) 60 (+9) 0 60 (+9)
github.com/stackitcloud/stackit-cli/internal/pkg/utils/strings.go 63.64% (+15.81%) 33 (+10) 21 (+10) 12 🎉

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create/create_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete/delete_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update/update_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/config/unset/unset_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/flags/flag_to_value_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/utils/utils_test.go
  • github.com/stackitcloud/stackit-cli/internal/pkg/utils/strings_test.go

table.AddSeparator()
table.AddRow("OPTIMIZER ENABLED", optimizerEnabled)
table.AddSeparator()
// TODO config has yet another WAF block, left it out because the docs say to use the WAF block at the top level to determine enabled rules. There's also mode and type fields here, both left out.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open TODO

return err
}
if model.Bucket != nil {
pw, err := params.Printer.PromptForPassword("enter your secret access key for the object storage bucket: ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work with scripts? Could you add an example please which shows this use-case? 😅

return fmt.Errorf("create distribution response is nil")
}
return p.OutputResult(outputFormat, resp, func() error {
p.Outputf("Created CDN distribution for %q. Id: %s\n", projectLabel, utils.PtrString(resp.Distribution.Id))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p.Outputf("Created CDN distribution for %q. Id: %s\n", projectLabel, utils.PtrString(resp.Distribution.Id))
p.Outputf("Created CDN distribution for %q. ID: %s\n", projectLabel, utils.PtrString(resp.Distribution.Id))
image

During the update it's upper-case. Please stay consistent within your implementation 😅

return fmt.Errorf("delete loadbalancer: %w", err)
}

params.Printer.Outputf("CDN distribution %q deleted.", model.DistributionID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get some weird % at the end of the output when testing this.

image

And in addition, it's possible to delete non-existent distributions. I just took some random uuid from https://www.uuidgenerator.net/ and got the message that the distribution was deleted. I would expect an HTTP 404 error in that case from the API. Could you check this please with the service team?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants