Skip to content

CLOUDP-59567: Adding the support of alerts for OM in mcli #65

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

Merged
merged 2 commits into from
Mar 24, 2020
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
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ require (
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200318163834-8b6a5ea6eb67
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200319100114-648fc659365b
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200323160302-12cb92c69adf
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200324155204-287d08b2e57b
github.com/mwielbut/pointy v1.1.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason to include pointy now? can you please check this? will it compile if we remove this line?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'm getting this on master as well, so may as well 🤷‍♂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

go mod tidy does not clean pointy but the application compiles without it. I do not how ponty went there 🤦‍♂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I remove ponty from go.mod and then run make fmt check build, ponty is again inside go.mod

Copy link
Collaborator

@gssbzn gssbzn Mar 24, 2020

Choose a reason for hiding this comment

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

Found the why, you added it to a fixture

github.com/pelletier/go-toml v1.6.0 // indirect
github.com/spf13/afero v1.2.2
github.com/spf13/cast v1.3.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQz
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200318163834-8b6a5ea6eb67 h1:YKz/n9K99mUOxs/pX+vpzNvbSFr56vObu2+O33upiFo=
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200318163834-8b6a5ea6eb67/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200319100114-648fc659365b h1:ROpURq2j0CnObttgt3cm+2veOzoNwUPWWK/hoHZGBQA=
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200319100114-648fc659365b/go.mod h1:FhMID1fXaHZpvHPfUhcDL3pfc5JrBB+aD42HLgFoO+8=
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200323160302-12cb92c69adf h1:dLZh7ukw/hwt6Rnjer/Zjg53spl+YfLn1N8bAnoylu8=
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200323160302-12cb92c69adf/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200324155204-287d08b2e57b h1:qMUzHZ6pJ5nk/GLyxbqPqkW7eAZoKRjNKnaCQpHoC0M=
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200324155204-287d08b2e57b/go.mod h1:FhMID1fXaHZpvHPfUhcDL3pfc5JrBB+aD42HLgFoO+8=
github.com/mwielbut/pointy v1.1.0 h1:U5/YEfoIkaGCHv0St3CgjduqXID4FNRoyZgLM1kY9vg=
github.com/mwielbut/pointy v1.1.0/go.mod h1:MvvO+uMFj9T5DMda33HlvogsFBX7pWWKAkFIn4teYwY=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
Expand Down
10 changes: 10 additions & 0 deletions internal/store/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"

atlas "github.com/mongodb/go-client-mongodb-atlas/mongodbatlas"
om "github.com/mongodb/go-client-mongodb-ops-manager/opsmngr"
"github.com/mongodb/mongocli/internal/config"
)

Expand Down Expand Up @@ -46,6 +47,9 @@ func (s *Store) Alert(projectID, alertID string) (*atlas.Alert, error) {
case config.CloudService:
result, _, err := s.client.(*atlas.Client).Alerts.Get(context.Background(), projectID, alertID)
return result, err
case config.OpsManagerService, config.CloudManagerService:
result, _, err := s.client.(*om.Client).Alerts.Get(context.Background(), projectID, alertID)
return result, err
default:
return nil, fmt.Errorf("unsupported service: %s", s.service)
}
Expand All @@ -57,6 +61,9 @@ func (s *Store) Alerts(projectID string, opts *atlas.ListOptions) ([]atlas.Alert
case config.CloudService:
result, _, err := s.client.(*atlas.Client).Alerts.List(context.Background(), projectID, opts)
return result, err
case config.OpsManagerService, config.CloudManagerService:
result, _, err := s.client.(*om.Client).Alerts.List(context.Background(), projectID, opts)
return result, err
default:
return nil, fmt.Errorf("unsupported service: %s", s.service)
}
Expand All @@ -68,6 +75,9 @@ func (s *Store) AcknowledgeAlert(projectID, alertID string, body *atlas.Acknowle
case config.CloudService:
result, _, err := s.client.(*atlas.Client).Alerts.Acknowledge(context.Background(), projectID, alertID, body)
return result, err
case config.OpsManagerService, config.CloudManagerService:
result, _, err := s.client.(*om.Client).Alerts.Acknowledge(context.Background(), projectID, alertID, body)
return result, err
default:
return nil, fmt.Errorf("unsupported service: %s", s.service)
}
Expand Down