event

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultDeliveryRetryAttempts        = 5
	DefaultDeliveryRetryIntervalSeconds = 60
)
View Source
const (
	MaxNumEvents = 256
)

Variables

View Source
var EventManager = manager{}

Functions

func NewDefaultApiRouter

func NewDefaultApiRouter(s Api) ec.Router

Types

type Api

type Api interface {
	Initialize() error

	RedfishV1EventServiceGet(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventSubscriptionsGet(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventSubscriptionsPost(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventSubscriptionIdGet(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventSubscriptionIdDelete(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventsGet(w http.ResponseWriter, r *http.Request)
	RedfishV1EventServiceEventEventIdGet(w http.ResponseWriter, r *http.Request)
}

func NewDefaultApiService

func NewDefaultApiService() Api

type DefaultApiRouter

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

Router contains all the Redfish / Swordfish API calls for the Event Service

func (*DefaultApiRouter) Close

func (*DefaultApiRouter) Close() error

func (*DefaultApiRouter) Init

func (r *DefaultApiRouter) Init(log ec.Logger) error

func (*DefaultApiRouter) Name

func (*DefaultApiRouter) Name() string

func (*DefaultApiRouter) Routes

func (r *DefaultApiRouter) Routes() ec.Routes

func (*DefaultApiRouter) Start

func (*DefaultApiRouter) Start() error

type DefaultApiService

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

func (DefaultApiService) EventSubscriptionsGet

func (m DefaultApiService) EventSubscriptionsGet(model *sf.EventDestinationCollectionEventDestinationCollection) error

EventSubscriptionsGet

func (DefaultApiService) EventSubscriptionsPost

func (m DefaultApiService) EventSubscriptionsPost(model *sf.EventDestinationV190EventDestination) error

EventSubscriptionsPost

func (DefaultApiService) EventSubscriptionsSubscriptionIdDelete

func (m DefaultApiService) EventSubscriptionsSubscriptionIdDelete(id string) error

EventSubscriptionsSubscriptionIdDelete

func (DefaultApiService) EventSubscriptionsSubscriptionIdGet

func (m DefaultApiService) EventSubscriptionsSubscriptionIdGet(id string, model *sf.EventDestinationV190EventDestination) error

EventSubscriptionsSubscriptionIdGet

func (DefaultApiService) EventsEventIdGet

func (m DefaultApiService) EventsEventIdGet(id string, model *sf.EventV161Event) error

EventsEventIdGet

func (DefaultApiService) EventsGet

func (m DefaultApiService) EventsGet(model *sf.EventCollectionEventCollection) error

EventsGet

func (DefaultApiService) Get

func (m DefaultApiService) Get(model *sf.EventServiceV170EventService) error

Get

func (*DefaultApiService) Initialize

func (s *DefaultApiService) Initialize() error

func (DefaultApiService) Publish

func (m DefaultApiService) Publish(e Event)

Publish will publish the provided event to all interested subscriptions. It will also add the event to the Event Managers list of historic events. The Event must contain a valid MessageId - that is to say the event's MessageId must be backed by an entry in the Message Registry.

func (DefaultApiService) PublishResourceEvent

func (m DefaultApiService) PublishResourceEvent(e Event, r Resource)

Publish Resource Event will publish the provided event with the resource details included in the event as the Origin of Condition. This is useful for any Redfish/Swordfish model that includes an Id or OdataId

func (*DefaultApiService) RedfishV1EventServiceEventEventIdGet

func (s *DefaultApiService) RedfishV1EventServiceEventEventIdGet(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceEventSubscriptionIdDelete

func (s *DefaultApiService) RedfishV1EventServiceEventSubscriptionIdDelete(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceEventSubscriptionIdGet

func (s *DefaultApiService) RedfishV1EventServiceEventSubscriptionIdGet(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceEventSubscriptionsGet

func (s *DefaultApiService) RedfishV1EventServiceEventSubscriptionsGet(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceEventSubscriptionsPost

func (s *DefaultApiService) RedfishV1EventServiceEventSubscriptionsPost(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceEventsGet

func (s *DefaultApiService) RedfishV1EventServiceEventsGet(w http.ResponseWriter, r *http.Request)

func (*DefaultApiService) RedfishV1EventServiceGet

func (s *DefaultApiService) RedfishV1EventServiceGet(w http.ResponseWriter, r *http.Request)

func (DefaultApiService) Subscribe

func (m DefaultApiService) Subscribe(s Subscription)

Subscribe will add the subscription to the Event Manager. When an event is published to the Event Manager (through the Publish() method), the Event Manager will broadcast the event to all registered subscriptions.

type Event

type Event struct {
	// The identifier that uniquely identifies the resource within the collection of similar resources.
	Id string `json:"Id"`

	// The time the event occurred.
	Timestamp string `json:"Timestamp,omitempty"`

	// The identifier that correlates events with the same root cause. If 0 , no other event is related to this event.
	GroupId string `json:"GroupId,omitempty"`

	// The identifier for the member within the collection.
	MemberId string `json:"MemberId,omitempty"`

	// The human-readable event message.
	Message string `json:"Message,omitempty"`

	// An array of message arguments that are substituted for the arguments in the message when looked up in the message registry.
	MessageArgs []string `json:"MessageArgs,omitempty"`

	// The identifier for the message.
	MessageId MessageId `json:"MessageId,omitempty"`

	// The severity of the message in this event.
	MessageSeverity sf.ResourceHealth `json:"MessageSeverity,omitempty"`

	// A link to the resource or object that originated the condition that caused the event to be generated.
	OriginOfCondition string `json:"OriginOfCondition,omitempty"`
}

func (Event) Args

func (e Event) Args(args ...*string) error

func (Event) CopyInto

func (e Event) CopyInto(model *sf.EventV161Event)

func (Event) Is

func (e Event) Is(event Event) bool

func (Event) OdataId

func (e Event) OdataId() string

type Events

type Events = []Event

type MessageId

type MessageId string

MessageId is an encoding of the Message Registry (Registry Prefix), Message Version, and Message Identifer The format is [Registry Prefix].[Major Version].[Minor Version].[Message Identifier]

Example:

With a MessageId of "Alert.1.0.LanDisconnect"
	The segment before the 1st period is the Message Registry Prefix: "Alert"
	The segment between the 1st and 3rd period is the Registry Version: "1.0"
		The segment between the 1st and 2nd period is the Major Version: "1"
		The segment between the 2nd and 3rd period is the Minor Version: "0"
	The segment after the 3rd period is the Message Identifier in the Registry: "LanDisconnect"

func (MessageId) Identifier

func (m MessageId) Identifier() string

func (MessageId) RegistryPrefix

func (m MessageId) RegistryPrefix() string

func (MessageId) RegistryVersion

func (m MessageId) RegistryVersion() string

func (MessageId) String

func (m MessageId) String() string

type RedfishEvent

type RedfishEvent struct {
	Context string `json:"Context,omitempty"`

	Events []sf.EventV161Event `json:"Events,omitempty"`
}

type RedfishSubscription

type RedfishSubscription struct {
	// A client-supplied string that is stored with the event destination subscription.
	Context string

	// The URI of the destination event receiver.
	Destination string

	// The subscription delivery retry policy for events, where the subscription type is RedfishEvent.
	DeliveryRetryPolicy sf.EventDestinationV190DeliveryRetryPolicy
}

func (RedfishSubscription) EventHandler

func (s RedfishSubscription) EventHandler(e Event) error

type Resource

type Resource interface {
	OdataId() string
}

type Subscription

type Subscription interface {
	EventHandler(e Event) error
}

Jump to

Keyboard shortcuts

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