Skip to content

onboard sfs project lock command#1397

Open
GokceGK wants to merge 6 commits intomainfrom
gg/onboard-sfs-project-lock
Open

onboard sfs project lock command#1397
GokceGK wants to merge 6 commits intomainfrom
gg/onboard-sfs-project-lock

Conversation

@GokceGK
Copy link
Copy Markdown
Contributor

@GokceGK GokceGK commented May 4, 2026

Description

relates to STACKITCLI-381

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)

@GokceGK GokceGK requested a review from a team as a code owner May 4, 2026 07:09
Comment thread docs/stackit_beta_sfs.md
Comment thread internal/cmd/beta/sfs/project-lock/describe/describe.go Outdated
if err != nil {
oapiErr, _ := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
if oapiErr.StatusCode == http.StatusNotFound {
fmt.Printf("No active lock found for project %s\n", projectLabel)
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.

In case someone sets the output format yaml or json, it will be ignored in this output.
And avoid using fmt.Print and use instead our params.Printer

Comment thread internal/cmd/beta/sfs/project-lock/unlock/unlock.go Outdated
Comment thread internal/cmd/beta/sfs/project-lock/lock/lock.go Outdated
Comment on lines +66 to +67
if err != nil {
return fmt.Errorf("enable SFS project lock: %w", err)
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.

In case some executes this lock command on a project which has already a lock, the API responds with 409. I would suggest to catch it here, similar like you did it in the describe command with the 404

GokceGK and others added 4 commits May 5, 2026 15:48
Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com>
Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/export-policy/create 52.94% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/export-policy/delete 30.30% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/describe 44.19% (+44.19%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/lock 35.71% (+35.71%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/unlock 31.25% (+31.25%) 🌟

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/export-policy/create/create.go 52.94% (ø) 51 27 24
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/export-policy/delete/delete.go 30.30% (ø) 33 10 23
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/describe/describe.go 44.19% (+44.19%) 43 (+43) 19 (+19) 24 (+24) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/lock/lock.go 35.71% (+35.71%) 42 (+42) 15 (+15) 27 (+27) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/project-lock.go 0.00% (ø) 6 (+6) 0 6 (+6)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/unlock/unlock.go 31.25% (+31.25%) 32 (+32) 10 (+10) 22 (+22) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/sfs.go 0.00% (ø) 9 (+1) 0 9 (+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/sfs/project-lock/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/lock/lock_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/sfs/project-lock/unlock/unlock_test.go

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