@@ -37,7 +37,7 @@ type OCMInterface interface {
3737 GetClusterActiveAccessRequest (ocmConnection * ocmsdk.Connection , clusterID string ) (* acctrspv1.AccessRequest , error )
3838 CreateClusterAccessRequest (ocmConnection * ocmsdk.Connection , clusterID , reason , jiraIssueID , approvalDuration string ) (* acctrspv1.AccessRequest , error )
3939 CreateAccessRequestDecision (ocmConnection * ocmsdk.Connection , accessRequest * acctrspv1.AccessRequest , decision acctrspv1.DecisionDecision , justification string ) (* acctrspv1.Decision , error )
40- GetTrustedIPList () (* cmv1.TrustedIpList , error )
40+ GetTrustedIPList (* ocmsdk. Connection ) (* cmv1.TrustedIpList , error )
4141 SetupOCMConnection () (* ocmsdk.Connection , error )
4242}
4343
@@ -54,7 +54,6 @@ var DefaultOCMInterface OCMInterface = &DefaultOCMInterfaceImpl{}
5454
5555// SetupOCMConnection setups the ocm connection for all the other ocm requests
5656func (o * DefaultOCMInterfaceImpl ) SetupOCMConnection () (* ocmsdk.Connection , error ) {
57-
5857 envURL := os .Getenv ("OCM_URL" )
5958 if envURL != "" {
6059 // Fetch the real ocm url from the alias and set it back to the ENV
@@ -478,14 +477,7 @@ func (o *DefaultOCMInterfaceImpl) CreateAccessRequestDecision(ocmConnection *ocm
478477 return accessRequestDecision , nil
479478}
480479
481- func (o * DefaultOCMInterfaceImpl ) GetTrustedIPList () (* cmv1.TrustedIpList , error ) {
482- // Create the client for the OCM API
483- connection , err := o .SetupOCMConnection ()
484- if err != nil {
485- return nil , fmt .Errorf ("failed to create OCM connection: %v" , err )
486- }
487- defer connection .Close ()
488-
480+ func (o * DefaultOCMInterfaceImpl ) GetTrustedIPList (connection * ocmsdk.Connection ) (* cmv1.TrustedIpList , error ) {
489481 responseTrustedIP , err := connection .ClustersMgmt ().V1 ().TrustedIPAddresses ().List ().Send ()
490482 if err != nil {
491483
0 commit comments