diff --git a/pkg/cloud/services/powervs/mock/powervs_generated.go b/pkg/cloud/services/powervs/mock/powervs_generated.go index 9b92715485..86cf76be75 100644 --- a/pkg/cloud/services/powervs/mock/powervs_generated.go +++ b/pkg/cloud/services/powervs/mock/powervs_generated.go @@ -246,19 +246,19 @@ func (mr *MockPowerVSMockRecorder) GetDHCPServer(id any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDHCPServer", reflect.TypeOf((*MockPowerVS)(nil).GetDHCPServer), id) } -// GetDatacenters mocks base method. -func (m *MockPowerVS) GetDatacenters(zone string) (*models.Datacenter, error) { +// GetDatacenterCapabilities mocks base method. +func (m *MockPowerVS) GetDatacenterCapabilities(zone string) (map[string]bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDatacenters", zone) - ret0, _ := ret[0].(*models.Datacenter) + ret := m.ctrl.Call(m, "GetDatacenterCapabilities", zone) + ret0, _ := ret[0].(map[string]bool) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetDatacenters indicates an expected call of GetDatacenters. -func (mr *MockPowerVSMockRecorder) GetDatacenters(zone any) *gomock.Call { +// GetDatacenterCapabilities indicates an expected call of GetDatacenterCapabilities. +func (mr *MockPowerVSMockRecorder) GetDatacenterCapabilities(zone any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDatacenters", reflect.TypeOf((*MockPowerVS)(nil).GetDatacenters), zone) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDatacenterCapabilities", reflect.TypeOf((*MockPowerVS)(nil).GetDatacenterCapabilities), zone) } // GetImage mocks base method. diff --git a/pkg/cloud/services/powervs/powervs.go b/pkg/cloud/services/powervs/powervs.go index 049225c179..b6e1736c72 100644 --- a/pkg/cloud/services/powervs/powervs.go +++ b/pkg/cloud/services/powervs/powervs.go @@ -44,5 +44,5 @@ type PowerVS interface { DeleteDHCPServer(id string) error WithClients(options ServiceOptions) *Service GetNetworkByName(networkName string) (*models.NetworkReference, error) - GetDatacenters(zone string) (*models.Datacenter, error) + GetDatacenterCapabilities(zone string) (map[string]bool, error) } diff --git a/pkg/cloud/services/powervs/service.go b/pkg/cloud/services/powervs/service.go index 015bc32b14..08f14928f7 100644 --- a/pkg/cloud/services/powervs/service.go +++ b/pkg/cloud/services/powervs/service.go @@ -188,8 +188,8 @@ func (s *Service) GetNetworkByName(networkName string) (*models.NetworkReference return network, nil } -// GetDatacenters fetches the datacenter capabilities for the given zone. -func (s *Service) GetDatacenters(zone string) (*models.Datacenter, error) { +// GetDatacenterCapabilities fetches the datacenter capabilities for the given zone. +func (s *Service) GetDatacenterCapabilities(zone string) (map[string]bool, error) { // though the function name is WithDatacenterRegion it takes zone as parameter params := datacenters.NewV1DatacentersGetParamsWithContext(context.TODO()).WithDatacenterRegion(zone) datacenter, err := s.session.Power.Datacenters.V1DatacentersGet(params) @@ -199,5 +199,5 @@ func (s *Service) GetDatacenters(zone string) (*models.Datacenter, error) { if datacenter == nil || datacenter.Payload == nil || datacenter.Payload.Capabilities == nil { return nil, fmt.Errorf("failed to get datacenter capabilities for zone: %s", zone) } - return datacenter.Payload, nil + return datacenter.Payload.Capabilities, nil }