stategate_client_go

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventClient added in v0.4.0

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

EventClient is a stategate EventService gRPC client

func NewEventClient added in v0.4.0

func NewEventClient(ctx context.Context, target string, opts ...Opt) (*EventClient, error)

NewEventClient creates a new stategate client

func (*EventClient) Close added in v0.4.0

func (c *EventClient) Close() error

Close closes the gRPC client connection

func (*EventClient) Search added in v0.4.0

func (c *EventClient) Search(ctx context.Context, in *stategate.SearchEventOpts) (*stategate.Events, error)

SearchEvents returns an array of immutable historical events for a given object.

func (*EventClient) Stream added in v0.4.0

func (c *EventClient) Stream(ctx context.Context, in *stategate.StreamOpts, fn func(even *stategate.Event) bool) error

Stream creates an event stream/subscription to a given object type/domain until fn returns false OR the context cancels.

type ObjectClient added in v0.4.0

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

ObjectClient is a stategate ObjectService gRPC client

func NewObjectClient added in v0.4.0

func NewObjectClient(ctx context.Context, target string, opts ...Opt) (*ObjectClient, error)

NewObjectClient creates a new stategate object client

func (*ObjectClient) Close added in v0.4.0

func (c *ObjectClient) Close() error

Close closes the gRPC client connection

func (*ObjectClient) Get added in v0.4.0

func (c *ObjectClient) Get(ctx context.Context, in *stategate.ObjectRef) (*stategate.Object, error)

Get gets an object's current state values

func (*ObjectClient) Search added in v0.4.0

func (c *ObjectClient) Search(ctx context.Context, in *stategate.SearchObjectOpts) (*stategate.Objects, error)

Search queries objects of a specific type

func (*ObjectClient) Set added in v0.4.0

func (c *ObjectClient) Set(ctx context.Context, in *stategate.Object) error

Set sets the current state value of an object, adds it to the event log, then broadcast the event to all interested consumers

type Opt

type Opt func(o *Options)

Opt is a single configuration option

func WithIDToken

func WithIDToken(idToken bool) Opt

WithIDToken makes the client use the oauth id token(if it exists) instead of the oauth access token

func WithLogging

func WithLogging(logging, logPayload bool) Opt

WithLogging registers a logging middleware

func WithMetrics

func WithMetrics(metrics bool) Opt

WithMetrics registers prometheus metrics

func WithTokenSource

func WithTokenSource(tokenSource oauth2.TokenSource) Opt

WithTokenSource uses oauth token add an authorization header to every outbound request

func WithTransportCreds

func WithTransportCreds(creds credentials.TransportCredentials) Opt

WithTransportCreds adds transport credentials to the client

type Options

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

Options holds configuration options

Jump to

Keyboard shortcuts

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