Skip to content

Commit

Permalink
variable name changes from callingObject to callingObjects
Browse files Browse the repository at this point in the history
  • Loading branch information
Devaansh-Kumar committed Aug 21, 2024
1 parent 26a0cf0 commit a8f9f22
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions PROVIDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ package examplegateway

import "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/notifications"

func notify(mType notifications.MessageType, message string) {
newNotification := notifications.Notification{Type: mType, Message: message}
notifications.CommonNotification.DispatchNotication(newNotification, string(ProviderName))
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object){
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(ProviderName))
}
```
7. Import the new package at `cmd/print`.
Expand Down
6 changes: 3 additions & 3 deletions pkg/i2gw/notifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var NotificationAggr NotificationAggregator

// NotificationCallback is a callback function used to send notifications from within the common
// package without the common package having knowledge about which provider is making a call it
type NotificationCallback func(mType MessageType, message string, callingObject ...client.Object)
type NotificationCallback func(mType MessageType, message string, CallingObjects ...client.Object)

// DispatchNotification is used to send a notification to the NotificationAggregator
func (na *NotificationAggregator) DispatchNotification(notification Notification, ProviderName string) {
Expand Down Expand Up @@ -103,6 +103,6 @@ func convertObjectsToStr(ob []client.Object) string {
return sb.String()
}

func NewNotification(mType MessageType, message string, callingObject ...client.Object) Notification {
return Notification{Type: mType, Message: message, CallingObjects: callingObject}
func NewNotification(mType MessageType, message string, callingObjects ...client.Object) Notification {
return Notification{Type: mType, Message: message, CallingObjects: callingObjects}
}
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/apisix/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func notify(mType notifications.MessageType, message string, callingObject ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObject...)
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(Name))
}
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/gce/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func notify(mType notifications.MessageType, message string, callingObject ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObject...)
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(ProviderName))
}
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/ingressnginx/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func notify(mType notifications.MessageType, message string, callingObject ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObject...)
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(Name))
}
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/istio/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func notify(mType notifications.MessageType, message string, callingObject ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObject...)
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(ProviderName))
}
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/kong/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func notify(mType notifications.MessageType, message string, callingObject ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObject...)
func notify(mType notifications.MessageType, message string, callingObjects ...client.Object) {
newNotification := notifications.NewNotification(mType, message, callingObjects...)
notifications.NotificationAggr.DispatchNotification(newNotification, string(Name))
}

Expand Down

0 comments on commit a8f9f22

Please sign in to comment.