Skip to content

Commit ba153b6

Browse files
authored
Update atlas and OM go clients (#93)
1 parent 0caad2e commit ba153b6

9 files changed

+60
-58
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SOURCE_FILES?=./...
44
BINARY_NAME=mongocli
55

66
DESTINATION=./bin/${BINARY_NAME}
7-
GOLANGCI_VERSION=v1.23.8
7+
GOLANGCI_VERSION=v1.24.0
88
COVERAGE=coverage.out
99

1010
VERSION=$(shell git describe --always --tags)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ require (
1111
github.com/mattn/go-colorable v0.1.4 // indirect
1212
github.com/mattn/go-isatty v0.0.12 // indirect
1313
github.com/mitchellh/go-homedir v1.1.0
14-
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200402145105-fa504e988bc4
15-
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200407140211-7b57157cd359
14+
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200408164237-a1a83bd4824f
15+
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200409122000-4fea663b73d0
1616
github.com/mwielbut/pointy v1.1.0
1717
github.com/pelletier/go-toml v1.6.0 // indirect
1818
github.com/spf13/afero v1.2.2

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG
100100
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
101101
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
102102
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
103-
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200402145105-fa504e988bc4 h1:2moeNJ0DF03xNA3PzOBPUbtv635Cd9CC50OUwl1uVSI=
104-
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200402145105-fa504e988bc4/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
105-
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200407140211-7b57157cd359 h1:I89peyflozS+PuuAx8vjn2wRPd8WzYUdOx6JFGSwl3E=
106-
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200407140211-7b57157cd359/go.mod h1:tSyj9LVpQjQciu2gDLSd6GZ3lK5X/tYu8usQga6yslI=
103+
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200408153549-57b3e94c997a h1:imwIzgvl404y26TYER7vMyypu1YFMNr5g86LzeJ8GfQ=
104+
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200408153549-57b3e94c997a/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
105+
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200408164237-a1a83bd4824f h1:xUg4b6T4XXTICPtKLbsJAUIREHWTGewXc2IS3U5CUEc=
106+
github.com/mongodb/go-client-mongodb-atlas v0.1.4-0.20200408164237-a1a83bd4824f/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
107+
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200409122000-4fea663b73d0 h1:N3t4AFyZOUHKOs3HSf7DG+DpPtPlE2zG5LyblXuwPms=
108+
github.com/mongodb/go-client-mongodb-ops-manager v0.0.2-0.20200409122000-4fea663b73d0/go.mod h1:mgMLdoXItYPnE+uv0CDYuc//lor7azeIv3gDCpjsduY=
107109
github.com/mwielbut/pointy v1.1.0 h1:U5/YEfoIkaGCHv0St3CgjduqXID4FNRoyZgLM1kY9vg=
108110
github.com/mwielbut/pointy v1.1.0/go.mod h1:MvvO+uMFj9T5DMda33HlvogsFBX7pWWKAkFIn4teYwY=
109111
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=

internal/cli/atlas_measurements_process.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type atlasMeasurementsProcessOpts struct {
3535
start string
3636
end string
3737
measurementType string
38-
store store.AtlasProcessMeasurementLister
38+
store store.ProcessMeasurementLister
3939
}
4040

4141
func (opts *atlasMeasurementsProcessOpts) init() error {
@@ -50,7 +50,7 @@ func (opts *atlasMeasurementsProcessOpts) init() error {
5050

5151
func (opts *atlasMeasurementsProcessOpts) Run() error {
5252
listOpts := opts.newProcessMeasurementListOptions()
53-
result, err := opts.store.AtlasProcessMeasurements(opts.ProjectID(), opts.host, opts.port, listOpts)
53+
result, err := opts.store.ProcessMeasurements(opts.ProjectID(), opts.host, opts.port, listOpts)
5454

5555
if err != nil {
5656
return err

internal/cli/atlas_measurements_process_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
func TestAtlasMeasurementsProcess_Run(t *testing.T) {
2525
ctrl := gomock.NewController(t)
26-
mockStore := mocks.NewMockAtlasProcessMeasurementLister(ctrl)
26+
mockStore := mocks.NewMockProcessMeasurementLister(ctrl)
2727

2828
defer ctrl.Finish()
2929

@@ -45,7 +45,7 @@ func TestAtlasMeasurementsProcess_Run(t *testing.T) {
4545

4646
opts := listOpts.newProcessMeasurementListOptions()
4747
mockStore.
48-
EXPECT().AtlasProcessMeasurements(listOpts.projectID, hostName, port, opts).
48+
EXPECT().ProcessMeasurements(listOpts.projectID, hostName, port, opts).
4949
Return(expected, nil).
5050
Times(1)
5151

internal/cli/ops_manager_measurements_process.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type OpsManagerMeasurementsProcessOpts struct {
3434
start string
3535
end string
3636
measurementType string
37-
store store.OpsManagerProcessMeasurementLister
37+
store store.HostMeasurementLister
3838
}
3939

4040
func (opts *OpsManagerMeasurementsProcessOpts) init() error {
@@ -49,7 +49,7 @@ func (opts *OpsManagerMeasurementsProcessOpts) init() error {
4949

5050
func (opts *OpsManagerMeasurementsProcessOpts) Run() error {
5151
listOpts := opts.newProcessMeasurementListOptions()
52-
result, err := opts.store.OpsManagerProcessMeasurements(opts.ProjectID(), opts.hostID, listOpts)
52+
result, err := opts.store.HostMeasurements(opts.ProjectID(), opts.hostID, listOpts)
5353

5454
if err != nil {
5555
return err

internal/cli/ops_manager_measurements_process_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
func TestOpsManagerMeasurementsProcess_Run(t *testing.T) {
2525
ctrl := gomock.NewController(t)
26-
mockStore := mocks.NewMockOpsManagerProcessMeasurementLister(ctrl)
26+
mockStore := mocks.NewMockHostMeasurementLister(ctrl)
2727

2828
defer ctrl.Finish()
2929

@@ -39,7 +39,7 @@ func TestOpsManagerMeasurementsProcess_Run(t *testing.T) {
3939

4040
opts := listOpts.newProcessMeasurementListOptions()
4141
mockStore.
42-
EXPECT().OpsManagerProcessMeasurements(listOpts.projectID, listOpts.hostID, opts).
42+
EXPECT().HostMeasurements(listOpts.projectID, listOpts.hostID, opts).
4343
Return(expected, nil).
4444
Times(1)
4545

internal/mocks/mock_process_measurements.go

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/store/process_measurements.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ import (
2323
"github.com/mongodb/mongocli/internal/config"
2424
)
2525

26-
type AtlasProcessMeasurementLister interface {
27-
AtlasProcessMeasurements(string, string, int, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error)
26+
type ProcessMeasurementLister interface {
27+
ProcessMeasurements(string, string, int, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error)
2828
}
2929

30-
type OpsManagerProcessMeasurementLister interface {
31-
OpsManagerProcessMeasurements(string, string, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error)
30+
type HostMeasurementLister interface {
31+
HostMeasurements(string, string, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error)
3232
}
3333

34-
// AtlasProcessMeasurements encapsulate the logic to manage different cloud providers
35-
func (s *Store) AtlasProcessMeasurements(groupID, host string, port int, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error) {
34+
// ProcessMeasurements encapsulate the logic to manage different cloud providers
35+
func (s *Store) ProcessMeasurements(groupID, host string, port int, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error) {
3636
switch s.service {
3737
case config.CloudService:
3838
result, _, err := s.client.(*atlas.Client).ProcessMeasurements.List(context.Background(), groupID, host, port, opts)
@@ -42,11 +42,11 @@ func (s *Store) AtlasProcessMeasurements(groupID, host string, port int, opts *a
4242
}
4343
}
4444

45-
// OpsManagerProcessMeasurements encapsulate the logic to manage different cloud providers
46-
func (s *Store) OpsManagerProcessMeasurements(groupID, host string, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error) {
45+
// HostMeasurements encapsulate the logic to manage different cloud providers
46+
func (s *Store) HostMeasurements(groupID, host string, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, error) {
4747
switch s.service {
4848
case config.OpsManagerService, config.CloudManagerService:
49-
result, _, err := s.client.(*om.Client).SystemMeasurements.List(context.Background(), groupID, host, opts)
49+
result, _, err := s.client.(*om.Client).HostMeasurements.List(context.Background(), groupID, host, opts)
5050
return result, err
5151
default:
5252
return nil, fmt.Errorf("unsupported service: %s", s.service)

0 commit comments

Comments
 (0)