Skip to content

Commit fe697cc

Browse files
committed
project creation time flag
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
1 parent cd4c0da commit fe697cc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

internal/cmd/project/list/tree.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"strings"
77
"sync"
8+
"time"
89

910
"golang.org/x/sync/errgroup"
1011

@@ -40,7 +41,8 @@ type resourceTree struct {
4041
resourceClient *resourcemanager.APIClient
4142
member string
4243

43-
projectLifecycleState *string
44+
projectLifecycleState *string
45+
projectCreationTimeAfter *time.Time
4446

4547
roots map[string]*node
4648
}
@@ -57,10 +59,11 @@ func newResourceTree(resourceClient *resourcemanager.APIClient, authClient *auth
5759
member = *model.Member
5860
}
5961
tree := &resourceTree{
60-
member: member,
61-
resourceClient: resourceClient,
62-
authClient: authClient,
63-
roots: map[string]*node{},
62+
member: member,
63+
resourceClient: resourceClient,
64+
authClient: authClient,
65+
roots: map[string]*node{},
66+
projectCreationTimeAfter: model.CreationTimeAfter,
6467
}
6568
if model.LifecycleState != "" {
6669
tree.projectLifecycleState = &model.LifecycleState
@@ -151,6 +154,9 @@ func (r *resourceTree) getNodeProjects(ctx context.Context, parent *node) error
151154
if r.projectLifecycleState != nil && *r.projectLifecycleState != strings.ToLower(string(proj.GetLifecycleState())) {
152155
return nil
153156
}
157+
if r.projectCreationTimeAfter != nil && !proj.CreationTime.After(*r.projectCreationTimeAfter) {
158+
return nil
159+
}
154160
projNode := &node{
155161
resourceID: proj.GetProjectId(),
156162
typ: resourceTypeProject,

0 commit comments

Comments
 (0)