aws-sdk-go: github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi Index | Files

package eventstreamapi

import "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"

Index

Package Files

api.go error.go

Constants

const (
    MessageTypeHeader    = `:message-type` // Identifies type of message.
    EventMessageType     = `event`
    ErrorMessageType     = `error`
    ExceptionMessageType = `exception`

    // Message Events
    EventTypeHeader = `:event-type` // Identifies message event type e.g. "Stats".

    // Message Error
    ErrorCodeHeader    = `:error-code`
    ErrorMessageHeader = `:error-message`

    // Message Exception
    ExceptionTypeHeader = `:exception-type`
)

EventStream headers with specific meaning to async API functionality.

func GetHeaderString Uses

func GetHeaderString(msg eventstream.Message, headerName string) (string, error)

GetHeaderString returns the value of the header as a string. If the header is not set or the value is not a string an error will be returned.

type EventReader Uses

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

EventReader provides reading from the EventStream of an reader.

func NewEventReader Uses

func NewEventReader(
    reader io.ReadCloser,
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    unmarshalerForEventType func(string) (Unmarshaler, error),
) *EventReader

NewEventReader returns a EventReader built from the reader and unmarshaler provided. Use ReadStream method to start reading from the EventStream.

func (*EventReader) Close Uses

func (r *EventReader) Close() error

Close closes the EventReader's EventStream reader.

func (*EventReader) ReadEvent Uses

func (r *EventReader) ReadEvent() (event interface{}, err error)

ReadEvent attempts to read a message from the EventStream and return the unmarshaled event value that the message is for.

For EventStream API errors check if the returned error satisfies the awserr.Error interface to get the error's Code and Message components.

EventUnmarshalers called with EventStream messages must take copies of the message's Payload. The payload will is reused between events read.

func (*EventReader) UseLogger Uses

func (r *EventReader) UseLogger(logger aws.Logger, logLevel aws.LogLevelType)

UseLogger instructs the EventReader to use the logger and log level specified.

type Unmarshaler Uses

type Unmarshaler interface {
    UnmarshalEvent(protocol.PayloadUnmarshaler, eventstream.Message) error
}

Unmarshaler provides the interface for unmarshaling a EventStream message into a SDK type.

Package eventstreamapi imports 5 packages (graph) and is imported by 18 packages. Updated 2018-07-31. Refresh now. Tools for package owners.