Documentation
¶
Index ¶
Constants ¶
View Source
const ( ActionTypeSMTP = "smtp" ActionTypeSMPP = "smpp" ActionTypeAlarm = "alarm" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RuleRepository ¶
type RuleRepository interface {
// Save persists multiple rules. Rules are saved using a transaction.
// If one rule fails then none will be saved.
// Successful operation is indicated by a non-nil error response.
Save(ctx context.Context, rules ...Rule) ([]Rule, error)
// RetrieveByID retrieves a rule having the provided identifier.
RetrieveByID(ctx context.Context, id string) (Rule, error)
// RetrieveByProfile retrieves rules assigned to a certain profile.
RetrieveByProfile(ctx context.Context, profileID string, pm apiutil.PageMetadata) (RulesPage, error)
// RetrieveByGroup retrieves rules assigned to a certain group.
RetrieveByGroup(ctx context.Context, groupID string, pm apiutil.PageMetadata) (RulesPage, error)
// Update performs an update to the existing rule. A non-nil error is
// returned to indicate operation failure.
Update(ctx context.Context, r Rule) error
// Remove removes the rules having the provided identifiers.
Remove(ctx context.Context, ids ...string) error
}
type RulesPage ¶
type RulesPage struct {
apiutil.PageMetadata
Rules []Rule
}
type Service ¶
type Service interface {
// CreateRules creates rules.
CreateRules(ctx context.Context, token string, rules ...Rule) ([]Rule, error)
// ListRulesByProfile retrieves a paginated list of rules by profile.
ListRulesByProfile(ctx context.Context, token, profileID string, pm apiutil.PageMetadata) (RulesPage, error)
// ListRulesByGroup retrieves a paginated list of rules by group.
ListRulesByGroup(ctx context.Context, token, groupID string, pm apiutil.PageMetadata) (RulesPage, error)
// ViewRule retrieves a specific rule by its ID.
ViewRule(ctx context.Context, token, id string) (Rule, error)
// UpdateRule updates the rule identified by the provided ID.
UpdateRule(ctx context.Context, token string, rule Rule) error
// RemoveRules removes the rules identified with the provided IDs.
RemoveRules(ctx context.Context, token string, ids ...string) error
// Publish publishes messages on a topic related to a certain rule action
Publish(ctx context.Context, message protomfx.Message) error
}
Service specifies an API for managing rules.
func New ¶
func New(rules RuleRepository, things protomfx.ThingsServiceClient, publisher messaging.Publisher, idp uuid.IDProvider) Service
New instantiates the rules service implementation.
Click to show internal directories.
Click to hide internal directories.