plan

package
v0.0.0-...-5abfebf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PlanRequest

type PlanRequest struct {
	Name      string                `json:"name" validate:"required"`
	Type      plan.Type             `json:"type" validate:"required"`
	Schedule  string                `json:"schedule"`
	ModuleID  int                   `json:"module_id" validate:"required"`
	Variables []PlanVariableRequest `json:"variables"`
}

type PlanVariableRequest

type PlanVariableRequest struct {
	Key       string                `json:"key" validate:"required"`
	Value     string                `json:"value" validate:"required"`
	Category  planVariable.Category `json:"category" validate:"required"`
	Sensitive bool                  `json:"sensitive"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service struct manages interactions with activities store

func New

func New(db *gorm.DB) Service

New creates a new Service struct

func (*Service) Add

func (s *Service) Add(ctx *gin.Context, req PlanRequest) (plan.Plan, error)

Add creates a new plan in the database

func (*Service) AddValidation

func (s *Service) AddValidation(req PlanRequest) error

AddValidation validates the request to add a plan to the database

func (*Service) Cancel

func (s *Service) Cancel(ctx *gin.Context, id int) error

Cancel cancels a plan in the database Only plans in pending or running state can be cancelled TODO: Notify all workers to stop processing the plan

func (*Service) PaginateList

func (s *Service) PaginateList(ctx *gin.Context) ([]plan.Plan, error)

PaginateList retrieves a paginated list of plan entries from the database

func (*Service) Read

func (s *Service) Read(id int) (plan.Plan, error)

Read retrieves a plan entry from the database

func (*Service) Retry

func (s *Service) Retry(ctx *gin.Context, id int) error

Retry retries a plan in the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL