api

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTargetTimeout = 10 * time.Second
View Source
var ErrInvalidMsgType = errors.New("invalid message type")

Functions

func AllowAggregation

func AllowAggregation(b bool) func(msg proto.Message) error

AllowAggregation creates a GNMIOption that sets the AllowAggregation field in a *gnmi.SubscribeRequest with RequestType Subscribe.

func DataType

func DataType(datat string) func(msg proto.Message) error

DataType creates a GNMIOption that adds the data type to the supplied proto.Message which must be a *gnmi.GetRequest.

func Delete

func Delete(path string) func(msg proto.Message) error

Delete creates a GNMIOption that creates a *gnmi.Path and adds it to the supplied proto.Message. the supplied message must be a *gnmi.SetRequest. The *gnmi.Path is added the .Delete list.

func Encoding

func Encoding(encoding string) func(msg proto.Message) error

Encoding creates a GNMIOption that adds the encoding type to the supplied proto.Message which can be a *gnmi.GetRequest, *gnmi.SetRequest or a *gnmi.SubscribeRequest with RequestType Subscribe.

func Extension

func Extension(ext *gnmi_ext.Extension) func(msg proto.Message) error

Extention creates a GNMIOption that applies the suplied gnmi_ext.Extension to the provided proto.Message.

func HeartbeatInterval

func HeartbeatInterval(d time.Duration) func(msg proto.Message) error

HeartbeatInterval creates a GNMIOption that sets the HeartbeatInterval in a proto.Message of type *gnmi.Subscription.

func NewCapabilitiesRequest

func NewCapabilitiesRequest(opts ...GNMIOption) (*gnmi.CapabilityRequest, error)

NewCapabilitiesRequest creates a new *gnmi.CapabilityeRequest using the priovided GNMIOption list. returns an error in case one of the options is invalid

func NewGetRequest

func NewGetRequest(opts ...GNMIOption) (*gnmi.GetRequest, error)

NewGetRequest creates a new *gnmi.GetRequest using the priovided GNMIOption list. returns an error in case one of the options is invalid

func NewSetRequest

func NewSetRequest(opts ...GNMIOption) (*gnmi.SetRequest, error)

NewSetRequest creates a new *gnmi.SetRequest using the priovided GNMIOption list. returns an error in case one of the options is invalid

func NewSubscribePollRequest

func NewSubscribePollRequest(opts ...GNMIOption) *gnmi.SubscribeRequest

NewSubscribePollRequest creates a new *gnmi.SubscribeRequest with request type Poll using the priovided GNMIOption list. returns an error in case one of the options is invalid

func NewSubscribeRequest

func NewSubscribeRequest(opts ...GNMIOption) (*gnmi.SubscribeRequest, error)

NewSubscribeRequest creates a new *gnmi.SubscribeRequest using the priovided GNMIOption list. returns an error in case one of the options is invalid

func NewTarget

func NewTarget(opts ...TargetOption) (*target.Target, error)

func Path

func Path(path string) func(msg proto.Message) error

Path creates a GNMIOption that creates a *gnmi.Path and adds it to the supplied proto.Message which can be a *gnmi.GetRequest, *gnmi.SetRequest or a *gnmi.Subscription.

func Prefix

func Prefix(prefix string) func(msg proto.Message) error

Prefix creates a GNMIOption that creates a *gnmi.Path and adds it to the supplied proto.Message (as a Path Prefix) which can be a *gnmi.GetRequest, *gnmi.SetRequest or a *gnmi.SubscribeRequest with RequestType Subscribe.

func Qos

func Qos(qos uint32) func(msg proto.Message) error

Qos creates a GNMIOption that sets the QosMarking field in a *gnmi.SubscribeRequest with RequestType Subscribe.

func Replace

func Replace(opts ...GNMIOption) func(msg proto.Message) error

Replace creates a GNMIOption that creates a *gnmi.Update message and adds it to the supplied proto.Message. the supplied message must be a *gnmi.SetRequest.

func SampleInterval

func SampleInterval(d time.Duration) func(msg proto.Message) error

SampleInterval creates a GNMIOption that sets the SampleInterval in a proto.Message of type *gnmi.Subscription.

func Subscription

func Subscription(opts ...GNMIOption) func(msg proto.Message) error

UpdatesOnly creates a GNMIOption that creates a *gnmi.Subscription based on the supplied GNMIOption(s) and adds it the supplied proto.Mesage which must be of type *gnmi.SubscribeRequest with RequestType Subscribe.

func SubscriptionListMode

func SubscriptionListMode(mode string) func(msg proto.Message) error

SubscriptionListMode creates a GNMIOption that sets the SubscribeRequest Mode. The variable mode must be one of "once", "poll" or "stream". The supplied proto.Message must be a *gnmi.SubscribeRequest with RequestType Subscribe.

func SubscriptionMode

func SubscriptionMode(mode string) func(msg proto.Message) error

SubscriptionMode creates a GNMIOption that sets the Subscription mode in a proto.Message of type *gnmi.Subscription.

func SuppressRedundant

func SuppressRedundant(s bool) func(msg proto.Message) error

SuppressRedundant creates a GNMIOption that sets the SuppressRedundant in a proto.Message of type *gnmi.Subscription.

func Target

func Target(target string) func(msg proto.Message) error

Target creates a GNMIOption that set the gnmi Prefix target to the supplied string value. The proto.Message can be a *gnmi.GetRequest, *gnmi.SetRequest or a *gnmi.SubscribeRequest with RequestType Subscribe.

func Update

func Update(opts ...GNMIOption) func(msg proto.Message) error

Update creates a GNMIOption that creates a *gnmi.Update message and adds it to the supplied proto.Message, the supplied message must be a *gnmi.SetRequest.

func UpdatesOnly

func UpdatesOnly(b bool) func(msg proto.Message) error

UpdatesOnly creates a GNMIOption that sets the UpdatesOnly field in a *gnmi.SubscribeRequest with RequestType Subscribe.

func UseAliases

func UseAliases(b bool) func(msg proto.Message) error

UseAliases creates a GNMIOption that sets the UsesAliases field in a *gnmi.SubscribeRequest with RequestType Subscribe.

func Value

func Value(data interface{}, encoding string) func(msg proto.Message) error

Value creates a GNMIOption that creates a *gnmi.TypedValue and adds it to the supplied proto.Message. the supplied message must be a *gnmi.Update. If a map is supplied as `data interface{}` it has to be a map[string]interface{}.

Types

type GNMIOption

type GNMIOption func(proto.Message) error

type TargetOption

type TargetOption func(*target.Target) error

func Address

func Address(addr string) TargetOption

Address sets the target address. This Option can be set multiple times.

func Gzip

func Gzip(b bool) TargetOption

Gzip, if set to true, adds gzip compression to the gRPC connection.

func Insecure

func Insecure(i bool) TargetOption

Insecure sets the option to create a gNMI client with an insecure gRPC connection

func LogTLSSecret

func LogTLSSecret(b bool) TargetOption

LogTLSSecret, if set to true, enables logging of the TLS master key.

func Name

func Name(name string) TargetOption

Name sets the target name.

func Password

func Password(password string) TargetOption

Password sets the target Password.

func SkipVerify

func SkipVerify(i bool) TargetOption

SkipVerify sets the option to create a gNMI client with a secure gRPC connection without verifying the target's certificates.

func TLSCA

func TLSCA(tlsca string) TargetOption

TLSCA sets that path towards the TLS certificate authority file.

func TLSCert

func TLSCert(cert string) TargetOption

TLSCert sets that path towards the TLS certificate file.

func TLSKey

func TLSKey(key string) TargetOption

TLSKey sets that path towards the TLS key file.

func TLSMaxVersion

func TLSMaxVersion(v string) TargetOption

TLSMaxVersion sets the TLS maximum version used during the TLS handshake.

func TLSMinVersion

func TLSMinVersion(v string) TargetOption

TLSMinVersion sets the TLS minimum version used during the TLS handshake.

func TLSVersion

func TLSVersion(v string) TargetOption

TLSVersion sets the desired TLS version used during the TLS handshake.

func Timeout

func Timeout(timeout time.Duration) TargetOption

Timeout sets the gNMI client creation timeout.

func Token

func Token(token string) TargetOption

Token sets the per RPC credentials for all RPC calls.

func Username

func Username(username string) TargetOption

Username sets the target Username.

Jump to

Keyboard shortcuts

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