Skip to content

refac(cdn): Migrate to new SDK structure#1421

Open
Fyusel wants to merge 1 commit into
mainfrom
migrate-cdn-to-new-sdk-struct
Open

refac(cdn): Migrate to new SDK structure#1421
Fyusel wants to merge 1 commit into
mainfrom
migrate-cdn-to-new-sdk-struct

Conversation

@Fyusel
Copy link
Copy Markdown
Contributor

@Fyusel Fyusel commented May 27, 2026

STACKITCLI-356

Description

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)

@Fyusel Fyusel requested a review from a team as a code owner May 27, 2026 10:19
STACKITCLI-356

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
@Fyusel Fyusel force-pushed the migrate-cdn-to-new-sdk-struct branch from 9711742 to c5bf0f4 Compare May 27, 2026 10:56
@github-actions
Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create 82.61% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete 27.59% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe 88.89% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list 81.16% (+0.56%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update 85.07% (ø)
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/create/create.go 82.61% (ø) 115 95 20
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/delete/delete.go 27.59% (ø) 29 8 21
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/describe/describe.go 88.89% (ø) 117 104 13
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/list/list.go 81.16% (+0.56%) 69 (+2) 56 (+2) 13 👍
github.com/stackitcloud/stackit-cli/internal/cmd/beta/cdn/distribution/update/update.go 85.07% (ø) 134 114 20
github.com/stackitcloud/stackit-cli/internal/pkg/services/cdn/client/client.go 0.00% (ø) 1 0 1

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

--monthly-limit-bytes int Monthly limit in bytes for the CDN distribution
--optimizer Enable optimizer for the CDN distribution (paid feature).
--regions strings Regions in which content should be cached, multiple of: ["EU" "US" "AF" "SA" "ASIA"] (default [])
--regions strings Regions in which content should be cached, multiple of: ["EU" "US" "AF" "SA" "ASIA" "unknown_default_open_api"] (default [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need a helper function, what avoids that the fallback enum is part of the input flag and description. Similar like this in Terraform

https://github.com/stackitcloud/terraform-provider-stackit/blob/d28e06e85538cf7b4e756f22b0cc8a71cb8391af/stackit/internal/utils/utils.go#L142-L152

cdn "github.com/stackitcloud/stackit-sdk-go/services/cdn/v1api"

"github.com/stackitcloud/stackit-cli/internal/pkg/config"
genericclient "github.com/stackitcloud/stackit-cli/internal/pkg/generic-client"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't add a comment in the correct line here, but in the ConfigureClient, the useRegion param needs to be set from true to false. Otherwise the commands won't work

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.

2 participants