Documentation
¶
Index ¶
- Constants
- func ChannelIDsByType(channels []Channel, channelType ChannelType) []string
- func InterfaceMapToStringMap(m map[string]interface{}) map[string]string
- func PayloadToMapInterface(t any) (map[string]interface{}, error)
- func StrictInterfaceMapToStringMap(m map[string]interface{}) (map[string]string, error)
- func WithTx[T any](ctx context.Context, repo Repository, ...) (resp T, err error)
- func WithTxNoValue(ctx context.Context, repo Repository, ...) error
- type Annotations
- type BalanceThreshold
- type BalanceThresholdPayload
- type BalanceThresholdRuleConfig
- type Channel
- type ChannelConfig
- type ChannelConfigMeta
- type ChannelIDsDifference
- func (d ChannelIDsDifference) Additions() []string
- func (d ChannelIDsDifference) All() []string
- func (d ChannelIDsDifference) Has(id string) bool
- func (d ChannelIDsDifference) HasChanged() bool
- func (d ChannelIDsDifference) InAdditions(id string) bool
- func (d ChannelIDsDifference) InRemovals(id string) bool
- func (d ChannelIDsDifference) Removals() []string
- type ChannelMeta
- type ChannelRepository
- type ChannelService
- type ChannelType
- type Config
- type CreateChannelInput
- type CreateEventInput
- type CreateRuleInput
- type DeleteChannelInput
- type DeleteRuleInput
- type Event
- type EventDeliveryStatus
- type EventDeliveryStatusOrderBy
- type EventDeliveryStatusState
- type EventDispatcher
- type EventHandler
- type EventHandlerConfig
- type EventPayload
- func (p EventPayload) AsNotificationEventBalanceThresholdPayload(eventId string, ts time.Time) api.NotificationEventBalanceThresholdPayload
- func (p EventPayload) FromNotificationEventBalanceThresholdPayload(r api.NotificationEventBalanceThresholdPayload) EventPayload
- func (p EventPayload) Validate() error
- type EventPayloadMeta
- type EventReconciler
- type EventRepository
- type EventService
- type EventType
- type FeatureMeta
- type FeatureService
- type GetChannelInput
- type GetEventDeliveryStatusInput
- type GetEventInput
- type GetRuleInput
- type ListChannelsInput
- type ListChannelsResult
- type ListEventsDeliveryStatusInput
- type ListEventsDeliveryStatusResult
- type ListEventsInput
- type ListEventsResult
- type ListRulesInput
- type ListRulesResult
- type NotFoundError
- type Repository
- type Rule
- type RuleConfig
- type RuleConfigMeta
- type RuleOrderBy
- type RuleRepository
- type RuleService
- type RuleType
- type Service
- type TxRepository
- type UpdateAfterDeleteError
- type UpdateChannelInput
- type UpdateEventDeliveryStatusInput
- type UpdateRuleInput
- type ValidationError
- type WebHookChannelConfig
Constants ¶
const ( // AnnotationRuleTestEvent indicates that the event is generated as part of testing a notification rule AnnotationRuleTestEvent = "notification.rule.test" AnnotationEventFeatureKey = "event.feature.key" AnnotationEventFeatureID = "event.feature.id" AnnotationEventSubjectKey = "event.subject.key" AnnotationEventSubjectID = "event.subject.id" AnnotationEventDedupeHash = "event.balance.dedupe.hash" )
const ( ChannelOrderByID = api.ListNotificationChannelsParamsOrderById ChannelOrderByType = api.ListNotificationChannelsParamsOrderByType ChannelOrderByCreatedAt = api.ListNotificationChannelsParamsOrderByCreatedAt ChannelOrderByUpdatedAt = api.ListNotificationChannelsParamsOrderByUpdatedAt )
const ( ChannelOrderAsc = sortx.OrderAsc ChannelOrderDesc = sortx.OrderDesc )
const ( DefaultDisabled = false DefaultPageNumber = 1 DefaultPageSize = 100 )
const ( EventOrderByID = api.ListNotificationEventsParamsOrderById EventOrderByCreatedAt = api.ListNotificationEventsParamsOrderByCreatedAt )
const ( EventDeliveryStatusStateSuccess = EventDeliveryStatusState(api.SUCCESS) EventDeliveryStatusStateFailed = EventDeliveryStatusState(api.FAILED) EventDeliveryStatusStateSending = EventDeliveryStatusState(api.SENDING) EventDeliveryStatusStatePending = EventDeliveryStatusState(api.PENDING) )
const ( DefaultReconcileInterval = 15 * time.Second DefaultDispatchTimeout = 30 * time.Second )
const ( BalanceThresholdTypeNumber = api.NUMBER BalanceThresholdTypePercent = api.PERCENT )
const ( RuleOrderByID = api.ListNotificationRulesParamsOrderById RuleOrderByType = api.ListNotificationRulesParamsOrderByType RuleOrderByCreatedAt = api.ListNotificationRulesParamsOrderByCreatedAt RuleOrderByUpdatedAt = api.ListNotificationRulesParamsOrderByUpdatedAt )
const (
ChannelIDMetadataKey = "om-channel-id"
)
const (
ChannelTypeWebhook = ChannelType(api.WEBHOOK)
)
const (
EventTypeBalanceThreshold = EventType(api.EntitlementsBalanceThreshold)
)
const MaxChannelsPerRule = 5
const (
RuleTypeBalanceThreshold = RuleType(api.EntitlementsBalanceThreshold)
)
Variables ¶
This section is empty.
Functions ¶
func ChannelIDsByType ¶
func ChannelIDsByType(channels []Channel, channelType ChannelType) []string
ChannelIDsByType returns a list of Channel identifiers from Channel slice with the provided ChannelType
func InterfaceMapToStringMap ¶
func PayloadToMapInterface ¶
func WithTx ¶
func WithTx[T any](ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) (T, error)) (resp T, err error)
func WithTxNoValue ¶
func WithTxNoValue(ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) error) error
Types ¶
type Annotations ¶
type Annotations = map[string]interface{}
type BalanceThreshold ¶
type BalanceThreshold = api.NotificationRuleBalanceThresholdValue
type BalanceThresholdPayload ¶
type BalanceThresholdPayload struct { Entitlement api.EntitlementMetered `json:"entitlement"` Feature api.Feature `json:"feature"` Subject api.Subject `json:"subject"` Threshold api.NotificationRuleBalanceThresholdValue `json:"threshold"` Value api.EntitlementValue `json:"value"` }
func (BalanceThresholdPayload) Validate ¶
func (b BalanceThresholdPayload) Validate() error
Validate returns an error if balance threshold payload is invalid.
type BalanceThresholdRuleConfig ¶
type BalanceThresholdRuleConfig struct { // Features stores the list of features the rule is associated with. Features []string `json:"features"` // Thresholds stores the list of thresholds used to trigger a new notification event if the balance exceeds one of the thresholds. Thresholds []BalanceThreshold `json:"thresholds"` }
BalanceThresholdRuleConfig defines the configuration specific to channel with webhook type.
type Channel ¶
type Channel struct { models.NamespacedModel models.ManagedModel // ID is the unique identifier for Channel. ID string `json:"id"` // Type of the notification channel (e.g. webhook) Type ChannelType `json:"type"` // Name of is the user provided name of the Channel. Name string `json:"name"` // Disabled defines whether the Channel is disabled or not. Disabled bool `json:"disabled"` // Config stores the actual Channel configuration specific to the Type. Config ChannelConfig `json:"config"` }
Channel represents a notification channel with specific type and configuration.
func (Channel) AsNotificationChannel ¶
func (c Channel) AsNotificationChannel() (api.NotificationChannel, error)
func (Channel) AsNotificationChannelWebhook ¶
func (c Channel) AsNotificationChannelWebhook() api.NotificationChannelWebhook
type ChannelConfig ¶
type ChannelConfig struct { ChannelConfigMeta // WebHook WebHook WebHookChannelConfig `json:"webhook"` }
ChannelConfig is a union type capturing configuration parameters for all type of channels.
func (ChannelConfig) Validate ¶
func (c ChannelConfig) Validate() error
Validate invokes channel type specific validator and returns an error if channel configuration is invalid.
type ChannelConfigMeta ¶
type ChannelConfigMeta struct {
Type ChannelType `json:"type"`
}
func (ChannelConfigMeta) Validate ¶
func (m ChannelConfigMeta) Validate() error
type ChannelIDsDifference ¶
type ChannelIDsDifference struct {
// contains filtered or unexported fields
}
func NewChannelIDsDifference ¶
func NewChannelIDsDifference(new, old []string) *ChannelIDsDifference
func (ChannelIDsDifference) Additions ¶
func (d ChannelIDsDifference) Additions() []string
func (ChannelIDsDifference) All ¶
func (d ChannelIDsDifference) All() []string
func (ChannelIDsDifference) Has ¶
func (d ChannelIDsDifference) Has(id string) bool
func (ChannelIDsDifference) HasChanged ¶
func (d ChannelIDsDifference) HasChanged() bool
func (ChannelIDsDifference) InAdditions ¶
func (d ChannelIDsDifference) InAdditions(id string) bool
func (ChannelIDsDifference) InRemovals ¶
func (d ChannelIDsDifference) InRemovals(id string) bool
func (ChannelIDsDifference) Removals ¶
func (d ChannelIDsDifference) Removals() []string
type ChannelMeta ¶
type ChannelMeta = api.NotificationChannelMeta
type ChannelRepository ¶
type ChannelRepository interface { ListChannels(ctx context.Context, params ListChannelsInput) (pagination.PagedResponse[Channel], error) CreateChannel(ctx context.Context, params CreateChannelInput) (*Channel, error) DeleteChannel(ctx context.Context, params DeleteChannelInput) error GetChannel(ctx context.Context, params GetChannelInput) (*Channel, error) UpdateChannel(ctx context.Context, params UpdateChannelInput) (*Channel, error) }
type ChannelService ¶
type ChannelService interface { ListChannels(ctx context.Context, params ListChannelsInput) (ListChannelsResult, error) CreateChannel(ctx context.Context, params CreateChannelInput) (*Channel, error) DeleteChannel(ctx context.Context, params DeleteChannelInput) error GetChannel(ctx context.Context, params GetChannelInput) (*Channel, error) UpdateChannel(ctx context.Context, params UpdateChannelInput) (*Channel, error) }
type ChannelType ¶
type ChannelType api.NotificationChannelType
func ChannelTypes ¶
func ChannelTypes(channels []Channel) []ChannelType
ChannelTypes returns a set of ChannelType from Channel slice
func (ChannelType) Validate ¶
func (t ChannelType) Validate() error
func (ChannelType) Values ¶
func (t ChannelType) Values() []string
type Config ¶
type Config struct { FeatureConnector productcatalog.FeatureConnector Repository Repository Webhook webhook.Handler Logger *slog.Logger }
type CreateChannelInput ¶
type CreateChannelInput struct { models.NamespacedModel // Type defines the Channel type (e.g. webhook) Type ChannelType // Name stores the user defined name of the Channel. Name string // Disabled defines whether the Channel is disabled or not. Deleted Channels are always disabled. Disabled bool // Config stores the Channel Type specific configuration. Config ChannelConfig }
func (CreateChannelInput) FromNotificationChannelWebhookCreateRequest ¶
func (i CreateChannelInput) FromNotificationChannelWebhookCreateRequest(r api.NotificationChannelWebhookCreateRequest) CreateChannelInput
type CreateEventInput ¶
type CreateEventInput struct { models.NamespacedModel Annotations Annotations `json:"annotations,omitempty"` // Type of the notification Event (e.g. entitlements.balance.threshold) Type EventType `json:"type"` // Payload is the actual payload sent to Channel as part of the notification Event. Payload EventPayload `json:"payload"` // RuleID defines the notification Rule that generated this Event. RuleID string `json:"ruleId"` // HandlerDeduplicationHash is a hash that the handler can use to deduplicate events if needed HandlerDeduplicationHash string `json:"handlerDeduplicationHash"` }
type CreateRuleInput ¶
type CreateRuleInput struct { models.NamespacedModel // Type defines the Rule type (e.g. entitlements.balance.threshold) Type RuleType // Name stores the user defined name of the Rule. Name string // Disabled defines whether the Rule is disabled or not. Deleted Rules are always disabled. Disabled bool // Config stores the Rule Type specific configuration. Config RuleConfig // Channels defines the list of Channels the Rule needs to send Events. Channels []string }
func (CreateRuleInput) FromNotificationRuleBalanceThresholdCreateRequest ¶
func (i CreateRuleInput) FromNotificationRuleBalanceThresholdCreateRequest(r api.NotificationRuleBalanceThresholdCreateRequest) CreateRuleInput
type DeleteChannelInput ¶
type DeleteChannelInput models.NamespacedID
type DeleteRuleInput ¶
type DeleteRuleInput models.NamespacedID
type Event ¶
type Event struct { models.NamespacedModel Annotations // ID is the unique identifier for Event. ID string `json:"id"` // Type of the notification Event (e.g. entitlements.balance.threshold) Type EventType `json:"type"` // CreatedAt Timestamp when the notification event was created. CreatedAt time.Time `json:"createdAt"` // DeliveryStatus defines the delivery status of the notification Event per Channel. DeliveryStatus []EventDeliveryStatus `json:"deliveryStatus"` // Payload is the actual payload sent to Channel as part of the notification Event. Payload EventPayload `json:"payload"` // Rule defines the notification Rule that generated this Event. Rule Rule `json:"rule"` // DeduplicationHash is a hash that the handler can use to deduplicate events if needed HandlerDeduplicationHash string `json:"-"` }
func (Event) AsNotificationEvent ¶
func (e Event) AsNotificationEvent() (api.NotificationEvent, error)
func (Event) AsNotificationEventBalanceThresholdPayload ¶
func (e Event) AsNotificationEventBalanceThresholdPayload() api.NotificationEventBalanceThresholdPayload
type EventDeliveryStatus ¶
type EventDeliveryStatus struct { models.NamespacedModel // ID is the unique identifier for Event. ID string `json:"id"` // EventID defines the Event identifier the EventDeliveryStatus belongs to. EventID string `json:"eventId"` ChannelID string `json:"channelId"` State EventDeliveryStatusState `json:"state"` Reason string `json:"reason,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt,omitempty"` }
type EventDeliveryStatusOrderBy ¶
type EventDeliveryStatusOrderBy string
type EventDeliveryStatusState ¶
type EventDeliveryStatusState string
func DeliveryStatusStates ¶
func DeliveryStatusStates(statuses []EventDeliveryStatus) []EventDeliveryStatusState
DeliveryStatusStates returns a list of EventDeliveryStatusState from EventDeliveryStatus slice
func (EventDeliveryStatusState) Validate ¶
func (e EventDeliveryStatusState) Validate() error
func (EventDeliveryStatusState) Values ¶
func (e EventDeliveryStatusState) Values() []string
type EventDispatcher ¶
type EventHandler ¶
type EventHandler interface { EventDispatcher EventReconciler Start() error Close() error }
func NewEventHandler ¶
func NewEventHandler(config EventHandlerConfig) (EventHandler, error)
type EventHandlerConfig ¶
type EventHandlerConfig struct { Repository Repository Webhook webhook.Handler Logger *slog.Logger ReconcileInterval time.Duration }
func (*EventHandlerConfig) Validate ¶
func (c *EventHandlerConfig) Validate() error
type EventPayload ¶
type EventPayload struct { EventPayloadMeta // Balance Threshold BalanceThreshold BalanceThresholdPayload `json:"balanceThreshold"` }
EventPayload is a union type capturing payload for all EventType of Events.
func (EventPayload) AsNotificationEventBalanceThresholdPayload ¶
func (p EventPayload) AsNotificationEventBalanceThresholdPayload(eventId string, ts time.Time) api.NotificationEventBalanceThresholdPayload
func (EventPayload) FromNotificationEventBalanceThresholdPayload ¶
func (p EventPayload) FromNotificationEventBalanceThresholdPayload(r api.NotificationEventBalanceThresholdPayload) EventPayload
func (EventPayload) Validate ¶
func (p EventPayload) Validate() error
type EventPayloadMeta ¶
type EventPayloadMeta struct {
Type EventType `json:"type"`
}
func (EventPayloadMeta) Validate ¶
func (m EventPayloadMeta) Validate() error
type EventReconciler ¶
type EventRepository ¶
type EventRepository interface { ListEvents(ctx context.Context, params ListEventsInput) (pagination.PagedResponse[Event], error) GetEvent(ctx context.Context, params GetEventInput) (*Event, error) CreateEvent(ctx context.Context, params CreateEventInput) (*Event, error) ListEventsDeliveryStatus(ctx context.Context, params ListEventsDeliveryStatusInput) (pagination.PagedResponse[EventDeliveryStatus], error) GetEventDeliveryStatus(ctx context.Context, params GetEventDeliveryStatusInput) (*EventDeliveryStatus, error) UpdateEventDeliveryStatus(ctx context.Context, params UpdateEventDeliveryStatusInput) (*EventDeliveryStatus, error) }
type EventService ¶
type EventService interface { ListEvents(ctx context.Context, params ListEventsInput) (ListEventsResult, error) GetEvent(ctx context.Context, params GetEventInput) (*Event, error) CreateEvent(ctx context.Context, params CreateEventInput) (*Event, error) ListEventsDeliveryStatus(ctx context.Context, params ListEventsDeliveryStatusInput) (ListEventsDeliveryStatusResult, error) GetEventDeliveryStatus(ctx context.Context, params GetEventDeliveryStatusInput) (*EventDeliveryStatus, error) UpdateEventDeliveryStatus(ctx context.Context, params UpdateEventDeliveryStatusInput) (*EventDeliveryStatus, error) }
type EventType ¶
type EventType api.NotificationEventType
type FeatureMeta ¶
type FeatureMeta = api.FeatureMeta
type FeatureService ¶
type GetChannelInput ¶
type GetChannelInput models.NamespacedID
type GetEventDeliveryStatusInput ¶
type GetEventDeliveryStatusInput struct { models.NamespacedModel // ID the unique identifier of the EventDeliveryStatus. ID string // EventID defines the Event identifier the EventDeliveryStatus belongs to. Must be provided if ID is empty. EventID string // ChannelID defines the Channel identifier the EventDeliveryStatus belongs to. Must be provided if ID is empty. ChannelID string }
type GetEventInput ¶
type GetEventInput struct {
models.NamespacedID
}
type GetRuleInput ¶
type GetRuleInput models.NamespacedID
type ListChannelsInput ¶
type ListChannelsInput struct { pagination.Page Namespaces []string Channels []string IncludeDisabled bool OrderBy api.ListNotificationChannelsParamsOrderBy Order sortx.Order }
type ListChannelsResult ¶
type ListChannelsResult = pagination.PagedResponse[Channel]
type ListEventsDeliveryStatusInput ¶
type ListEventsDeliveryStatusInput struct { pagination.Page // Namespaces is a list of namespaces to be used to filter the list of EventDeliveryStatus to be returned. Namespaces []string // From limits the scope fo the request by defining the earliest date to be used for lookup. // This filter is applied to EventDeliveryStatus.UpdatedAt field. From time.Time // To limits the scope fo the request by defining the latest date to be used for lookup. // This filter is applied to EventDeliveryStatus.UpdatedAt field. To time.Time // Events is a list of Event identifiers used as filter. Events []string // Channels is a list of Channel identifiers used as filter. Channels []string // State is a list of Event State used as filter. States []EventDeliveryStatusState }
type ListEventsDeliveryStatusResult ¶
type ListEventsDeliveryStatusResult = pagination.PagedResponse[EventDeliveryStatus]
type ListEventsInput ¶
type ListEventsInput struct { pagination.Page Namespaces []string `json:"namespaces,omitempty"` Events []string `json:"events,omitempty"` From time.Time `json:"from,omitempty"` To time.Time `json:"to,omitempty"` Subjects []string `json:"subjects,omitempty"` Features []string `json:"features,omitempty"` Rules []string `json:"rules,omitempty"` Channels []string `json:"channels,omitempty"` DeduplicationHashes []string `json:"deduplicationHashes,omitempty"` DeliveryStatusStates []EventDeliveryStatusState `json:"deliveryStatusStates,omitempty"` OrderBy api.ListNotificationEventsParamsOrderBy Order sortx.Order }
type ListEventsResult ¶
type ListEventsResult = pagination.PagedResponse[Event]
type ListRulesInput ¶
type ListRulesResult ¶
type ListRulesResult = pagination.PagedResponse[Rule]
type NotFoundError ¶
type NotFoundError struct {
models.NamespacedID
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Repository ¶
type Repository interface { ChannelRepository RuleRepository EventRepository WithTx(context.Context) (TxRepository, error) }
type Rule ¶
type Rule struct { models.NamespacedModel models.ManagedModel // ID is the unique identifier for Rule. ID string `json:"id"` // Type of the notification Rule (e.g. entitlements.balance.threshold) Type RuleType `json:"type"` // Name of is the user provided name of the Rule. Name string `json:"name"` // Disabled defines whether the Rule is disabled or not. Disabled bool `json:"disabled"` // Config stores the actual Rule configuration specific to the Type. Config RuleConfig `json:"config"` // Channels stores the list of channels the Rule send notification Events to. Channels []Channel `json:"channels"` }
func (Rule) AsNotificationRule ¶
func (r Rule) AsNotificationRule() (api.NotificationRule, error)
func (Rule) AsNotificationRuleBalanceThreshold ¶
func (r Rule) AsNotificationRuleBalanceThreshold() api.NotificationRuleBalanceThreshold
func (Rule) HasEnabledChannels ¶
type RuleConfig ¶
type RuleConfig struct { RuleConfigMeta // Balance Threshold BalanceThreshold BalanceThresholdRuleConfig `json:"balanceThreshold"` }
RuleConfig is a union type capturing configuration parameters for all type of rules.
type RuleConfigMeta ¶
type RuleConfigMeta struct {
Type RuleType `json:"type"`
}
func (RuleConfigMeta) Validate ¶
func (m RuleConfigMeta) Validate() error
type RuleOrderBy ¶
type RuleOrderBy string
type RuleRepository ¶
type RuleRepository interface { ListRules(ctx context.Context, params ListRulesInput) (pagination.PagedResponse[Rule], error) CreateRule(ctx context.Context, params CreateRuleInput) (*Rule, error) DeleteRule(ctx context.Context, params DeleteRuleInput) error GetRule(ctx context.Context, params GetRuleInput) (*Rule, error) UpdateRule(ctx context.Context, params UpdateRuleInput) (*Rule, error) }
type RuleService ¶
type RuleService interface { ListRules(ctx context.Context, params ListRulesInput) (ListRulesResult, error) CreateRule(ctx context.Context, params CreateRuleInput) (*Rule, error) DeleteRule(ctx context.Context, params DeleteRuleInput) error GetRule(ctx context.Context, params GetRuleInput) (*Rule, error) UpdateRule(ctx context.Context, params UpdateRuleInput) (*Rule, error) }
type RuleType ¶
type RuleType api.NotificationEventType
type Service ¶
type Service interface { FeatureService ChannelService RuleService EventService Close() error }
type TxRepository ¶
type TxRepository interface { ChannelRepository RuleRepository EventRepository Commit() error Rollback() error }
type UpdateAfterDeleteError ¶
type UpdateAfterDeleteError genericError
func (UpdateAfterDeleteError) Error ¶
func (e UpdateAfterDeleteError) Error() string
func (UpdateAfterDeleteError) Unwrap ¶
func (e UpdateAfterDeleteError) Unwrap() error
type UpdateChannelInput ¶
type UpdateChannelInput struct { models.NamespacedModel // Type defines the Channel type (e.g. webhook) Type ChannelType // Name stores the user defined name of the Channel. Name string // Disabled defines whether the Channel is disabled or not. Deleted Channels are always disabled. Disabled bool // Config stores the Channel Type specific configuration. Config ChannelConfig // ID is the unique identifier for Channel. ID string }
func (UpdateChannelInput) FromNotificationChannelWebhookCreateRequest ¶
func (i UpdateChannelInput) FromNotificationChannelWebhookCreateRequest(r api.NotificationChannelWebhookCreateRequest) UpdateChannelInput
type UpdateEventDeliveryStatusInput ¶
type UpdateEventDeliveryStatusInput struct { models.NamespacedModel // ID the unique identifier of the EventDeliveryStatus. ID string // State is the delivery state of the Event. State EventDeliveryStatusState // Reason describes the reason for the latest State transition. Reason string // EventID defines the Event identifier the EventDeliveryStatus belongs to. Must be provided if ID is empty. EventID string // ChannelID defines the Channel identifier the EventDeliveryStatus belongs to. Must be provided if ID is empty. ChannelID string }
type UpdateRuleInput ¶
type UpdateRuleInput struct { models.NamespacedModel // Type defines the Rule type (e.g. entitlements.balance.threshold) Type RuleType // Name stores the user defined name of the Rule. Name string // Disabled defines whether the Rule is disabled or not. Deleted Rules are always disabled. Disabled bool // Config stores the Rule Type specific configuration. Config RuleConfig // Channels defines the list of Channels the Rule needs to send Events. Channels []string // ID is the unique identifier for Rule. ID string }
func (UpdateRuleInput) FromNotificationRuleBalanceThresholdCreateRequest ¶
func (i UpdateRuleInput) FromNotificationRuleBalanceThresholdCreateRequest(r api.NotificationRuleBalanceThresholdCreateRequest) UpdateRuleInput
type ValidationError ¶
type ValidationError genericError
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (e ValidationError) Unwrap() error
type WebHookChannelConfig ¶
type WebHookChannelConfig struct { // CustomHeaders stores a set of HTTP headers which are applied to the outgoing webhook message. CustomHeaders map[string]interface{} `json:"customHeaders,omitempty"` // URL is the webhook endpoint url where the messages are sent to. URL string `json:"url"` // SigningSecret defines the secret which can be used for validating the signature of the message sent // to the webhook endpoint. SigningSecret string `json:"signingSecret"` }
WebHookChannelConfig defines the configuration specific to channel with webhook type.
func (WebHookChannelConfig) Validate ¶
func (w WebHookChannelConfig) Validate() error
Validate returns an error if webhook channel configuration is invalid.