Documentation
¶
Index ¶
- Constants
- Variables
- type CreateStreamReq
- type PollTransmitterRequest
- type ReceiverConfig
- type SsfDelivery
- type SsfReceiver
- type SsfReceiverImplementation
- func (receiver *SsfReceiverImplementation) ConfigureCallback(callback func(events []events.SsfEvent), pollInterval int) error
- func (receiver *SsfReceiverImplementation) DeleteReceiver()
- func (receiver *SsfReceiverImplementation) DisableStream() (StreamStatus, error)
- func (receiver *SsfReceiverImplementation) EnableStream() (StreamStatus, error)
- func (receiver *SsfReceiverImplementation) GetStreamStatus() (StreamStatus, error)
- func (receiver *SsfReceiverImplementation) InitPollInterval()
- func (receiver *SsfReceiverImplementation) PauseStream() (StreamStatus, error)
- func (receiver *SsfReceiverImplementation) PollEvents() ([]events.SsfEvent, error)
- type StreamStatus
- type TransmitterConfig
- type UpdateStreamRequest
Constants ¶
const TransmitterConfigMetadataPath = "/.well-known/ssf-configuration"
const TransmitterPollRFC = "urn:ietf:rfc:8936"
Variables ¶
var EnumToStringStatusMap = map[StreamStatus]string{ StreamEnabled: "enabled", StreamPaused: "paused", StreamDisabled: "disabled", }
var StatusEnumMap = map[string]StreamStatus{ "enabled": StreamEnabled, "paused": StreamPaused, "disabled": StreamDisabled, }
Functions ¶
This section is empty.
Types ¶
type CreateStreamReq ¶
type CreateStreamReq struct { Delivery SsfDelivery `json:"delivery"` EventsRequested []string `json:"events_requested"` Description string `json:"description,omitempty"` }
Struct used to make a Create Stream request for the receiver
type PollTransmitterRequest ¶
type PollTransmitterRequest struct { Acknowledgements []string `json:"ack"` MaxEvents int `json:"maxEvents,omitempty"` ReturnImmediately bool `json:"returnImmediately"` }
Struct to make a request to poll SSF Events to the configured transmitter
type ReceiverConfig ¶
type ReceiverConfig struct { // TransmitterUrl defines the URL for the transmitter that // the configured receiver will create a stream with and receive // events from. // // Required TransmitterUrl string // TransmitterPollUrl defines the URL that the receiver will use // to poll for SSF events. // // Note - Must be a subpath of TransmitterUrl // // Required TransmitterPollUrl string // TransmitterStreamUrl defines the URL that the receiver will use // to update/get the stream status. // // Note - Must be a subpath of TransmitterUrl // // Optional TransmitterStreamUrl string // EventsRequested specified the SSF events you want to receiver // from the transmitter. // // Required EventsRequested []events.EventType // AuthorizationToken is the authorization token used to authorize // your receiver with the specified transmitter // // Note - all transmitter's will require an authorization token // // Required AuthorizationToken string // PollCallback is used to configure the method that you want the // receiver to call after each automatic poll request. Each time // the poll interval timer is up, the receiver will make a request // to the specified transmitter and fetch available SSF events. It // will then call PollCallback with a list of those events // // Note - The PollCallback and PollInterval can also be configured // after initial receiver construction // // Optional PollCallback func(events []events.SsfEvent) // PollInterval defines, in seconds how often you want the receiver to // poll for SSF events any and pass them to your PollCallback function. // // Note - This field will not be used if the PollCallback isn't configured // // Optional, defaults to 300 (5 minutes) PollInterval int }
type SsfDelivery ¶
type SsfDelivery struct {
DeliveryMethod string `json:"delivery_method"`
}
Struct that defines the deliver method for the Create Stream Request
type SsfReceiver ¶
type SsfReceiver interface { ConfigureCallback(callback func(events []event.SsfEvent), pollInterval int) error // Polls the configured receiver a returns a list of the available SSF // Events PollEvents() ([]event.SsfEvent, error) // Cleans up the Receiver's resources and deletes it from the transmitter DeleteReceiver() // Get stream status from the transmitter GetStreamStatus() (StreamStatus, error) // Enable the stream EnableStream() (StreamStatus, error) // Pause the stream PauseStream() (StreamStatus, error) // Disable the stream DisableStream() (StreamStatus, error) }
Represents the interface for the SSF receiver with user facing methods
func ConfigureSsfReceiver ¶
func ConfigureSsfReceiver(cfg ReceiverConfig) (SsfReceiver, error)
Initializes the SSF Receiver based on the specified configuration.
Returns an error if any process of configuring the receiver, registering it with the transmitter, or setting up the poll interval failed
type SsfReceiverImplementation ¶
type SsfReceiverImplementation struct {
// contains filtered or unexported fields
}
The struct that contains all the necessary fields and methods for the SSF Receiver's implementation
func (*SsfReceiverImplementation) ConfigureCallback ¶
func (receiver *SsfReceiverImplementation) ConfigureCallback(callback func(events []events.SsfEvent), pollInterval int) error
TODO: Not Yet Implemented
func (*SsfReceiverImplementation) DeleteReceiver ¶
func (receiver *SsfReceiverImplementation) DeleteReceiver()
Cleans up the resources used by the Receiver and deletes the Receiver's stream from the transmitter
func (*SsfReceiverImplementation) DisableStream ¶
func (receiver *SsfReceiverImplementation) DisableStream() (StreamStatus, error)
func (*SsfReceiverImplementation) EnableStream ¶
func (receiver *SsfReceiverImplementation) EnableStream() (StreamStatus, error)
func (*SsfReceiverImplementation) GetStreamStatus ¶
func (receiver *SsfReceiverImplementation) GetStreamStatus() (StreamStatus, error)
func (*SsfReceiverImplementation) InitPollInterval ¶
func (receiver *SsfReceiverImplementation) InitPollInterval()
Initializes the poll interval for the receiver that will intermittently send SSF Events to the specified callback function
func (*SsfReceiverImplementation) PauseStream ¶
func (receiver *SsfReceiverImplementation) PauseStream() (StreamStatus, error)
func (*SsfReceiverImplementation) PollEvents ¶
func (receiver *SsfReceiverImplementation) PollEvents() ([]events.SsfEvent, error)
Polls the transmitter for all available SSF Events, returning them as a list for use
type StreamStatus ¶
type StreamStatus int
const ( StreamEnabled StreamStatus = iota + 1 StreamPaused StreamDisabled )
type TransmitterConfig ¶
type TransmitterConfig struct { Issuer string `json:"issuer"` JwksUri string `json:"jwks_uri,omitempty"` DeliveryMethodsSupported []string `json:"delivery_methods_supported,omitempty"` ConfigurationEndpoint string `json:"configuration_endpoint,omitempty"` StatusEndpoint string `json:"status_endpoint,omitempty"` SpecVersion string `json:"spec_version,omitempty"` AuthorizationSchemes []map[string]interface{} `json:"authorization_schemes,omitempty"` }
Struct used to read a Transmitter's configuration
type UpdateStreamRequest ¶
type UpdateStreamRequest struct { StreamId string `json:"stream_id"` Status string `json:"status"` Reason string `json:"reason"` }
Struct to make a request to update the stream status