Skip to content

Commit

Permalink
validate static refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
niontive authored and petrkotas committed Jul 18, 2023
1 parent d563aee commit ebb825e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/api/admin/openshiftcluster_validatestatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ func (sv openShiftClusterStaticValidator) validateDelta(oc, current *OpenShiftCl
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodePropertyChangeNotAllowed, err.Target, err.Message)
}

if !(oc.Properties.MaintenanceTask == "" ||
oc.Properties.MaintenanceTask == MaintenanceTaskEverything ||
oc.Properties.MaintenanceTask == MaintenanceTaskOperator ||
oc.Properties.MaintenanceTask == MaintenanceTaskRenewCerts ||
oc.Properties.MaintenanceTask == MaintenanceTaskPucmPending) {
return validateMaintenanceTask(oc.Properties.MaintenanceTask)
}

func validateMaintenanceTask(task MaintenanceTask) error {
if !(task == "" ||
task == MaintenanceTaskEverything ||
task == MaintenanceTaskOperator ||
task == MaintenanceTaskRenewCerts ||
task == MaintenanceTaskPucmPending) {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.maintenanceTask", "Invalid enum parameter.")
}

Expand Down

0 comments on commit ebb825e

Please sign in to comment.