core

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CoreAPI = "$GVT.%s.API.CORE"
)

Variables

View Source
var AvailablePermissions = Permissions{

	"ADMIN": "Administrator",

	"PRODUCT.LIST":          "List available products",
	"PRODUCT.CREATE":        "Create product",
	"PRODUCT.DELETE":        "Delete specific product",
	"PRODUCT.UPDATE":        "Update specific product",
	"PRODUCT.PURGE":         "Purge specific product",
	"PRODUCT.INFO":          "Get specific product information",
	"PRODUCT.SUBSCRIPTION":  "Subscribe to specific product",
	"PRODUCT.SNAPSHOT.READ": "Read snapshot of specific product",
	"PRODUCT.ACL":           "Update ACL of specific product",

	"TOKEN.LIST":   "List available tokens",
	"TOKEN.CREATE": "Create token",
	"TOKEN.DELETE": "Delete specific token",
	"TOKEN.UPDATE": "Update specific token",
	"TOKEN.INFO":   "Get specific token information",
}

Functions

This section is empty.

Types

type AuthenticateReply

type AuthenticateReply struct {
	ErrorReply

	Durable     string   `json:"durable"`
	Permissions []string `json:"permissions"`
}

type AuthenticateRequest

type AuthenticateRequest struct {
	Token string `json:"token"`
}

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Connect

func (client *Client) Connect(host string, options *Options) error

func (*Client) Disconnect

func (client *Client) Disconnect()

func (*Client) GetConnection

func (client *Client) GetConnection() *nats.Conn

func (*Client) GetJetStream

func (client *Client) GetJetStream() (nats.JetStreamContext, error)

func (*Client) IsAuthenticationRequired

func (client *Client) IsAuthenticationRequired() bool

func (*Client) Request

func (client *Client) Request(apiPath string, payload []byte, timeout time.Duration) (*nats.Msg, error)

func (*Client) RequestMsg

func (client *Client) RequestMsg(msg *nats.Msg, timeout time.Duration) (*nats.Msg, error)

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type ErrorReply

type ErrorReply struct {
	Error *Error `json:"error,omitempty"`
}

type EventBus

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

func NewEventBus

func NewEventBus(host string, handler EventBusHandler, options EventBusOptions) *EventBus

func (*EventBus) Close

func (eb *EventBus) Close()

func (*EventBus) Connect

func (eb *EventBus) Connect() error

func (*EventBus) GetConnection

func (eb *EventBus) GetConnection() *nats.Conn

func (*EventBus) GetJetStream

func (eb *EventBus) GetJetStream() (nats.JetStreamContext, error)

func (*EventBus) ReconnectHandler

func (eb *EventBus) ReconnectHandler(natsConn *nats.Conn)

type EventBusHandler

type EventBusHandler struct {
	Reconnect  func(natsConn *nats.Conn)
	Disconnect func(natsConn *nats.Conn)
}

type EventBusOptions

type EventBusOptions struct {
	PingInterval        time.Duration
	MaxPingsOutstanding int
	MaxReconnects       int
}

type Options

type Options struct {
	Token               string
	PingInterval        time.Duration
	MaxPingsOutstanding int
	MaxReconnects       int
	ReconnectHandler    func()
	DisconnectHandler   func()
}

func NewOptions

func NewOptions() *Options

type Permissions

type Permissions map[string]string

Jump to

Keyboard shortcuts

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