From 0b19b0c307c93befe04149d9ae362bf02fbe788b Mon Sep 17 00:00:00 2001 From: Gustavo Bazan Date: Tue, 29 Apr 2025 09:24:14 +0100 Subject: [PATCH] task: delete unused store methods and mocks --- internal/mocks/mock_encryption_at_rest.go | 56 ------------------- internal/mocks/mock_global_cluster.go | 56 ------------------- .../mock_serverless_private_endpoints.go | 56 ------------------- internal/store/encryption_at_rest.go | 30 ---------- internal/store/global_cluster.go | 30 ---------- .../store/serverless_private_endpoints.go | 30 ---------- 6 files changed, 258 deletions(-) delete mode 100644 internal/mocks/mock_encryption_at_rest.go delete mode 100644 internal/mocks/mock_global_cluster.go delete mode 100644 internal/mocks/mock_serverless_private_endpoints.go delete mode 100644 internal/store/encryption_at_rest.go delete mode 100644 internal/store/global_cluster.go delete mode 100644 internal/store/serverless_private_endpoints.go diff --git a/internal/mocks/mock_encryption_at_rest.go b/internal/mocks/mock_encryption_at_rest.go deleted file mode 100644 index 3bad45a4cf..0000000000 --- a/internal/mocks/mock_encryption_at_rest.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store (interfaces: EncryptionAtRestDescriber) -// -// Generated by this command: -// -// mockgen -destination=../mocks/mock_encryption_at_rest.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store EncryptionAtRestDescriber -// - -// Package mocks is a generated GoMock package. -package mocks - -import ( - reflect "reflect" - - admin "go.mongodb.org/atlas-sdk/v20250312002/admin" - gomock "go.uber.org/mock/gomock" -) - -// MockEncryptionAtRestDescriber is a mock of EncryptionAtRestDescriber interface. -type MockEncryptionAtRestDescriber struct { - ctrl *gomock.Controller - recorder *MockEncryptionAtRestDescriberMockRecorder - isgomock struct{} -} - -// MockEncryptionAtRestDescriberMockRecorder is the mock recorder for MockEncryptionAtRestDescriber. -type MockEncryptionAtRestDescriberMockRecorder struct { - mock *MockEncryptionAtRestDescriber -} - -// NewMockEncryptionAtRestDescriber creates a new mock instance. -func NewMockEncryptionAtRestDescriber(ctrl *gomock.Controller) *MockEncryptionAtRestDescriber { - mock := &MockEncryptionAtRestDescriber{ctrl: ctrl} - mock.recorder = &MockEncryptionAtRestDescriberMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockEncryptionAtRestDescriber) EXPECT() *MockEncryptionAtRestDescriberMockRecorder { - return m.recorder -} - -// EncryptionAtRest mocks base method. -func (m *MockEncryptionAtRestDescriber) EncryptionAtRest(arg0 string) (*admin.EncryptionAtRest, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EncryptionAtRest", arg0) - ret0, _ := ret[0].(*admin.EncryptionAtRest) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EncryptionAtRest indicates an expected call of EncryptionAtRest. -func (mr *MockEncryptionAtRestDescriberMockRecorder) EncryptionAtRest(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EncryptionAtRest", reflect.TypeOf((*MockEncryptionAtRestDescriber)(nil).EncryptionAtRest), arg0) -} diff --git a/internal/mocks/mock_global_cluster.go b/internal/mocks/mock_global_cluster.go deleted file mode 100644 index f4182581d7..0000000000 --- a/internal/mocks/mock_global_cluster.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store (interfaces: GlobalClusterDescriber) -// -// Generated by this command: -// -// mockgen -destination=../mocks/mock_global_cluster.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store GlobalClusterDescriber -// - -// Package mocks is a generated GoMock package. -package mocks - -import ( - reflect "reflect" - - admin "go.mongodb.org/atlas-sdk/v20240530005/admin" - gomock "go.uber.org/mock/gomock" -) - -// MockGlobalClusterDescriber is a mock of GlobalClusterDescriber interface. -type MockGlobalClusterDescriber struct { - ctrl *gomock.Controller - recorder *MockGlobalClusterDescriberMockRecorder - isgomock struct{} -} - -// MockGlobalClusterDescriberMockRecorder is the mock recorder for MockGlobalClusterDescriber. -type MockGlobalClusterDescriberMockRecorder struct { - mock *MockGlobalClusterDescriber -} - -// NewMockGlobalClusterDescriber creates a new mock instance. -func NewMockGlobalClusterDescriber(ctrl *gomock.Controller) *MockGlobalClusterDescriber { - mock := &MockGlobalClusterDescriber{ctrl: ctrl} - mock.recorder = &MockGlobalClusterDescriberMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGlobalClusterDescriber) EXPECT() *MockGlobalClusterDescriberMockRecorder { - return m.recorder -} - -// GlobalCluster mocks base method. -func (m *MockGlobalClusterDescriber) GlobalCluster(arg0, arg1 string) (*admin.GeoSharding, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GlobalCluster", arg0, arg1) - ret0, _ := ret[0].(*admin.GeoSharding) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GlobalCluster indicates an expected call of GlobalCluster. -func (mr *MockGlobalClusterDescriberMockRecorder) GlobalCluster(arg0, arg1 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GlobalCluster", reflect.TypeOf((*MockGlobalClusterDescriber)(nil).GlobalCluster), arg0, arg1) -} diff --git a/internal/mocks/mock_serverless_private_endpoints.go b/internal/mocks/mock_serverless_private_endpoints.go deleted file mode 100644 index dd42b53541..0000000000 --- a/internal/mocks/mock_serverless_private_endpoints.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store (interfaces: ServerlessPrivateEndpointsLister) -// -// Generated by this command: -// -// mockgen -destination=../mocks/mock_serverless_private_endpoints.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store ServerlessPrivateEndpointsLister -// - -// Package mocks is a generated GoMock package. -package mocks - -import ( - reflect "reflect" - - admin "go.mongodb.org/atlas-sdk/v20240530005/admin" - gomock "go.uber.org/mock/gomock" -) - -// MockServerlessPrivateEndpointsLister is a mock of ServerlessPrivateEndpointsLister interface. -type MockServerlessPrivateEndpointsLister struct { - ctrl *gomock.Controller - recorder *MockServerlessPrivateEndpointsListerMockRecorder - isgomock struct{} -} - -// MockServerlessPrivateEndpointsListerMockRecorder is the mock recorder for MockServerlessPrivateEndpointsLister. -type MockServerlessPrivateEndpointsListerMockRecorder struct { - mock *MockServerlessPrivateEndpointsLister -} - -// NewMockServerlessPrivateEndpointsLister creates a new mock instance. -func NewMockServerlessPrivateEndpointsLister(ctrl *gomock.Controller) *MockServerlessPrivateEndpointsLister { - mock := &MockServerlessPrivateEndpointsLister{ctrl: ctrl} - mock.recorder = &MockServerlessPrivateEndpointsListerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockServerlessPrivateEndpointsLister) EXPECT() *MockServerlessPrivateEndpointsListerMockRecorder { - return m.recorder -} - -// ServerlessPrivateEndpoints mocks base method. -func (m *MockServerlessPrivateEndpointsLister) ServerlessPrivateEndpoints(arg0, arg1 string) ([]admin.ServerlessTenantEndpoint, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ServerlessPrivateEndpoints", arg0, arg1) - ret0, _ := ret[0].([]admin.ServerlessTenantEndpoint) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ServerlessPrivateEndpoints indicates an expected call of ServerlessPrivateEndpoints. -func (mr *MockServerlessPrivateEndpointsListerMockRecorder) ServerlessPrivateEndpoints(arg0, arg1 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServerlessPrivateEndpoints", reflect.TypeOf((*MockServerlessPrivateEndpointsLister)(nil).ServerlessPrivateEndpoints), arg0, arg1) -} diff --git a/internal/store/encryption_at_rest.go b/internal/store/encryption_at_rest.go deleted file mode 100644 index 46b6926dd2..0000000000 --- a/internal/store/encryption_at_rest.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2022 MongoDB Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -import ( - atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin" -) - -//go:generate mockgen -destination=../mocks/mock_encryption_at_rest.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store EncryptionAtRestDescriber - -type EncryptionAtRestDescriber interface { - EncryptionAtRest(string) (*atlasv2.EncryptionAtRest, error) -} - -func (s *Store) EncryptionAtRest(projectID string) (*atlasv2.EncryptionAtRest, error) { - result, _, err := s.clientv2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(s.ctx, projectID).Execute() - return result, err -} diff --git a/internal/store/global_cluster.go b/internal/store/global_cluster.go deleted file mode 100644 index 0a88618254..0000000000 --- a/internal/store/global_cluster.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2023 MongoDB Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -import ( - atlasClustersPinned "go.mongodb.org/atlas-sdk/v20240530005/admin" -) - -//go:generate mockgen -destination=../mocks/mock_global_cluster.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store GlobalClusterDescriber - -type GlobalClusterDescriber interface { - GlobalCluster(string, string) (*atlasClustersPinned.GeoSharding, error) -} - -func (s *Store) GlobalCluster(projectID, instanceName string) (*atlasClustersPinned.GeoSharding, error) { - result, _, err := s.clientClusters.GlobalClustersApi.GetManagedNamespace(s.ctx, projectID, instanceName).Execute() - return result, err -} diff --git a/internal/store/serverless_private_endpoints.go b/internal/store/serverless_private_endpoints.go deleted file mode 100644 index fccb44094c..0000000000 --- a/internal/store/serverless_private_endpoints.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2022 MongoDB Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -import ( - atlasClustersPinned "go.mongodb.org/atlas-sdk/v20240530005/admin" -) - -//go:generate mockgen -destination=../mocks/mock_serverless_private_endpoints.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store ServerlessPrivateEndpointsLister - -type ServerlessPrivateEndpointsLister interface { - ServerlessPrivateEndpoints(string, string) ([]atlasClustersPinned.ServerlessTenantEndpoint, error) -} - -func (s *Store) ServerlessPrivateEndpoints(projectID, instanceName string) ([]atlasClustersPinned.ServerlessTenantEndpoint, error) { - result, _, err := s.clientClusters.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpoints(s.ctx, projectID, instanceName).Execute() - return result, err -}