Documentation ¶
Overview ¶
Package alert works with the MarkLogic Alerting API
Index ¶
- type Rule
- type RulesResponse
- type RulesResponseHandle
- func (rh *RulesResponseHandle) AcceptResponse(resp *http.Response) error
- func (rh *RulesResponseHandle) Deserialize(bytes []byte)
- func (rh *RulesResponseHandle) Deserialized() interface{}
- func (rh *RulesResponseHandle) Get() *RulesResponse
- func (rh *RulesResponseHandle) GetFormat() int
- func (rh *RulesResponseHandle) Serialize(response interface{})
- func (rh *RulesResponseHandle) Serialized() string
- func (rh *RulesResponseHandle) SetTimestamp(timestamp string)
- func (rh *RulesResponseHandle) Timestamp() string
- type Service
- func (s *Service) AddRule(ruleName string, rule handle.Handle, params map[string]string, ...) error
- func (s *Service) GetRule(ruleName string, params map[string]string, response handle.ResponseHandle) error
- func (s *Service) ListRules(params map[string]string, response handle.ResponseHandle) error
- func (s *Service) MatchDocument(document documents.DocumentDescription, params map[string]string, ...) error
- func (s *Service) MatchQuery(query handle.Handle, params map[string]string, response handle.ResponseHandle) error
- func (s *Service) RemoveRule(ruleName string, params map[string]string, response handle.ResponseHandle) error
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 ¶
func (rh *RulesResponseHandle) Get() *RulesResponse
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 ¶
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) 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