File tree Expand file tree Collapse file tree
cmd/harbor/root/jobservice/schedules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
1818
1919 "github.com/goharbor/harbor-cli/pkg/api"
2020 "github.com/goharbor/harbor-cli/pkg/utils"
21+ jobserviceutils "github.com/goharbor/harbor-cli/pkg/utils/jobservice"
2122 "github.com/goharbor/harbor-cli/pkg/views/jobservice/schedules"
2223 "github.com/spf13/cobra"
2324 "github.com/spf13/viper"
@@ -43,7 +44,7 @@ func ListCommand() *cobra.Command {
4344
4445 response , err := api .ListSchedules (page , pageSize )
4546 if err != nil {
46- return formatScheduleError ("failed to retrieve schedules" , err , "ActionList" )
47+ return jobserviceutils . FormatScheduleError ("failed to retrieve schedules" , err , "ActionList" )
4748 }
4849
4950 if response == nil || response .Payload == nil || len (response .Payload ) == 0 {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
1717 "fmt"
1818
1919 "github.com/goharbor/harbor-cli/pkg/api"
20+ jobserviceutils "github.com/goharbor/harbor-cli/pkg/utils/jobservice"
2021 "github.com/spf13/cobra"
2122)
2223
@@ -31,7 +32,7 @@ func PauseAllCommand() *cobra.Command {
3132 fmt .Println ("Pausing all schedules..." )
3233 err := api .ActionJobQueue ("SCHEDULER" , "pause" )
3334 if err != nil {
34- return formatScheduleError ("failed to pause all schedules" , err , "ActionStop" )
35+ return jobserviceutils . FormatScheduleError ("failed to pause all schedules" , err , "ActionStop" )
3536 }
3637 fmt .Println ("✓ All schedules paused successfully." )
3738 return nil
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
1717 "fmt"
1818
1919 "github.com/goharbor/harbor-cli/pkg/api"
20+ jobserviceutils "github.com/goharbor/harbor-cli/pkg/utils/jobservice"
2021 "github.com/spf13/cobra"
2122)
2223
@@ -31,7 +32,7 @@ func ResumeAllCommand() *cobra.Command {
3132 fmt .Println ("Resuming all schedules..." )
3233 err := api .ActionJobQueue ("SCHEDULER" , "resume" )
3334 if err != nil {
34- return formatScheduleError ("failed to resume all schedules" , err , "ActionStop" )
35+ return jobserviceutils . FormatScheduleError ("failed to resume all schedules" , err , "ActionStop" )
3536 }
3637 fmt .Println ("✓ All schedules resumed successfully." )
3738 return nil
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
1818
1919 "github.com/goharbor/harbor-cli/pkg/api"
2020 "github.com/goharbor/harbor-cli/pkg/utils"
21+ jobserviceutils "github.com/goharbor/harbor-cli/pkg/utils/jobservice"
2122 "github.com/goharbor/harbor-cli/pkg/views/jobservice/schedules"
2223 "github.com/spf13/cobra"
2324 "github.com/spf13/viper"
@@ -33,7 +34,7 @@ func StatusCommand() *cobra.Command {
3334 RunE : func (cmd * cobra.Command , args []string ) error {
3435 response , err := api .GetSchedulePaused ()
3536 if err != nil {
36- return formatScheduleError ("failed to retrieve scheduler status" , err , "authenticated" )
37+ return jobserviceutils . FormatScheduleError ("failed to retrieve scheduler status" , err , "authenticated" )
3738 }
3839
3940 if response == nil || response .Payload == nil {
Original file line number Diff line number Diff line change 1111// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212// See the License for the specific language governing permissions and
1313// limitations under the License.
14- package schedules
14+ package jobservice
1515
1616import (
1717 "fmt"
1818
1919 "github.com/goharbor/harbor-cli/pkg/utils"
2020)
2121
22- func formatScheduleError (operation string , err error , requiredPermission string ) error {
22+ func FormatScheduleError (operation string , err error , requiredPermission string ) error {
2323 errorCode := utils .ParseHarborErrorCode (err )
2424
2525 switch errorCode {
You can’t perform that action at this time.
0 commit comments