logsapi

package
v0.0.0-...-b4505e9 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion20210318 = "2021-03-18"
	SchemaVersionLatest   = SchemaVersion20210318
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferingCfg

type BufferingCfg struct {
	// MaxItems is the maximum number of events to be buffered in memory. (default: 10000, minimum: 1000, maximum: 10000)
	MaxItems uint32 `json:"maxItems"`
	// MaxBytes is the maximum size in bytes of the logs to be buffered in memory. (default: 262144, minimum: 262144, maximum: 1048576)
	MaxBytes uint32 `json:"maxBytes"`
	// TimeoutMS is the maximum time (in milliseconds) for a batch to be buffered. (default: 1000, minimum: 100, maximum: 30000)
	TimeoutMS uint32 `json:"timeoutMs"`
}

BufferingCfg is the configuration set for receiving logs from Logs API. Whichever of the conditions below is met first, the logs will be sent

type Client

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

Client is the client used to subscribe to the Logs API

func NewClient

func NewClient(logsApiBaseUrl string) (*Client, error)

NewClient returns a new Client with the given URL

func (*Client) Subscribe

func (c *Client) Subscribe(types []EventType, bufferingCfg BufferingCfg, destination Destination, extensionId string) (*SubscribeResponse, error)

Subscribe calls the Logs API to subscribe for the log events.

type Destination

type Destination struct {
	Protocol   HttpProtocol `json:"protocol"`
	URI        URI          `json:"URI"`
	HttpMethod HttpMethod   `json:"method"`
	Encoding   HttpEncoding `json:"encoding"`
}

Destination is the configuration for listeners who would like to receive logs with HTTP

type EventType

type EventType string

EventType represents the type of logs in Lambda

const (
	// Platform is to receive logs emitted by the platform
	Platform EventType = "platform"
	// Function is to receive logs emitted by the function
	Function EventType = "function"
	// Extension is to receive logs emitted by the extension
	Extension EventType = "extension"
)

type HttpEncoding

type HttpEncoding string

HttpEncoding denotes what the content is encoded in

const (
	JSON HttpEncoding = "JSON"
)

type HttpMethod

type HttpMethod string

HttpMethod represents the HTTP method used to receive logs from Logs API

const (
	//HttpPost is to receive logs through POST.
	HttpPost HttpMethod = "POST"
	//HttpPUT is to receive logs through PUT.
	HttpPut HttpMethod = "PUT"
)

type HttpProtocol

type HttpProtocol string

HttpProtocol is used to specify the protocol when subscribing to Logs API for HTTP

const (
	HttpProto HttpProtocol = "HTTP"
)

type SchemaVersion

type SchemaVersion string

type SubEventType

type SubEventType string
const (
	// RuntimeDone event is sent when lambda function is finished it's execution
	RuntimeDone SubEventType = "platform.runtimeDone"
)

type SubscribeRequest

type SubscribeRequest struct {
	SchemaVersion SchemaVersion `json:"schemaVersion"`
	EventTypes    []EventType   `json:"types"`
	BufferingCfg  BufferingCfg  `json:"buffering"`
	Destination   Destination   `json:"destination"`
}

SubscribeRequest is the request body that is sent to Logs API on subscribe

type SubscribeResponse

type SubscribeResponse struct {
	Body string
}

SubscribeResponse is the response body that is received from Logs API on subscribe

type URI

type URI string

URI is used to set the endpoint where the logs will be sent to

Jump to

Keyboard shortcuts

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