Skip to content

Partially onboard folder command (alpha) - #1737

Open
mszadkow wants to merge 2 commits into
stackitcloud:mainfrom
mszadkow:feat/add-folder-command
Open

mszadkow wants to merge 2 commits into
stackitcloud:mainfrom
mszadkow:feat/add-folder-command

Conversation

@mszadkow

@mszadkow mszadkow commented Nov 6, 2026

Copy link
Copy Markdown

Description

Partially onboard folder command as for internal purposes only folder information retrieval is required.

relates to #1736

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)

Comment thread internal/cmd/alpha/folder/list/list.go Resolved
Comment thread internal/cmd/alpha/folder/list/list.go Resolved
Comment thread internal/cmd/alpha/folder/list/list.go Resolved
Comment thread internal/cmd/alpha/folder/list/list.go Resolved
Comment thread internal/cmd/alpha/folder/list/list.go Resolved
}

func TestBuildRequest(t *testing.T) {
keyring.MockInit()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as below, use the mock client implementation from the SDK instead

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

With the keyring mock I don't know, it seems that is the way to go actually...
There is no interface and no mock for the auth, if I want to test auth.GetAuthEmail() branch

Are there any examples for alternative mocking of this path?
So far, I mimic the existing tests

@mszadkow
mszadkow force-pushed the feat/add-folder-command branch from 0f0f70c to a2c52a4 Compare November 12, 2026 16:11
@mszadkow
mszadkow marked this pull request as ready for review November 12, 2026 16:11
@mszadkow
mszadkow requested a review from a team as a code owner November 12, 2026 16:11

@rubenhoenle rubenhoenle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please test your changes on your own before the next round, none of the examples was working for me.

Example: examples.Build(
examples.NewExample(
`Get the details of the configured STACKIT folder`,
"$ stackit folder describe"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"$ stackit folder describe"),
"$ stackit alpha folder describe"),

Args: args.SingleOptionalArg(containerIdArg, utils.ValidateUUID),
Example: examples.Build(
examples.NewExample(
`Get the details of the configured STACKIT folder`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is your expected output in that case? Where do you expect to get the ID of the folder from you want describe here? 😅

I just get an error here as of now.

image

}

if containerId == "" {
containerId = globalFlags.ProjectId

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resourcemanager Project != Resourcemanager Folder 😉

"$ stackit folder describe"),
examples.NewExample(
`Get the details of a STACKIT folder by explicitly providing the container ID`,
"$ stackit folder describe xxx"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"$ stackit folder describe xxx"),
"$ stackit alpha folder describe xxx"),

"$ stackit folder describe xxx"),
examples.NewExample(
`Get the details of the configured STACKIT folder, including details of the parent resources`,
"$ stackit folder describe --include-parents"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"$ stackit folder describe --include-parents"),
"$ stackit alpha folder describe --include-parents"),

"$ stackit folder list --project-id-like xxx,yyy,zzz"),
examples.NewExample(
`List all STACKIT folders that a certain user is a member of`,
"$ stackit folder list --member example@email.com"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"$ stackit folder list --member example@email.com"),
"$ stackit alpha folder list --member example@email.com"),

_ paginate.Response[resourcemanager.ListFoldersResponseItemsInner] = listFoldersAdapterResponse{}
)

// listFoldersAdapter maps the token-based paginate API onto the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this adapter implementation isn't directly tied to your CLI subcommand implementation, please move this here: https://github.com/stackitcloud/stackit-cli/tree/65a1e7327739fd4d03584c7af3307c06ec162c5b/internal/pkg/services/resourcemanager/utils

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just create some new file in the utils package and place it there

Args: args.NoArgs,
Example: examples.Build(
examples.NewExample(
`List all STACKIT folders that are children of the configured project`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From my understanding a folder can't be a child of a project. It's the other way around.

`List all STACKIT folders that are children of a specific parent`,
"$ stackit folder list --parent-id xxx"),
examples.NewExample(
`List all STACKIT folders that match the given project IDs, located under the same parent resource`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How would a folder match a project id?

// listFoldersAdapter maps the token-based paginate API onto the
// offset/limit-based ListFolders endpoint. The page token is the
// decimal offset of the next page.
type listFoldersAdapter struct {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
type listFoldersAdapter struct {
type ListFoldersPaginationAdapter struct {

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants