Skip to content

Commit

Permalink
Rename the function name
Browse files Browse the repository at this point in the history
  • Loading branch information
Shilpa-Gokul committed May 17, 2024
1 parent 35a1dcf commit e7000af
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cloud/scope/powervs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,12 @@ func (s *PowerVSClusterScope) IsPowerVSZoneSupportsPER() error {
return fmt.Errorf("powervs zone is not set")
}
// fetch the datacenter capabilities for zone.
datacenter, err := s.IBMPowerVSClient.GetDatacenters(*zone)
datacenterCapabilities, err := s.IBMPowerVSClient.GetDatacenterCapabilities(*zone)
if err != nil {
return err
}
// check for the PER support in datacenter capabilities.
perAvailable, ok := datacenter.Capabilities[powerEdgeRouter]
perAvailable, ok := datacenterCapabilities[powerEdgeRouter]
if !ok {
return fmt.Errorf("%s capability unknown for zone: %s", powerEdgeRouter, *zone)
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/cloud/services/powervs/mock/powervs_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cloud/services/powervs/powervs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 3 additions & 3 deletions pkg/cloud/services/powervs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

0 comments on commit e7000af

Please sign in to comment.