...

Source file src/edge-infra.dev/pkg/edge/edgeadmin/commands/operatorintervention/delete/delete.go

Documentation: edge-infra.dev/pkg/edge/edgeadmin/commands/operatorintervention/delete

     1  package delete
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"edge-infra.dev/pkg/edge/api/graph/model"
     7  	"edge-infra.dev/pkg/edge/edgeadmin/commands/operatorintervention/format"
     8  	"edge-infra.dev/pkg/edge/edgecli"
     9  	"edge-infra.dev/pkg/lib/cli/command"
    10  )
    11  
    12  func NewCmd(cfg *edgecli.Config) *command.Command {
    13  	return &command.Command{
    14  		ShortUsage: "edgeadmin operatorintervention delete",
    15  		ShortHelp:  "Commands to delete operator intervention configuration",
    16  		Commands: []*command.Command{
    17  			NewDeleteCommand(cfg),
    18  			NewDeletePrivilege(cfg),
    19  			NewDeleteRoleMapping(cfg),
    20  			NewDeleteRule(cfg),
    21  		},
    22  	}
    23  }
    24  
    25  // handleResponseFormatting is a helper for pretty printing the output from the
    26  // mutation. Can be used for each mutation type with a different commandType
    27  func handleResponseFormatting(mutationType string, errors []*model.OperatorInterventionErrorResponse) error {
    28  	fmt.Println(format.GenerateDeleteOutput(mutationType, errors))
    29  
    30  	if len(errors) != 0 {
    31  		// Return empty error to guarantee binary non-zero exit code.
    32  		// Error details have already been printed, so return an empty
    33  		// error. This does unfortunately print an extra blank line on
    34  		// the output
    35  		return fmt.Errorf("")
    36  	}
    37  
    38  	return nil
    39  }
    40  

View as plain text