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

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Mar 4, 2024

Proposed changes

Closes #2691

CLOUDP-234852

This PR defines a new --omitCount flag for the atlas events list commands

./bin/atlas events projects list --help                                                                                                                           11s  16.18.0
Return all events for the specified project.

Usage:
  atlas events projects list [flags]

Aliases:
  list, ls

Examples:
  # Return a JSON-formatted list of events for the project with the ID 5e2211c17a3e5a48f5497de3:
  atlas events projects list --Id 5e2211c17a3e5a48f5497de3 --output json

Flags:
  -h, --help               help for list
      --limit int          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. (default 100)
      --maxDate string     Maximum created date. This option returns events whose created date is less than or equal to the specified value.
      --minDate string     Minimum created date. This option returns events whose created date is greater than or equal to the specified value.
      --omitCount          Flag that indicates whether the JSON response returns the total number of items (totalCount) in the JSON response.
  -o, --output string      Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
      --page int           Page number that specifies a page of results. (default 1)
      --projectId string   Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
      --type strings       Type of event that triggered the alert. To learn which values the CLI accepts, see the Enum for eventTypeName in the Atlas Admin API spec: https://dochub.mongodb.org/core/atlas-event-names.

Global Flags:
  -P, --profile string   Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Testing

I tested locally without the flag I got

./bin/atlas events projects list -o json
{
.......
    {
      "created": "2024-03-03T19:19:37Z",
      "eventTypeName": "PROJECT_SCHEDULED_MAINTENANCE",
      "groupId": "63f4d4a47baeac59406dc131",
      "id": "65e4cd49c27f717e2beaaa34",
      "isGlobalAdmin": false,
      "links": [
        {
          "href": "https://cloud-dev.mongodb.com/api/atlas/v2/groups/63f4d4a47baeac59406dc131/events/65e4cd49c27f717e2beaaa34",
          "rel": "self"
        }
      ]
    },
    {
      "created": "2024-03-03T19:17:35Z",
      "eventTypeName": "PROJECT_SCHEDULED_MAINTENANCE",
      "groupId": "63f4d4a47baeac59406dc131",
      "id": "65e4cccfc27f717e2bea796b",
      "isGlobalAdmin": false,
      "links": [
        {
          "href": "https://cloud-dev.mongodb.com/api/atlas/v2/groups/63f4d4a47baeac59406dc131/events/65e4cccfc27f717e2bea796b",
          "rel": "self"
        }
      ]
    }
  ],
  "totalCount": 29527
}

with the flag

./bin/atlas events projects list -o json --omitCount
{   
..... 
   {
      "created": "2024-03-03T19:19:37Z",
      "eventTypeName": "PROJECT_SCHEDULED_MAINTENANCE",
      "groupId": "63f4d4a47baeac59406dc131",
      "id": "65e4cd49c27f717e2beaaa34",
      "isGlobalAdmin": false,
      "links": [
        {
          "href": "https://cloud-dev.mongodb.com/api/atlas/v2/groups/63f4d4a47baeac59406dc131/events/65e4cd49c27f717e2beaaa34",
          "rel": "self"
        }
      ]
    },
    {
      "created": "2024-03-03T19:17:35Z",
      "eventTypeName": "PROJECT_SCHEDULED_MAINTENANCE",
      "groupId": "63f4d4a47baeac59406dc131",
      "id": "65e4cccfc27f717e2bea796b",
      "isGlobalAdmin": false,
      "links": [
        {
          "href": "https://cloud-dev.mongodb.com/api/atlas/v2/groups/63f4d4a47baeac59406dc131/events/65e4cccfc27f717e2bea796b",
          "rel": "self"
        }
      ]
    }
  ],
  "totalCount": 0
}

@andreaangiolillo andreaangiolillo changed the title CLOUDP-234852:HELP: GitHub Issue n. 2691 CLOUDP-234852: HELP: GitHub Issue n. 2691 Mar 4, 2024
@andreaangiolillo andreaangiolillo marked this pull request as ready for review March 4, 2024 18:02
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner March 4, 2024 18:02
@andreaangiolillo andreaangiolillo requested review from a team and gssbzn March 4, 2024 18:02
internal/cli/list_opts.go Outdated Show resolved Hide resolved
@andreaangiolillo andreaangiolillo requested a review from gssbzn March 5, 2024 09:27
Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@erabil-mdb erabil-mdb left a comment

Choose a reason for hiding this comment

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

LGTM!

@andreaangiolillo andreaangiolillo merged commit d3ff47b into master Mar 5, 2024
19 checks passed
@andreaangiolillo andreaangiolillo deleted the CLOUDP-234852 branch March 5, 2024 18:00
@fmenezes fmenezes mentioned this pull request Apr 5, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

500 error when getting events
3 participants