@@ -21,12 +21,12 @@ import (
21
21
//go:generate mockgen -destination=../mocks/mock_projects.go -package=mocks github.com/mongodb/atlas-cli-plugin-kubernetes/internal/store ProjectLister,ProjectCreator,ProjectDescriber,ProjectTeamLister,OrgProjectLister
22
22
23
23
type ProjectLister interface {
24
- Projects (* ListOptions ) (* atlasv2.PaginatedAtlasGroup , error )
24
+ Projects () (* atlasv2.PaginatedAtlasGroup , error )
25
25
}
26
26
27
27
type OrgProjectLister interface {
28
28
ProjectLister
29
- GetOrgProjects (string , * ListOptions ) (* atlasv2.PaginatedAtlasGroup , error )
29
+ GetOrgProjects (string ) (* atlasv2.PaginatedAtlasGroup , error )
30
30
}
31
31
32
32
type ProjectCreator interface {
@@ -39,25 +39,19 @@ type ProjectDescriber interface {
39
39
}
40
40
41
41
type ProjectTeamLister interface {
42
- ProjectTeams (string , * ListOptions ) (* atlasv2.PaginatedTeamRole , error )
42
+ ProjectTeams (string ) (* atlasv2.PaginatedTeamRole , error )
43
43
}
44
44
45
45
// Projects encapsulates the logic to manage different cloud providers.
46
- func (s * Store ) Projects (opts * ListOptions ) (* atlasv2.PaginatedAtlasGroup , error ) {
47
- res := s .clientv2 .ProjectsApi .ListProjects (s .ctx )
48
- if opts != nil {
49
- res = res .PageNum (opts .PageNum ).ItemsPerPage (fixPageSize (opts .ItemsPerPage ))
50
- }
46
+ func (s * Store ) Projects () (* atlasv2.PaginatedAtlasGroup , error ) {
47
+ res := s .clientv2 .ProjectsApi .ListProjects (s .ctx ).ItemsPerPage (1 )
51
48
result , _ , err := res .Execute ()
52
49
return result , err
53
50
}
54
51
55
52
// GetOrgProjects encapsulates the logic to manage different cloud providers.
56
- func (s * Store ) GetOrgProjects (orgID string , opts * ListOptions ) (* atlasv2.PaginatedAtlasGroup , error ) {
57
- res := s .clientv2 .OrganizationsApi .ListOrganizationProjects (s .ctx , orgID )
58
- if opts != nil {
59
- res = res .PageNum (opts .PageNum ).ItemsPerPage (fixPageSize (opts .ItemsPerPage ))
60
- }
53
+ func (s * Store ) GetOrgProjects (orgID string ) (* atlasv2.PaginatedAtlasGroup , error ) {
54
+ res := s .clientv2 .OrganizationsApi .ListOrganizationProjects (s .ctx , orgID ).ItemsPerPage (1 )
61
55
result , _ , err := res .Execute ()
62
56
return result , err
63
57
}
@@ -80,24 +74,8 @@ func (s *Store) CreateProject(params *atlasv2.CreateProjectApiParams) (*atlasv2.
80
74
}
81
75
82
76
// ProjectTeams encapsulates the logic to manage different cloud providers.
83
- func (s * Store ) ProjectTeams (projectID string , opts * ListOptions ) (* atlasv2.PaginatedTeamRole , error ) {
84
- res := s .clientv2 .TeamsApi .
85
- ListProjectTeams (s .ctx , projectID )
86
-
87
- if opts != nil {
88
- res .
89
- IncludeCount (opts .IncludeCount ).
90
- PageNum (opts .PageNum ).
91
- ItemsPerPage (fixPageSize (opts .ItemsPerPage ))
92
- }
93
-
77
+ func (s * Store ) ProjectTeams (projectID string ) (* atlasv2.PaginatedTeamRole , error ) {
78
+ res := s .clientv2 .TeamsApi .ListProjectTeams (s .ctx , projectID ).ItemsPerPage (1 )
94
79
result , _ , err := res .Execute ()
95
80
return result , err
96
81
}
97
-
98
- func fixPageSize (itemsPerPage int ) int {
99
- if itemsPerPage < 1 {
100
- return MaxAPIPageSize
101
- }
102
- return itemsPerPage
103
- }
0 commit comments