From 1fb2dd0dc94ad37d0f46f7b627f104fcf4ececb6 Mon Sep 17 00:00:00 2001 From: Johannes Malsam Date: Wed, 2 Oct 2024 09:30:40 +0200 Subject: [PATCH] more dinosaur replacements --- internal/dinosaur/pkg/services/dinosaur.go | 18 +++++++++--------- .../pkg/services/dinosaurservice_moq.go | 14 +++++++------- .../dinosaurmgrs/centrals_routes_cname_mgr.go | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/dinosaur/pkg/services/dinosaur.go b/internal/dinosaur/pkg/services/dinosaur.go index 5de29d1ed..9b8c8cef9 100644 --- a/internal/dinosaur/pkg/services/dinosaur.go +++ b/internal/dinosaur/pkg/services/dinosaur.go @@ -45,14 +45,14 @@ var ( } ) -// DinosaurRoutesAction ... -type DinosaurRoutesAction string +// CentralRoutesAction ... +type CentralRoutesAction string -// DinosaurRoutesActionCreate ... -const DinosaurRoutesActionCreate DinosaurRoutesAction = "CREATE" +// CentralRoutesActionCreate ... +const CentralRoutesActionCreate CentralRoutesAction = "CREATE" -// DinosaurRoutesActionDelete ... -const DinosaurRoutesActionDelete DinosaurRoutesAction = "DELETE" +// CentralRoutesActionDelete ... +const CentralRoutesActionDelete CentralRoutesAction = "DELETE" const gracePeriod = 14 * 24 * time.Hour @@ -96,7 +96,7 @@ type DinosaurService interface { // Use this only when you want to update the multiple columns that may contain zero-fields, otherwise use the `DinosaurService.Update()` method. // See https://gorm.io/docs/update.html#Updates-multiple-columns for more info Updates(dinosaurRequest *dbapi.CentralRequest, values map[string]interface{}) *errors.ServiceError - ChangeCentralCNAMErecords(dinosaurRequest *dbapi.CentralRequest, action DinosaurRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *errors.ServiceError) + ChangeCentralCNAMErecords(dinosaurRequest *dbapi.CentralRequest, action CentralRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *errors.ServiceError) GetCNAMERecordStatus(dinosaurRequest *dbapi.CentralRequest) (*CNameRecordStatus, error) DetectInstanceType(dinosaurRequest *dbapi.CentralRequest) types.DinosaurInstanceType RegisterDinosaurDeprovisionJob(ctx context.Context, id string) *errors.ServiceError @@ -594,7 +594,7 @@ func (k *dinosaurService) Delete(centralRequest *dbapi.CentralRequest, force boo } // Only delete the routes when they are set if routes != nil && k.centralConfig.EnableCentralExternalCertificate { - _, err := k.ChangeCentralCNAMErecords(centralRequest, DinosaurRoutesActionDelete) + _, err := k.ChangeCentralCNAMErecords(centralRequest, CentralRoutesActionDelete) if err != nil { if force { glog.Warningf("Failed to delete CNAME records for Central tenant %q: %v", centralRequest.ID, err) @@ -775,7 +775,7 @@ func (k *dinosaurService) UpdateStatus(id string, status dinosaurConstants.Centr } // ChangeCentralCNAMErecords ... -func (k *dinosaurService) ChangeCentralCNAMErecords(centralRequest *dbapi.CentralRequest, action DinosaurRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *errors.ServiceError) { +func (k *dinosaurService) ChangeCentralCNAMErecords(centralRequest *dbapi.CentralRequest, action CentralRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *errors.ServiceError) { routes, err := centralRequest.GetRoutes() if routes == nil || err != nil { return nil, errors.NewWithCause(errors.ErrorGeneral, err, "failed to get routes") diff --git a/internal/dinosaur/pkg/services/dinosaurservice_moq.go b/internal/dinosaur/pkg/services/dinosaurservice_moq.go index 7db583694..9ba5089fe 100644 --- a/internal/dinosaur/pkg/services/dinosaurservice_moq.go +++ b/internal/dinosaur/pkg/services/dinosaurservice_moq.go @@ -31,7 +31,7 @@ var _ DinosaurService = &DinosaurServiceMock{} // ChangeBillingParametersFunc: func(ctx context.Context, centralID string, billingModel string, cloudAccountID string, cloudProvider string, product string) *serviceError.ServiceError { // panic("mock out the ChangeBillingParameters method") // }, -// ChangeCentralCNAMErecordsFunc: func(dinosaurRequest *dbapi.CentralRequest, action DinosaurRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) { +// ChangeCentralCNAMErecordsFunc: func(dinosaurRequest *dbapi.CentralRequest, action CentralRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) { // panic("mock out the ChangeCentralCNAMErecords method") // }, // CountByRegionAndInstanceTypeFunc: func() ([]DinosaurRegionCount, error) { @@ -120,7 +120,7 @@ type DinosaurServiceMock struct { ChangeBillingParametersFunc func(ctx context.Context, centralID string, billingModel string, cloudAccountID string, cloudProvider string, product string) *serviceError.ServiceError // ChangeCentralCNAMErecordsFunc mocks the ChangeCentralCNAMErecords method. - ChangeCentralCNAMErecordsFunc func(dinosaurRequest *dbapi.CentralRequest, action DinosaurRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) + ChangeCentralCNAMErecordsFunc func(dinosaurRequest *dbapi.CentralRequest, action CentralRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) // CountByRegionAndInstanceTypeFunc mocks the CountByRegionAndInstanceType method. CountByRegionAndInstanceTypeFunc func() ([]DinosaurRegionCount, error) @@ -221,7 +221,7 @@ type DinosaurServiceMock struct { // DinosaurRequest is the dinosaurRequest argument value. DinosaurRequest *dbapi.CentralRequest // Action is the action argument value. - Action DinosaurRoutesAction + Action CentralRoutesAction } // CountByRegionAndInstanceType holds details about calls to the CountByRegionAndInstanceType method. CountByRegionAndInstanceType []struct { @@ -472,13 +472,13 @@ func (mock *DinosaurServiceMock) ChangeBillingParametersCalls() []struct { } // ChangeCentralCNAMErecords calls ChangeCentralCNAMErecordsFunc. -func (mock *DinosaurServiceMock) ChangeCentralCNAMErecords(dinosaurRequest *dbapi.CentralRequest, action DinosaurRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) { +func (mock *DinosaurServiceMock) ChangeCentralCNAMErecords(dinosaurRequest *dbapi.CentralRequest, action CentralRoutesAction) (*route53.ChangeResourceRecordSetsOutput, *serviceError.ServiceError) { if mock.ChangeCentralCNAMErecordsFunc == nil { panic("DinosaurServiceMock.ChangeCentralCNAMErecordsFunc: method is nil but DinosaurService.ChangeCentralCNAMErecords was just called") } callInfo := struct { DinosaurRequest *dbapi.CentralRequest - Action DinosaurRoutesAction + Action CentralRoutesAction }{ DinosaurRequest: dinosaurRequest, Action: action, @@ -495,11 +495,11 @@ func (mock *DinosaurServiceMock) ChangeCentralCNAMErecords(dinosaurRequest *dbap // len(mockedDinosaurService.ChangeCentralCNAMErecordsCalls()) func (mock *DinosaurServiceMock) ChangeCentralCNAMErecordsCalls() []struct { DinosaurRequest *dbapi.CentralRequest - Action DinosaurRoutesAction + Action CentralRoutesAction } { var calls []struct { DinosaurRequest *dbapi.CentralRequest - Action DinosaurRoutesAction + Action CentralRoutesAction } mock.lockChangeCentralCNAMErecords.RLock() calls = mock.calls.ChangeCentralCNAMErecords diff --git a/internal/dinosaur/pkg/workers/dinosaurmgrs/centrals_routes_cname_mgr.go b/internal/dinosaur/pkg/workers/dinosaurmgrs/centrals_routes_cname_mgr.go index c9973a3cc..e0d565878 100644 --- a/internal/dinosaur/pkg/workers/dinosaurmgrs/centrals_routes_cname_mgr.go +++ b/internal/dinosaur/pkg/workers/dinosaurmgrs/centrals_routes_cname_mgr.go @@ -62,7 +62,7 @@ func (k *CentralRoutesCNAMEManager) Reconcile() []error { if central.RoutesCreationID == "" { glog.Infof("creating CNAME records for central %s", central.ID) - changeOutput, err := k.centralService.ChangeCentralCNAMErecords(central, services.DinosaurRoutesActionCreate) + changeOutput, err := k.centralService.ChangeCentralCNAMErecords(central, services.CentralRoutesActionCreate) if err != nil { errs = append(errs, err)