alarmaction

package
v0.0.0-...-0ad5b3e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Ack(c *gin.Context)
	AckRemove(c *gin.Context)
	Snooze(c *gin.Context)
	Cancel(c *gin.Context)
	Uncancel(c *gin.Context)
	AssocTicket(c *gin.Context)
	Comment(c *gin.Context)
	ChangeState(c *gin.Context)
	BulkAck(c *gin.Context)
	BulkAckRemove(c *gin.Context)
	BulkSnooze(c *gin.Context)
	BulkCancel(c *gin.Context)
	BulkUncancel(c *gin.Context)
	BulkAssocTicket(c *gin.Context)
	BulkComment(c *gin.Context)
	BulkChangeState(c *gin.Context)
	AddBookmark(c *gin.Context)
	RemoveBookmark(c *gin.Context)
}

func NewApi

func NewApi(store Store, logger zerolog.Logger) API

type AckRequest

type AckRequest struct {
	AckResources bool   `json:"ack_resources"`
	Comment      string `json:"comment" binding:"max=255"`
}

type AssocTicketRequest

type AssocTicketRequest struct {
	Ticket          string            `json:"ticket" binding:"required"`
	Url             string            `json:"url" binding:"max=255"`
	Comment         string            `json:"comment" binding:"max=255"`
	SystemName      string            `json:"system_name" binding:"max=255"`
	Data            map[string]string `json:"data"`
	TicketResources bool              `json:"ticket_resources"`
}

type BulkAckRequestItem

type BulkAckRequestItem struct {
	AckRequest
	ID string `json:"_id" binding:"required"`
}

type BulkAssocTicketRequestItem

type BulkAssocTicketRequestItem struct {
	AssocTicketRequest
	ID string `json:"_id" binding:"required"`
}

type BulkChangeStateRequestItem

type BulkChangeStateRequestItem struct {
	ChangeStateRequest
	ID string `json:"_id" binding:"required"`
}

type BulkCommentRequestItem

type BulkCommentRequestItem struct {
	CommentRequest
	ID string `json:"_id" binding:"required"`
}

type BulkRequestItem

type BulkRequestItem struct {
	Request
	ID string `json:"_id" binding:"required"`
}

type BulkSnoozeRequestItem

type BulkSnoozeRequestItem struct {
	SnoozeRequest
	ID string `json:"_id" binding:"required"`
}

type ChangeStateRequest

type ChangeStateRequest struct {
	State   *int64 `json:"state" binding:"required,oneof=0 1 2 3"`
	Comment string `json:"comment" binding:"max=255"`
}

type CommentRequest

type CommentRequest struct {
	Comment string `json:"comment" binding:"required,max=255"`
}

type Request

type Request struct {
	Comment string `json:"comment" binding:"max=255"`
}

type SnoozeRequest

type SnoozeRequest struct {
	Duration datetime.DurationWithUnit `json:"duration" binding:"required"`
	Comment  string                    `json:"comment" binding:"max=255"`
}

type Store

type Store interface {
	Ack(ctx context.Context, id string, r AckRequest, userID, username string) (bool, error)
	AckRemove(ctx context.Context, id string, r Request, userID, username string) (bool, error)
	Snooze(ctx context.Context, id string, r SnoozeRequest, userID, username string) (bool, error)
	Cancel(ctx context.Context, id string, r Request, userID, username string) (bool, error)
	Uncancel(ctx context.Context, id string, r Request, userID, username string) (bool, error)
	AssocTicket(ctx context.Context, id string, r AssocTicketRequest, userID, username string) (bool, error)
	Comment(ctx context.Context, id string, r CommentRequest, userID, username string) (bool, error)
	ChangeState(ctx context.Context, id string, r ChangeStateRequest, userID, username string) (bool, error)
	AddBookmark(ctx context.Context, alarmID, userID string) (bool, error)
	RemoveBookmark(ctx context.Context, alarmID, userID string) (bool, error)
}

func NewStore

func NewStore(
	dbClient libmongo.DbClient,
	amqpPublisher libamqp.Publisher,
	exchange, queue string,
	encoder encoding.Encoder,
	contentType string,
	eventGenerator libevent.Generator,
	logger zerolog.Logger,
) Store

Jump to

Keyboard shortcuts

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