alert

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package alert works with the MarkLogic Alerting API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	Name         string                     `xml:"name" json:"name,omitempty"`
	Description  string                     `xml:"description" json:"description,omitempty"`
	Query        search.CombinedQuery       `xml:"http://marklogic.com/appservices/search search" json:"search,omitempty"`
	RuleMetadata util.SerializableStringMap `xml:"rule-metadata" json:"rule-metadata,omitempty"`
}

Rule represents an alert rule from the alert API

type RulesResponse

type RulesResponse struct {
	XMLName xml.Name `xml:"http://marklogic.com/rest-api rules" json:"rules,omitempty"`
	Rules   []Rule   `xml:"rule" json:"rule,omitempty"`
}

RulesResponse represents a response from the alert/rules API

type RulesResponseHandle

type RulesResponseHandle struct {
	*bytes.Buffer
	Format int
	// contains filtered or unexported fields
}

RulesResponseHandle handles a response from the alert/rules API

func (*RulesResponseHandle) AcceptResponse

func (rh *RulesResponseHandle) AcceptResponse(resp *http.Response) error

AcceptResponse handles an *http.Response

func (*RulesResponseHandle) Deserialize

func (rh *RulesResponseHandle) Deserialize(bytes []byte)

Deserialize returns Response struct that represents XML or JSON

func (*RulesResponseHandle) Deserialized

func (rh *RulesResponseHandle) Deserialized() interface{}

Deserialized returns deserialised RestartResponse as interface{}

func (*RulesResponseHandle) Get

Get returns deserialised RestartResponse

func (*RulesResponseHandle) GetFormat

func (rh *RulesResponseHandle) GetFormat() int

GetFormat returns int that represents XML or JSON

func (*RulesResponseHandle) Serialize

func (rh *RulesResponseHandle) Serialize(response interface{})

Serialize returns []byte of XML or JSON that represents the Response struct

func (*RulesResponseHandle) Serialized

func (rh *RulesResponseHandle) Serialized() string

Serialized returns string of XML or JSON

func (*RulesResponseHandle) SetTimestamp

func (rh *RulesResponseHandle) SetTimestamp(timestamp string)

SetTimestamp sets the timestamp

func (*RulesResponseHandle) Timestamp

func (rh *RulesResponseHandle) Timestamp() string

Timestamp retieves a timestamp

type Service

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

Service is used for the alert service

func NewService

func NewService(client *clients.Client) *Service

NewService returns a new alert.Service

func (*Service) AddRule

func (s *Service) AddRule(ruleName string, rule handle.Handle, params map[string]string, response handle.ResponseHandle) error

AddRule add a rule

func (*Service) GetRule

func (s *Service) GetRule(ruleName string, params map[string]string, response handle.ResponseHandle) error

GetRule get a rule

func (*Service) ListRules

func (s *Service) ListRules(params map[string]string, response handle.ResponseHandle) error

ListRules lists rules

func (*Service) MatchDocument

func (s *Service) MatchDocument(document documents.DocumentDescription, params map[string]string, response handle.ResponseHandle) error

MatchDocument finds rules that match a give document

func (*Service) MatchQuery

func (s *Service) MatchQuery(query handle.Handle, params map[string]string, response handle.ResponseHandle) error

MatchQuery find rules that match a given query

func (*Service) RemoveRule

func (s *Service) RemoveRule(ruleName string, params map[string]string, response handle.ResponseHandle) error

RemoveRule remove a rule

Jump to

Keyboard shortcuts

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