Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-234852: HELP: GitHub Issue n. 2691 #2693

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-events-projects-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Options
- string
- false
- Minimum created date. This option returns events whose created date is greater than or equal to the specified value.
* - --omitCount
-
- false
- Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response.
* - -o, --output
- string
- false
Expand Down
6 changes: 6 additions & 0 deletions internal/cli/atlas/events/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ func (opts *ListOpts) NewProjectListOptions() admin.ListProjectEventsApiParams {
if opts.PageNum > 0 {
p.PageNum = &opts.PageNum
}

if opts.OmitCount {
p.IncludeCount = pointer.Get(false)
}

return p
}

Expand Down Expand Up @@ -157,6 +162,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().StringSliceVar(&opts.EventType, flag.TypeFlag, nil, usage.Event)
cmd.Flags().StringVar(&opts.MaxDate, flag.MaxDate, "", usage.MaxDate)
Expand Down
1 change: 1 addition & 0 deletions internal/cli/atlas/events/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestListBuilder(t *testing.T) {
[]string{
flag.Limit,
flag.Page,
flag.OmitCount,
flag.Output,
flag.ProjectID,
flag.OrgID,
Expand Down
6 changes: 6 additions & 0 deletions internal/cli/atlas/events/projects_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func (opts *projectListOpts) NewProjectListOptions() admin.ListProjectEventsApiP
if opts.PageNum > 0 {
p.PageNum = &opts.PageNum
}

if opts.OmitCount {
p.IncludeCount = pointer.Get(false)
}

return p
}

Expand Down Expand Up @@ -112,6 +117,7 @@ func ProjectListBuilder() *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().StringSliceVar(&opts.EventType, flag.TypeFlag, nil, usage.Event)
cmd.Flags().StringVar(&opts.MaxDate, flag.MaxDate, "", usage.MaxDate)
Expand Down
1 change: 1 addition & 0 deletions internal/cli/atlas/events/projects_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestProjectListBuilder(t *testing.T) {
flag.Limit,
flag.Page,
flag.Output,
flag.OmitCount,
flag.ProjectID,
flag.TypeFlag,
flag.MaxDate,
Expand Down
1 change: 1 addition & 0 deletions internal/cli/list_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
type ListOpts struct {
PageNum int
ItemsPerPage int
OmitCount bool
}

func (opts *ListOpts) NewListOptions() *mongodbatlas.ListOptions {
Expand Down
1 change: 1 addition & 0 deletions internal/flag/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const (
Until = "until" // Until flag
Page = "page" // Page flag
Limit = "limit" // Limit flag
OmitCount = "omitCount" // OmitCount flag
File = "file" // File flag
FileShort = "f" // File flag
Force = "force" // Force flag
Expand Down
1 change: 1 addition & 0 deletions internal/usage/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
Until = "ISO 8601-formatted time until which the alert is acknowledged. This command returns this value if a MongoDB user previously acknowledged the alert. After this date, the alert becomes unacknowledged."
ConnectionStringType = "Type of connection string. If you specify 'private', this option retrieves the connection string for the network peering endpoint. This value defaults to 'standard'."
Limit = "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."
OmitCount = "Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response."
Username = "Name that identifies the user. You must specify a valid email address."
BackupStatus = "Status of the backup configuration."
StorageEngine = "Storage engine for the backup."
Expand Down