From 386c676b8eec027ce615c25936918863328081b4 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 11 Mar 2024 11:26:45 +0000 Subject: [PATCH 1/2] CLOUDP-236543: Disable e2e_local_deployments --- build/ci/evergreen.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/build/ci/evergreen.yml b/build/ci/evergreen.yml index f30fc503a8..007f6c2373 100644 --- a/build/ci/evergreen.yml +++ b/build/ci/evergreen.yml @@ -1280,13 +1280,14 @@ buildvariants: <<: *go_linux_version tasks: - name: ".e2e .deployments .atlas" - - name: e2e_local_deployments - display_name: "E2E Local Deployments Tests" - run_on: - - rhel80-small - expansions: - <<: *go_linux_version - tasks: - - name: ".e2e .deployments .local" +# This variant will be enabled in CLOUDP-237038 +# - name: e2e_local_deployments +# display_name: "E2E Local Deployments Tests" +# run_on: +# - rhel80-small +# expansions: +# <<: *go_linux_version +# tasks: +# - name: ".e2e .deployments .local" include: - filename: build/ci/release.yml From 72c83581d926a1713592fddf9d5d27a1e9d46118 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 11 Mar 2024 19:39:44 +0000 Subject: [PATCH 2/2] CLOUDP-222791: [CLI] expose "include total" on paginated commands - Part 2 --- ...-organizations-apiKeys-accessLists-list.txt | 4 ++++ .../atlas-organizations-apiKeys-list.txt | 4 ++++ docs/command/atlas-organizations-list.txt | 4 ++++ .../command/atlas-organizations-users-list.txt | 4 ++++ docs/command/atlas-processes-list.txt | 4 ++++ docs/command/atlas-projects-apiKeys-list.txt | 4 ++++ docs/command/atlas-projects-list.txt | 4 ++++ docs/command/atlas-projects-teams-list.txt | 4 ++++ docs/command/atlas-projects-users-list.txt | 4 ++++ .../atlas-serverless-backups-restores-list.txt | 4 ++++ ...atlas-serverless-backups-snapshots-list.txt | 4 ++++ docs/command/atlas-serverless-list.txt | 4 ++++ docs/command/atlas-teams-list.txt | 4 ++++ .../organizations/apikeys/accesslists/list.go | 2 ++ .../apikeys/accesslists/list_test.go | 3 ++- .../cli/atlas/organizations/apikeys/list.go | 1 + .../atlas/organizations/apikeys/list_test.go | 10 ++++++++++ internal/cli/atlas/organizations/list.go | 8 +++++--- internal/cli/atlas/organizations/list_test.go | 10 ++++++++++ internal/cli/atlas/organizations/users/list.go | 1 + .../cli/atlas/organizations/users/list_test.go | 1 + .../privateendpoints/datalake/aws/list.go | 2 ++ .../privateendpoints/datalake/aws/list_test.go | 2 +- internal/cli/atlas/processes/list.go | 5 +++++ internal/cli/atlas/processes/list_test.go | 6 ++++-- internal/cli/atlas/projects/apikeys/list.go | 1 + .../cli/atlas/projects/apikeys/list_test.go | 10 ++++++++++ internal/cli/atlas/projects/list.go | 1 + internal/cli/atlas/projects/list_test.go | 11 +++++++++++ internal/cli/atlas/projects/teams/list.go | 3 ++- internal/cli/atlas/projects/teams/list_test.go | 16 ++++++++++++++-- internal/cli/atlas/projects/users/list.go | 1 + internal/cli/atlas/projects/users/list_test.go | 10 ++++++++++ .../atlas/serverless/backup/restores/list.go | 1 + .../serverless/backup/restores/list_test.go | 1 + .../atlas/serverless/backup/snapshots/list.go | 1 + .../serverless/backup/snapshots/list_test.go | 10 ++++++++++ internal/cli/atlas/serverless/list.go | 1 + internal/cli/atlas/serverless/list_test.go | 2 +- internal/cli/atlas/teams/list.go | 1 + internal/cli/atlas/teams/list_test.go | 10 ++++++++++ .../kubernetes/operator/project/project.go | 2 +- .../operator/project/project_test.go | 2 +- internal/mocks/mock_atlas_generic_store.go | 8 ++++---- .../mocks/mock_atlas_operator_project_store.go | 8 ++++---- internal/mocks/mock_projects.go | 8 ++++---- internal/store/api_keys.go | 4 ++-- .../store/cloud_provider_backup_serverless.go | 4 ++-- internal/store/projects.go | 18 ++++++++++++++---- internal/store/serverless_instances.go | 1 + internal/store/teams.go | 2 +- internal/store/users.go | 2 +- 52 files changed, 207 insertions(+), 35 deletions(-) diff --git a/docs/command/atlas-organizations-apiKeys-accessLists-list.txt b/docs/command/atlas-organizations-apiKeys-accessLists-list.txt index fbff9f7472..d78a318a63 100644 --- a/docs/command/atlas-organizations-apiKeys-accessLists-list.txt +++ b/docs/command/atlas-organizations-apiKeys-accessLists-list.txt @@ -63,6 +63,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - --orgId - string - false diff --git a/docs/command/atlas-organizations-apiKeys-list.txt b/docs/command/atlas-organizations-apiKeys-list.txt index ba39b7ca26..2190c8521a 100644 --- a/docs/command/atlas-organizations-apiKeys-list.txt +++ b/docs/command/atlas-organizations-apiKeys-list.txt @@ -49,6 +49,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - --orgId - string - false diff --git a/docs/command/atlas-organizations-list.txt b/docs/command/atlas-organizations-list.txt index ef11c31054..fb7d830472 100644 --- a/docs/command/atlas-organizations-list.txt +++ b/docs/command/atlas-organizations-list.txt @@ -53,6 +53,10 @@ Options - string - false - Organization name to perform a case-insensitive search for. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-organizations-users-list.txt b/docs/command/atlas-organizations-users-list.txt index fa864670b4..0c7befa2c2 100644 --- a/docs/command/atlas-organizations-users-list.txt +++ b/docs/command/atlas-organizations-users-list.txt @@ -45,6 +45,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - --orgId - string - false diff --git a/docs/command/atlas-processes-list.txt b/docs/command/atlas-processes-list.txt index d4de9c4c04..acf4140c7f 100644 --- a/docs/command/atlas-processes-list.txt +++ b/docs/command/atlas-processes-list.txt @@ -49,6 +49,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-projects-apiKeys-list.txt b/docs/command/atlas-projects-apiKeys-list.txt index 418e6dd201..e0bda1a57d 100644 --- a/docs/command/atlas-projects-apiKeys-list.txt +++ b/docs/command/atlas-projects-apiKeys-list.txt @@ -49,6 +49,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-projects-list.txt b/docs/command/atlas-projects-list.txt index 00b2596943..6d7b48e426 100644 --- a/docs/command/atlas-projects-list.txt +++ b/docs/command/atlas-projects-list.txt @@ -45,6 +45,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - --orgId - string - false diff --git a/docs/command/atlas-projects-teams-list.txt b/docs/command/atlas-projects-teams-list.txt index 76af84e40e..0254f50b8d 100644 --- a/docs/command/atlas-projects-teams-list.txt +++ b/docs/command/atlas-projects-teams-list.txt @@ -45,6 +45,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-projects-users-list.txt b/docs/command/atlas-projects-users-list.txt index b0a6d79420..57e33142db 100644 --- a/docs/command/atlas-projects-users-list.txt +++ b/docs/command/atlas-projects-users-list.txt @@ -49,6 +49,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-serverless-backups-restores-list.txt b/docs/command/atlas-serverless-backups-restores-list.txt index d5e9bea32a..3ad65b82d7 100644 --- a/docs/command/atlas-serverless-backups-restores-list.txt +++ b/docs/command/atlas-serverless-backups-restores-list.txt @@ -61,6 +61,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-serverless-backups-snapshots-list.txt b/docs/command/atlas-serverless-backups-snapshots-list.txt index 3a91814bb4..09eabf2e4d 100644 --- a/docs/command/atlas-serverless-backups-snapshots-list.txt +++ b/docs/command/atlas-serverless-backups-snapshots-list.txt @@ -61,6 +61,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-serverless-list.txt b/docs/command/atlas-serverless-list.txt index f3573432b2..99de0212e5 100644 --- a/docs/command/atlas-serverless-list.txt +++ b/docs/command/atlas-serverless-list.txt @@ -45,6 +45,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - -o, --output - string - false diff --git a/docs/command/atlas-teams-list.txt b/docs/command/atlas-teams-list.txt index 78ee58e98e..ba38f4726b 100644 --- a/docs/command/atlas-teams-list.txt +++ b/docs/command/atlas-teams-list.txt @@ -49,6 +49,10 @@ Options - int - false - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - --omitCount + - + - false + - Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response. * - --orgId - string - false diff --git a/internal/cli/atlas/organizations/apikeys/accesslists/list.go b/internal/cli/atlas/organizations/apikeys/accesslists/list.go index 38bbc7ba86..88372ba09d 100644 --- a/internal/cli/atlas/organizations/apikeys/accesslists/list.go +++ b/internal/cli/atlas/organizations/apikeys/accesslists/list.go @@ -56,6 +56,7 @@ func (opts *ListOpts) Run() error { ApiUserId: opts.id, PageNum: pointer.Get(listOpts.PageNum), ItemsPerPage: pointer.Get(listOpts.ItemsPerPage), + IncludeCount: pointer.Get(listOpts.IncludeCount), } result, err := opts.store.OrganizationAPIKeyAccessLists(params) if err != nil { @@ -95,6 +96,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/organizations/apikeys/accesslists/list_test.go b/internal/cli/atlas/organizations/apikeys/accesslists/list_test.go index 768f6de81e..6dc299ff60 100644 --- a/internal/cli/atlas/organizations/apikeys/accesslists/list_test.go +++ b/internal/cli/atlas/organizations/apikeys/accesslists/list_test.go @@ -41,6 +41,7 @@ func TestListOpts_Run(t *testing.T) { ApiUserId: opts.id, PageNum: pointer.Get(listOpts.PageNum), ItemsPerPage: pointer.Get(listOpts.ItemsPerPage), + IncludeCount: pointer.Get(listOpts.IncludeCount), } expected := admin.PaginatedApiUserAccessList{ Results: &[]admin.UserAccessList{}, @@ -62,6 +63,6 @@ func TestListBuilder(t *testing.T) { t, ListBuilder(), 0, - []string{flag.OrgID, flag.Output, flag.Page, flag.Limit}, + []string{flag.OrgID, flag.Output, flag.Page, flag.Limit, flag.OmitCount}, ) } diff --git a/internal/cli/atlas/organizations/apikeys/list.go b/internal/cli/atlas/organizations/apikeys/list.go index b73f0846d9..eec0b9cda4 100644 --- a/internal/cli/atlas/organizations/apikeys/list.go +++ b/internal/cli/atlas/organizations/apikeys/list.go @@ -86,6 +86,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/organizations/apikeys/list_test.go b/internal/cli/atlas/organizations/apikeys/list_test.go index 6808b7df07..668a42fba2 100644 --- a/internal/cli/atlas/organizations/apikeys/list_test.go +++ b/internal/cli/atlas/organizations/apikeys/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" atlasv2 "go.mongodb.org/atlas-sdk/v20231115007/admin" @@ -46,3 +47,12 @@ func TestListOpts_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.OrgID, flag.Output, flag.CompactResponse}, + ) +} diff --git a/internal/cli/atlas/organizations/list.go b/internal/cli/atlas/organizations/list.go index 9aa9d9c2cd..cbf3eaee16 100644 --- a/internal/cli/atlas/organizations/list.go +++ b/internal/cli/atlas/organizations/list.go @@ -64,6 +64,7 @@ func (opts *ListOpts) newOrganizationListOptions() *atlasv2.ListOrganizationsApi if listOpt := opts.NewListOptions(); listOpt != nil { params.PageNum = &listOpt.PageNum params.ItemsPerPage = &listOpt.ItemsPerPage + params.IncludeCount = &listOpt.IncludeCount } return params } @@ -96,11 +97,12 @@ func ListBuilder() *cobra.Command { }, } - cmd.Flags().StringVar(&opts.name, flag.Name, "", usage.OrgNameFilter) - cmd.Flags().BoolVar(&opts.includeDeletedOrgs, flag.IncludeDeleted, false, usage.OrgIncludeDeleted) - cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) + + cmd.Flags().StringVar(&opts.name, flag.Name, "", usage.OrgNameFilter) + cmd.Flags().BoolVar(&opts.includeDeletedOrgs, flag.IncludeDeleted, false, usage.OrgIncludeDeleted) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/cli/atlas/organizations/list_test.go b/internal/cli/atlas/organizations/list_test.go index c43e4d4afc..49f0f848c9 100644 --- a/internal/cli/atlas/organizations/list_test.go +++ b/internal/cli/atlas/organizations/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" atlasv2 "go.mongodb.org/atlas-sdk/v20231115007/admin" @@ -44,3 +45,12 @@ func TestList_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.IncludeDeleted, flag.Output, flag.Name}, + ) +} diff --git a/internal/cli/atlas/organizations/users/list.go b/internal/cli/atlas/organizations/users/list.go index 9322ca3a67..8d3b254852 100644 --- a/internal/cli/atlas/organizations/users/list.go +++ b/internal/cli/atlas/organizations/users/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/cli/atlas/organizations/users/list_test.go b/internal/cli/atlas/organizations/users/list_test.go index 96d77efdad..65f1df73d7 100644 --- a/internal/cli/atlas/organizations/users/list_test.go +++ b/internal/cli/atlas/organizations/users/list_test.go @@ -69,6 +69,7 @@ func TestListBuilder(t *testing.T) { flag.Limit, flag.Output, flag.OrgID, + flag.OmitCount, }, ) } diff --git a/internal/cli/atlas/privateendpoints/datalake/aws/list.go b/internal/cli/atlas/privateendpoints/datalake/aws/list.go index dd445fbb6b..a99e94b50d 100644 --- a/internal/cli/atlas/privateendpoints/datalake/aws/list.go +++ b/internal/cli/atlas/privateendpoints/datalake/aws/list.go @@ -63,6 +63,7 @@ func (opts *ListOpts) newDatalakePrivateEndpointsListOpts() *atlasv2.ListDataFed GroupId: opts.ConfigProjectID(), PageNum: pointer.Get(opts.PageNum), ItemsPerPage: pointer.Get(opts.ItemsPerPage), + IncludeCount: pointer.Get(!opts.OmitCount), } } @@ -93,6 +94,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/privateendpoints/datalake/aws/list_test.go b/internal/cli/atlas/privateendpoints/datalake/aws/list_test.go index 219a7d620c..66858d51ff 100644 --- a/internal/cli/atlas/privateendpoints/datalake/aws/list_test.go +++ b/internal/cli/atlas/privateendpoints/datalake/aws/list_test.go @@ -52,6 +52,6 @@ func TestListBuilder(t *testing.T) { t, ListBuilder(), 0, - []string{flag.ProjectID, flag.Output}, + []string{flag.ProjectID, flag.Output, flag.OmitCount, flag.Page, flag.Limit}, ) } diff --git a/internal/cli/atlas/processes/list.go b/internal/cli/atlas/processes/list.go index 839656faae..2a5c2b24c7 100644 --- a/internal/cli/atlas/processes/list.go +++ b/internal/cli/atlas/processes/list.go @@ -73,6 +73,10 @@ func (opts *ListOpts) newProcessesListParams() *atlasv2.ListAtlasProcessesApiPar if listOpts.ItemsPerPage > 0 { processesList.ItemsPerPage = &listOpts.ItemsPerPage } + + if listOpts.IncludeCount { + processesList.IncludeCount = &listOpts.IncludeCount + } return processesList } @@ -101,6 +105,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/processes/list_test.go b/internal/cli/atlas/processes/list_test.go index 099d8f6078..50ff9e493e 100644 --- a/internal/cli/atlas/processes/list_test.go +++ b/internal/cli/atlas/processes/list_test.go @@ -42,7 +42,9 @@ func TestList_Run(t *testing.T) { listOpts := &ListOpts{ store: mockStore, } - params := atlasv2.ListAtlasProcessesApiParams{} + params := atlasv2.ListAtlasProcessesApiParams{ + IncludeCount: pointer.Get(true), + } mockStore. EXPECT(). @@ -61,6 +63,6 @@ func TestListBuilder(t *testing.T) { t, ListBuilder(), 0, - []string{flag.ProjectID, flag.Output, flag.Page, flag.Limit}, + []string{flag.ProjectID, flag.Output, flag.Page, flag.Limit, flag.OmitCount}, ) } diff --git a/internal/cli/atlas/projects/apikeys/list.go b/internal/cli/atlas/projects/apikeys/list.go index 068a026e62..1dac2161db 100644 --- a/internal/cli/atlas/projects/apikeys/list.go +++ b/internal/cli/atlas/projects/apikeys/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/projects/apikeys/list_test.go b/internal/cli/atlas/projects/apikeys/list_test.go index 812fbe4bf0..8f76d5ea29 100644 --- a/internal/cli/atlas/projects/apikeys/list_test.go +++ b/internal/cli/atlas/projects/apikeys/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" @@ -53,3 +54,12 @@ func TestList_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.ProjectID, flag.Output, flag.CompactResponse}, + ) +} diff --git a/internal/cli/atlas/projects/list.go b/internal/cli/atlas/projects/list.go index 421f7b9795..4c2cd84ff9 100644 --- a/internal/cli/atlas/projects/list.go +++ b/internal/cli/atlas/projects/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/projects/list_test.go b/internal/cli/atlas/projects/list_test.go index d3cc84cddf..af464628cc 100644 --- a/internal/cli/atlas/projects/list_test.go +++ b/internal/cli/atlas/projects/list_test.go @@ -20,7 +20,9 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" "github.com/stretchr/testify/require" atlasv2 "go.mongodb.org/atlas-sdk/v20231115007/admin" ) @@ -54,3 +56,12 @@ func TestList_Run(t *testing.T) { require.NoError(t, listOpts.Run()) }) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.OrgID, flag.Output}, + ) +} diff --git a/internal/cli/atlas/projects/teams/list.go b/internal/cli/atlas/projects/teams/list.go index 2efa771bad..f7f6051868 100644 --- a/internal/cli/atlas/projects/teams/list.go +++ b/internal/cli/atlas/projects/teams/list.go @@ -47,7 +47,7 @@ func (opts *ListOpts) initStore(ctx context.Context) func() error { } func (opts *ListOpts) Run() error { - r, err := opts.store.ProjectTeams(opts.ConfigProjectID()) + r, err := opts.store.ProjectTeams(opts.ConfigProjectID(), opts.NewAtlasListOptions()) if err != nil { return err } @@ -83,6 +83,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/projects/teams/list_test.go b/internal/cli/atlas/projects/teams/list_test.go index 88bad4e135..130ae4eb8c 100644 --- a/internal/cli/atlas/projects/teams/list_test.go +++ b/internal/cli/atlas/projects/teams/list_test.go @@ -20,6 +20,8 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" @@ -39,12 +41,13 @@ func TestList_Run(t *testing.T) { } listOpts := &ListOpts{ - store: mockStore, + store: mockStore, + GlobalOpts: cli.GlobalOpts{ProjectID: "1"}, } mockStore. EXPECT(). - ProjectTeams(listOpts.ProjectID). + ProjectTeams(listOpts.ConfigProjectID(), listOpts.NewAtlasListOptions()). Return(&expected, nil). Times(1) @@ -53,3 +56,12 @@ func TestList_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.ProjectID, flag.Output}, + ) +} diff --git a/internal/cli/atlas/projects/users/list.go b/internal/cli/atlas/projects/users/list.go index 3da9c36b34..0b03c22c11 100644 --- a/internal/cli/atlas/projects/users/list.go +++ b/internal/cli/atlas/projects/users/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/projects/users/list_test.go b/internal/cli/atlas/projects/users/list_test.go index 6a8d508b45..cfb2ab0f8d 100644 --- a/internal/cli/atlas/projects/users/list_test.go +++ b/internal/cli/atlas/projects/users/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" atlasv2 "go.mongodb.org/atlas-sdk/v20231115007/admin" @@ -55,3 +56,12 @@ func TestList_Run(t *testing.T) { func TestListTemplate(t *testing.T) { test.VerifyOutputTemplate(t, listTemplate, atlasv2.PaginatedAppUser{}) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.ProjectID, flag.Output}, + ) +} diff --git a/internal/cli/atlas/serverless/backup/restores/list.go b/internal/cli/atlas/serverless/backup/restores/list.go index 7b228364be..5be8d5bf18 100644 --- a/internal/cli/atlas/serverless/backup/restores/list.go +++ b/internal/cli/atlas/serverless/backup/restores/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/serverless/backup/restores/list_test.go b/internal/cli/atlas/serverless/backup/restores/list_test.go index 3d2f6fe042..18d99e3493 100644 --- a/internal/cli/atlas/serverless/backup/restores/list_test.go +++ b/internal/cli/atlas/serverless/backup/restores/list_test.go @@ -67,6 +67,7 @@ func TestListBuilder(t *testing.T) { flag.Limit, flag.ProjectID, flag.Output, + flag.OmitCount, }, ) } diff --git a/internal/cli/atlas/serverless/backup/snapshots/list.go b/internal/cli/atlas/serverless/backup/snapshots/list.go index f55b5b1af3..55c15b599e 100644 --- a/internal/cli/atlas/serverless/backup/snapshots/list.go +++ b/internal/cli/atlas/serverless/backup/snapshots/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/serverless/backup/snapshots/list_test.go b/internal/cli/atlas/serverless/backup/snapshots/list_test.go index 045028fe4f..69e8b86319 100644 --- a/internal/cli/atlas/serverless/backup/snapshots/list_test.go +++ b/internal/cli/atlas/serverless/backup/snapshots/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" @@ -54,3 +55,12 @@ func TestList_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.ProjectID, flag.Output}, + ) +} diff --git a/internal/cli/atlas/serverless/list.go b/internal/cli/atlas/serverless/list.go index fb84e58909..1aae9f87fb 100644 --- a/internal/cli/atlas/serverless/list.go +++ b/internal/cli/atlas/serverless/list.go @@ -82,6 +82,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/serverless/list_test.go b/internal/cli/atlas/serverless/list_test.go index 72d07519ae..e41d472073 100644 --- a/internal/cli/atlas/serverless/list_test.go +++ b/internal/cli/atlas/serverless/list_test.go @@ -32,7 +32,7 @@ func TestListBuilder(t *testing.T) { t, ListBuilder(), 0, - []string{flag.Limit, flag.Page, flag.Output, flag.ProjectID}, + []string{flag.Limit, flag.Page, flag.Output, flag.ProjectID, flag.OmitCount}, ) } diff --git a/internal/cli/atlas/teams/list.go b/internal/cli/atlas/teams/list.go index 52b1203252..eff7de3110 100644 --- a/internal/cli/atlas/teams/list.go +++ b/internal/cli/atlas/teams/list.go @@ -87,6 +87,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.PageNum, flag.Page, cli.DefaultPage, usage.Page) cmd.Flags().IntVar(&opts.ItemsPerPage, flag.Limit, cli.DefaultPageLimit, usage.Limit) + cmd.Flags().BoolVar(&opts.OmitCount, flag.OmitCount, false, usage.OmitCount) cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) diff --git a/internal/cli/atlas/teams/list_test.go b/internal/cli/atlas/teams/list_test.go index 62347e3b6a..b43a10895f 100644 --- a/internal/cli/atlas/teams/list_test.go +++ b/internal/cli/atlas/teams/list_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test" @@ -53,3 +54,12 @@ func TestList_Run(t *testing.T) { } test.VerifyOutputTemplate(t, listTemplate, expected) } + +func TestListBuilder(t *testing.T) { + test.CmdValidator( + t, + ListBuilder(), + 0, + []string{flag.Page, flag.Limit, flag.OmitCount, flag.OrgID, flag.Output, flag.CompactResponse}, + ) +} diff --git a/internal/kubernetes/operator/project/project.go b/internal/kubernetes/operator/project/project.go index 0494d12675..0beb9b7c7b 100644 --- a/internal/kubernetes/operator/project/project.go +++ b/internal/kubernetes/operator/project/project.go @@ -840,7 +840,7 @@ func generateName(base string) string { } func buildTeams(teamsProvider store.OperatorTeamsStore, orgID, projectID, projectName, targetNamespace, version string, dictionary map[string]string) ([]akov2.Team, []*akov2.AtlasTeam, error) { - projectTeams, err := teamsProvider.ProjectTeams(projectID) + projectTeams, err := teamsProvider.ProjectTeams(projectID, nil) if err != nil { return nil, nil, err } diff --git a/internal/kubernetes/operator/project/project_test.go b/internal/kubernetes/operator/project/project_test.go index f40c7df2b4..38339f7e20 100644 --- a/internal/kubernetes/operator/project/project_test.go +++ b/internal/kubernetes/operator/project/project_test.go @@ -294,7 +294,7 @@ func TestBuildAtlasProject(t *testing.T) { projectStore.EXPECT().Auditing(projectID).Return(auditing, nil) projectStore.EXPECT().AlertConfigurations(listAlterOpt).Return(alertConfigResult, nil) projectStore.EXPECT().DatabaseRoles(projectID).Return(customRoles, nil) - projectStore.EXPECT().ProjectTeams(projectID).Return(projectTeams, nil) + projectStore.EXPECT().ProjectTeams(projectID, nil).Return(projectTeams, nil) projectStore.EXPECT().TeamByID(orgID, teamID).Return(teams, nil) projectStore.EXPECT().TeamUsers(orgID, teamID).Return(teamUsers, nil) diff --git a/internal/mocks/mock_atlas_generic_store.go b/internal/mocks/mock_atlas_generic_store.go index 7c55fcab8d..cbde42045f 100644 --- a/internal/mocks/mock_atlas_generic_store.go +++ b/internal/mocks/mock_atlas_generic_store.go @@ -440,18 +440,18 @@ func (mr *MockOperatorGenericStoreMockRecorder) ProjectSettings(arg0 interface{} } // ProjectTeams mocks base method. -func (m *MockOperatorGenericStore) ProjectTeams(arg0 string) (*admin.PaginatedTeamRole, error) { +func (m *MockOperatorGenericStore) ProjectTeams(arg0 string, arg1 *store.ListOptions) (*admin.PaginatedTeamRole, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProjectTeams", arg0) + ret := m.ctrl.Call(m, "ProjectTeams", arg0, arg1) ret0, _ := ret[0].(*admin.PaginatedTeamRole) ret1, _ := ret[1].(error) return ret0, ret1 } // ProjectTeams indicates an expected call of ProjectTeams. -func (mr *MockOperatorGenericStoreMockRecorder) ProjectTeams(arg0 interface{}) *gomock.Call { +func (mr *MockOperatorGenericStoreMockRecorder) ProjectTeams(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockOperatorGenericStore)(nil).ProjectTeams), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockOperatorGenericStore)(nil).ProjectTeams), arg0, arg1) } // Projects mocks base method. diff --git a/internal/mocks/mock_atlas_operator_project_store.go b/internal/mocks/mock_atlas_operator_project_store.go index 9300a0fa88..178cbe258b 100644 --- a/internal/mocks/mock_atlas_operator_project_store.go +++ b/internal/mocks/mock_atlas_operator_project_store.go @@ -276,18 +276,18 @@ func (mr *MockOperatorProjectStoreMockRecorder) ProjectSettings(arg0 interface{} } // ProjectTeams mocks base method. -func (m *MockOperatorProjectStore) ProjectTeams(arg0 string) (*admin.PaginatedTeamRole, error) { +func (m *MockOperatorProjectStore) ProjectTeams(arg0 string, arg1 *store.ListOptions) (*admin.PaginatedTeamRole, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProjectTeams", arg0) + ret := m.ctrl.Call(m, "ProjectTeams", arg0, arg1) ret0, _ := ret[0].(*admin.PaginatedTeamRole) ret1, _ := ret[1].(error) return ret0, ret1 } // ProjectTeams indicates an expected call of ProjectTeams. -func (mr *MockOperatorProjectStoreMockRecorder) ProjectTeams(arg0 interface{}) *gomock.Call { +func (mr *MockOperatorProjectStoreMockRecorder) ProjectTeams(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockOperatorProjectStore)(nil).ProjectTeams), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockOperatorProjectStore)(nil).ProjectTeams), arg0, arg1) } // Projects mocks base method. diff --git a/internal/mocks/mock_projects.go b/internal/mocks/mock_projects.go index b60748a220..b6b19338e8 100644 --- a/internal/mocks/mock_projects.go +++ b/internal/mocks/mock_projects.go @@ -277,18 +277,18 @@ func (m *MockProjectTeamLister) EXPECT() *MockProjectTeamListerMockRecorder { } // ProjectTeams mocks base method. -func (m *MockProjectTeamLister) ProjectTeams(arg0 string) (*admin.PaginatedTeamRole, error) { +func (m *MockProjectTeamLister) ProjectTeams(arg0 string, arg1 *store.ListOptions) (*admin.PaginatedTeamRole, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProjectTeams", arg0) + ret := m.ctrl.Call(m, "ProjectTeams", arg0, arg1) ret0, _ := ret[0].(*admin.PaginatedTeamRole) ret1, _ := ret[1].(error) return ret0, ret1 } // ProjectTeams indicates an expected call of ProjectTeams. -func (mr *MockProjectTeamListerMockRecorder) ProjectTeams(arg0 interface{}) *gomock.Call { +func (mr *MockProjectTeamListerMockRecorder) ProjectTeams(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockProjectTeamLister)(nil).ProjectTeams), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectTeams", reflect.TypeOf((*MockProjectTeamLister)(nil).ProjectTeams), arg0, arg1) } // MockProjectTeamAdder is a mock of ProjectTeamAdder interface. diff --git a/internal/store/api_keys.go b/internal/store/api_keys.go index 0698ceec95..140b684a98 100644 --- a/internal/store/api_keys.go +++ b/internal/store/api_keys.go @@ -61,7 +61,7 @@ type OrganizationAPIKeyDeleter interface { func (s *Store) OrganizationAPIKeys(orgID string, opts *atlas.ListOptions) (*atlasv2.PaginatedApiApiUser, error) { res := s.clientv2.ProgrammaticAPIKeysApi.ListApiKeys(s.ctx, orgID) if opts != nil { - res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum) + res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err @@ -95,7 +95,7 @@ func (s *Store) DeleteOrganizationAPIKey(orgID, id string) error { func (s *Store) ProjectAPIKeys(projectID string, opts *atlas.ListOptions) (*atlasv2.PaginatedApiApiUser, error) { res := s.clientv2.ProgrammaticAPIKeysApi.ListProjectApiKeys(s.ctx, projectID) if opts != nil { - res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage) + res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err diff --git a/internal/store/cloud_provider_backup_serverless.go b/internal/store/cloud_provider_backup_serverless.go index 09ee9ec4f0..aebdc5f920 100644 --- a/internal/store/cloud_provider_backup_serverless.go +++ b/internal/store/cloud_provider_backup_serverless.go @@ -51,7 +51,7 @@ func (s *Store) ServerlessSnapshots(projectID, clusterName string, opts *atlas.L } res := s.clientv2.CloudBackupsApi.ListServerlessBackups(s.ctx, projectID, clusterName) if opts != nil { - res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage) + res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err @@ -73,7 +73,7 @@ func (s *Store) ServerlessRestoreJobs(projectID, instanceName string, opts *atla } res := s.clientv2.CloudBackupsApi.ListServerlessBackupRestoreJobs(s.ctx, projectID, instanceName) if opts != nil { - res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum) + res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err diff --git a/internal/store/projects.go b/internal/store/projects.go index 62978747ca..9497b1e0f2 100644 --- a/internal/store/projects.go +++ b/internal/store/projects.go @@ -51,7 +51,7 @@ type ProjectUserDeleter interface { } type ProjectTeamLister interface { - ProjectTeams(string) (*atlasv2.PaginatedTeamRole, error) + ProjectTeams(string, *ListOptions) (*atlasv2.PaginatedTeamRole, error) } type ProjectTeamAdder interface { @@ -109,7 +109,7 @@ func (s *Store) DeleteProject(projectID string) error { func (s *Store) ProjectUsers(projectID string, opts *ListOptions) (*atlasv2.PaginatedAppUser, error) { res := s.clientv2.ProjectsApi.ListProjectUsers(s.ctx, projectID) if opts != nil { - res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum) + res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err @@ -122,8 +122,18 @@ func (s *Store) DeleteUserFromProject(projectID, userID string) error { } // ProjectTeams encapsulates the logic to manage different cloud providers. -func (s *Store) ProjectTeams(projectID string) (*atlasv2.PaginatedTeamRole, error) { - result, _, err := s.clientv2.TeamsApi.ListProjectTeams(s.ctx, projectID).Execute() +func (s *Store) ProjectTeams(projectID string, opts *ListOptions) (*atlasv2.PaginatedTeamRole, error) { + res := s.clientv2.TeamsApi. + ListProjectTeams(s.ctx, projectID) + + if opts != nil { + res. + IncludeCount(opts.IncludeCount). + PageNum(opts.PageNum). + ItemsPerPage(opts.ItemsPerPage) + } + + result, _, err := res.Execute() return result, err } diff --git a/internal/store/serverless_instances.go b/internal/store/serverless_instances.go index 0f47dfbfc3..de12321b40 100644 --- a/internal/store/serverless_instances.go +++ b/internal/store/serverless_instances.go @@ -51,6 +51,7 @@ func (s *Store) ServerlessInstances(projectID string, listOps *ListOptions) (*at result, _, err := s.clientv2.ServerlessInstancesApi.ListServerlessInstances(s.ctx, projectID). ItemsPerPage(listOps.ItemsPerPage). PageNum(listOps.PageNum). + IncludeCount(listOps.IncludeCount). Execute() return result, err diff --git a/internal/store/teams.go b/internal/store/teams.go index 0ae1778ddb..226d9f298b 100644 --- a/internal/store/teams.go +++ b/internal/store/teams.go @@ -70,7 +70,7 @@ func (s *Store) TeamByName(orgID, teamName string) (*atlasv2.TeamResponse, error func (s *Store) Teams(orgID string, opts *atlas.ListOptions) (*atlasv2.PaginatedTeam, error) { res := s.clientv2.TeamsApi.ListOrganizationTeams(s.ctx, orgID) if opts != nil { - res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage) + res = res.PageNum(opts.PageNum).ItemsPerPage(opts.ItemsPerPage).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err diff --git a/internal/store/users.go b/internal/store/users.go index 84add4b62c..33b55d9383 100644 --- a/internal/store/users.go +++ b/internal/store/users.go @@ -60,7 +60,7 @@ func (s *Store) UserByName(username string) (*atlasv2.CloudAppUser, error) { func (s *Store) OrganizationUsers(organizationID string, opts *atlas.ListOptions) (*atlasv2.PaginatedAppUser, error) { res := s.clientv2.OrganizationsApi.ListOrganizationUsers(s.ctx, organizationID) if opts != nil { - res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum) + res = res.ItemsPerPage(opts.ItemsPerPage).PageNum(opts.PageNum).IncludeCount(opts.IncludeCount) } result, _, err := res.Execute() return result, err