Documentation ¶
Index ¶
- Constants
- Variables
- func Accept(b bool) func(msg proto.Message) error
- func Alias(alias string) func(msg proto.Message) error
- func AllowAggregation(b bool) func(msg proto.Message) error
- func Atomic(b bool) func(msg proto.Message) error
- func Close(b bool) func(msg proto.Message) error
- func Data(d []byte) func(msg proto.Message) error
- func DataType(datat string) func(msg proto.Message) error
- func DataTypeALL() func(msg proto.Message) error
- func DataTypeCONFIG() func(msg proto.Message) error
- func DataTypeOPERATIONAL() func(msg proto.Message) error
- func DataTypeSTATE() func(msg proto.Message) error
- func Delete(path string) func(msg proto.Message) error
- func Encoding(encoding string) func(msg proto.Message) error
- func EncodingASCII() func(msg proto.Message) error
- func EncodingBYTES() func(msg proto.Message) error
- func EncodingCustom(enc int) func(msg proto.Message) error
- func EncodingJSON() func(msg proto.Message) error
- func EncodingJSON_IETF() func(msg proto.Message) error
- func EncodingPROTO() func(msg proto.Message) error
- func Error(e string) func(msg proto.Message) error
- func Extension(ext *gnmi_ext.Extension) func(msg proto.Message) error
- func Extension_HistoryRange(start, end string) func(msg proto.Message) error
- func Extension_HistorySnapshotTime(tm string) func(msg proto.Message) error
- func HeartbeatInterval(d time.Duration) func(msg proto.Message) error
- func NewCapabilitiesRequest(opts ...GNMIOption) (*gnmi.CapabilityRequest, error)
- func NewCapabilitiesResponse(opts ...GNMIOption) (*gnmi.CapabilityResponse, error)
- func NewData(opts ...TunnelOption) (*tpb.Data, error)
- func NewGetRequest(opts ...GNMIOption) (*gnmi.GetRequest, error)
- func NewGetResponse(opts ...GNMIOption) (*gnmi.GetResponse, error)
- func NewRegisterOpSession(opts ...TunnelOption) (*tpb.RegisterOp, error)
- func NewRegisterOpSubscription(opts ...TunnelOption) (*tpb.RegisterOp, error)
- func NewRegisterOpTarget(opts ...TunnelOption) (*tpb.RegisterOp, error)
- func NewSetRequest(opts ...GNMIOption) (*gnmi.SetRequest, error)
- func NewSetResponse(opts ...GNMIOption) (*gnmi.SetResponse, error)
- func NewSubscribePollRequest(opts ...GNMIOption) (*gnmi.SubscribeRequest, error)
- func NewSubscribeRequest(opts ...GNMIOption) (*gnmi.SubscribeRequest, error)
- func NewSubscribeResponse(opts ...GNMIOption) (*gnmi.SubscribeResponse, error)
- func NewSubscribeSyncResponse(opts ...GNMIOption) (*gnmi.SubscribeResponse, error)
- func NewTarget(opts ...TargetOption) (*target.Target, error)
- func Notification(opts ...GNMIOption) func(msg proto.Message) error
- func Operation(oper string) func(msg proto.Message) error
- func OperationDELETE() func(msg proto.Message) error
- func OperationINVALID() func(msg proto.Message) error
- func OperationREPLACE() func(msg proto.Message) error
- func OperationUPDATE() func(msg proto.Message) error
- func Path(path string) func(msg proto.Message) error
- func Prefix(prefix string) func(msg proto.Message) error
- func Qos(qos uint32) func(msg proto.Message) error
- func Replace(opts ...GNMIOption) func(msg proto.Message) error
- func SampleInterval(d time.Duration) func(msg proto.Message) error
- func Subscription(opts ...GNMIOption) func(msg proto.Message) error
- func SubscriptionListMode(mode string) func(msg proto.Message) error
- func SubscriptionListModeONCE() func(msg proto.Message) error
- func SubscriptionListModePOLL() func(msg proto.Message) error
- func SubscriptionListModeSTREAM() func(msg proto.Message) error
- func SubscriptionMode(mode string) func(msg proto.Message) error
- func SubscriptionModeON_CHANGE() func(msg proto.Message) error
- func SubscriptionModeSAMPLE() func(msg proto.Message) error
- func SubscriptionModeTARGET_DEFINED() func(msg proto.Message) error
- func SubscriptionOpSubscribe() func(msg proto.Message) error
- func SubscriptionOpUnsubscribe() func(msg proto.Message) error
- func SupportedEncoding(encodings ...string) func(msg proto.Message) error
- func SupportedModel(name, org, version string) func(msg proto.Message) error
- func SuppressRedundant(s bool) func(msg proto.Message) error
- func Tag(t int32) func(msg proto.Message) error
- func Target(target string) func(msg proto.Message) error
- func TargetName(n string) func(msg proto.Message) error
- func TargetOpAdd() func(msg proto.Message) error
- func TargetOpRemove() func(msg proto.Message) error
- func TargetType(typ string) func(msg proto.Message) error
- func Timestamp(t int64) func(msg proto.Message) error
- func TimestampNow() func(msg proto.Message) error
- func TunnelSession(opts ...TunnelOption) func(msg proto.Message) error
- func TunnelSubscription(opts ...TunnelOption) func(msg proto.Message) error
- func TunnelTarget(opts ...TunnelOption) func(msg proto.Message) error
- func Update(opts ...GNMIOption) func(msg proto.Message) error
- func UpdateResult(opts ...GNMIOption) func(msg proto.Message) error
- func UpdatesOnly(b bool) func(msg proto.Message) error
- func UseAliases(b bool) func(msg proto.Message) error
- func UseModel(name, org, version string) func(msg proto.Message) error
- func Value(data interface{}, encoding string) func(msg proto.Message) error
- func Version(v string) func(msg proto.Message) error
- type GNMIOption
- type TargetOption
- func Address(addr string) TargetOption
- func Gzip(b bool) TargetOption
- func Insecure(i bool) TargetOption
- func LogTLSSecret(b bool) TargetOption
- func Name(name string) TargetOption
- func Password(password string) TargetOption
- func SkipVerify(i bool) TargetOption
- func TLSCA(tlsca string) TargetOption
- func TLSCert(cert string) TargetOption
- func TLSKey(key string) TargetOption
- func TLSMaxVersion(v string) TargetOption
- func TLSMinVersion(v string) TargetOption
- func TLSVersion(v string) TargetOption
- func Timeout(timeout time.Duration) TargetOption
- func Token(token string) TargetOption
- func Username(username string) TargetOption
- type TunnelOption
Constants ¶
const (
DefaultGNMIVersion = "0.7.0"
)
Variables ¶
var DefaultTargetTimeout = 10 * time.Second
var ErrInvalidMsgType = errors.New("invalid message type")
ErrInvalidMsgType is returned by a GNMIOption in case the Option is supplied an unexpected proto.Message
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue is returned by a GNMIOption in case the Option is supplied an unexpected value.
Functions ¶
func AllowAggregation ¶
AllowAggregation creates a GNMIOption that sets the AllowAggregation field in a *gnmi.SubscribeRequest with RequestType Subscribe.
func DataType ¶
DataType creates a GNMIOption that adds the data type to the supplied proto.Message which must be a *gnmi.GetRequest.
func DataTypeALL ¶
DataTypeALL creates a GNMIOption that sets the gnmi.GetRequest data type to ALL
func DataTypeCONFIG ¶
DataTypeCONFIG creates a GNMIOption that sets the gnmi.GetRequest data type to CONFIG
func DataTypeOPERATIONAL ¶
DataTypeOPERATIONAL creates a GNMIOption that sets the gnmi.GetRequest data type to OPERATIONAL
func DataTypeSTATE ¶
DataTypeSTATE creates a GNMIOption that sets the gnmi.GetRequest data type to STATE
func Delete ¶
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 ¶
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 EncodingASCII ¶
EncodingASCII creates a GNMIOption that sets the encoding type to ASCII in a gnmi.GetRequest or gnmi.SubscribeRequest.
func EncodingBYTES ¶
EncodingBYTES creates a GNMIOption that sets the encoding type to BYTES in a gnmi.GetRequest or gnmi.SubscribeRequest.
func EncodingCustom ¶
EncodingCustom 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. Unlike Encoding, this GNMIOption does not validate if the provided encoding is defined by the gNMI spec.
func EncodingJSON ¶
EncodingJSON creates a GNMIOption that sets the encoding type to JSON in a gnmi.GetRequest or gnmi.SubscribeRequest.
func EncodingJSON_IETF ¶
EncodingJSON_IETF creates a GNMIOption that sets the encoding type to JSON_IETF in a gnmi.GetRequest or gnmi.SubscribeRequest.
func EncodingPROTO ¶
EncodingPROTO creates a GNMIOption that sets the encoding type to PROTO in a gnmi.GetRequest or gnmi.SubscribeRequest.
func Extension ¶
Extension creates a GNMIOption that applies the supplied gnmi_ext.Extension to the provided proto.Message.
func Extension_HistoryRange ¶
Extension_HistoryRange creates a GNMIOption that adds a gNMI extension of type History TimeRange with the supplied start and end times. the start/end values can be nanoseconds since Unix epoch or a date in RFC3339 format
func Extension_HistorySnapshotTime ¶
Extension_HistorySnapshotTime creates a GNMIOption that adds a gNMI extension of type History Snapshot with the supplied snapshot time. the snapshot value can be nanoseconds since Unix epoch or a date in RFC3339 format
func HeartbeatInterval ¶
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 provided GNMIOption list. returns an error in case one of the options is invalid
func NewCapabilitiesResponse ¶
func NewCapabilitiesResponse(opts ...GNMIOption) (*gnmi.CapabilityResponse, error)
NewCapabilitiesResponse creates a new *gnmi.CapabilityResponse using the provided 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 provided GNMIOption list. returns an error in case one of the options is invalid
func NewGetResponse ¶
func NewGetResponse(opts ...GNMIOption) (*gnmi.GetResponse, error)
NewGetResponse creates a new *gnmi.GetResponse using the provided GNMIOption list. returns an error in case one of the options is invalid
func NewRegisterOpSession ¶
func NewRegisterOpSession(opts ...TunnelOption) (*tpb.RegisterOp, error)
func NewRegisterOpSubscription ¶
func NewRegisterOpSubscription(opts ...TunnelOption) (*tpb.RegisterOp, error)
func NewRegisterOpTarget ¶
func NewRegisterOpTarget(opts ...TunnelOption) (*tpb.RegisterOp, error)
func NewSetRequest ¶
func NewSetRequest(opts ...GNMIOption) (*gnmi.SetRequest, error)
NewSetRequest creates a new *gnmi.SetRequest using the provided GNMIOption list. returns an error in case one of the options is invalid
func NewSetResponse ¶
func NewSetResponse(opts ...GNMIOption) (*gnmi.SetResponse, error)
NewSetResponse creates a new *gnmi.SetResponse using the provided GNMIOption list. returns an error in case one of the options is invalid
func NewSubscribePollRequest ¶
func NewSubscribePollRequest(opts ...GNMIOption) (*gnmi.SubscribeRequest, error)
NewSubscribePollRequest creates a new *gnmi.SubscribeRequest with request type Poll using the provided 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 provided GNMIOption list. returns an error in case one of the options is invalid
func NewSubscribeResponse ¶
func NewSubscribeResponse(opts ...GNMIOption) (*gnmi.SubscribeResponse, error)
NewSubscribeResponse creates a *gnmi.SubscribeResponse with a gnmi.SubscribeResponse_Update as response type.
func NewSubscribeSyncResponse ¶
func NewSubscribeSyncResponse(opts ...GNMIOption) (*gnmi.SubscribeResponse, error)
NewSubscribeResponse creates a *gnmi.SubscribeResponse with a gnmi.SubscribeResponse_SyncResponse as response type.
func Notification ¶
func Notification(opts ...GNMIOption) func(msg proto.Message) error
Notification creates a GNMIOption that builds a gnmi.Notification from the supplied GNMIOptions and adds it to the supplied proto.Message
func Operation ¶
Operation creates a GNMIOption that sets the gnmi.UpdateResult_Operation value in a gnmi.UpdateResult.
func OperationDELETE ¶
OperationDELETE creates a GNMIOption that sets the gnmi.SetResponse Operation to DELETE
func OperationINVALID ¶
OperationINVALID creates a GNMIOption that sets the gnmi.SetResponse Operation to INVALID
func OperationREPLACE ¶
OperationREPLACE creates a GNMIOption that sets the gnmi.SetResponse Operation to REPLACE
func OperationUPDATE ¶
OperationUPDATE creates a GNMIOption that sets the gnmi.SetResponse Operation to UPDATE
func Path ¶
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 ¶
Prefix creates a GNMIOption that creates a *gnmi.Path and adds it to the supplied proto.Message (as a Path Prefix). The proto.Message can be a *gnmi.GetRequest, *gnmi.SetRequest or a *gnmi.SubscribeRequest with RequestType Subscribe.
func Qos ¶
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 ¶
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 ¶
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 SubscriptionListModeONCE ¶
SubscriptionListModeONCE creates a GNMIOption that sets the Subscription List Mode to ONCE
func SubscriptionListModePOLL ¶
SubscriptionListModePOLL creates a GNMIOption that sets the Subscription List Mode to POLL
func SubscriptionListModeSTREAM ¶
SubscriptionListModeSTREAM creates a GNMIOption that sets the Subscription List Mode to STREAM
func SubscriptionMode ¶
SubscriptionMode creates a GNMIOption that sets the Subscription mode in a proto.Message of type *gnmi.Subscription.
func SubscriptionModeON_CHANGE ¶
SubscriptionModeON_CHANGE creates a GNMIOption that sets the subscription mode to ON_CHANGE
func SubscriptionModeSAMPLE ¶
SubscriptionModeSAMPLE creates a GNMIOption that sets the subscription mode to SAMPLE
func SubscriptionModeTARGET_DEFINED ¶
SubscriptionModeTARGET_DEFINED creates a GNMIOption that sets the subscription mode to TARGET_DEFINED
func SubscriptionOpSubscribe ¶
func SupportedEncoding ¶
SupportedEncoding creates an GNMIOption that sets the provided encodings as supported encodings in a gnmi.CapabilitiesResponse
func SupportedModel ¶
SupportedModel creates an GNMIOption that sets the provided name, org and version as a supported model in a gnmi.CapabilitiesResponse.
func SuppressRedundant ¶
SuppressRedundant creates a GNMIOption that sets the SuppressRedundant in a proto.Message of type *gnmi.Subscription.
func Target ¶
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 TargetOpAdd ¶
func TimestampNow ¶
TimestampNow is the same as Timestamp(time.Now().UnixNano())
func TunnelSession ¶
func TunnelSession(opts ...TunnelOption) func(msg proto.Message) error
func TunnelSubscription ¶
func TunnelSubscription(opts ...TunnelOption) func(msg proto.Message) error
func TunnelTarget ¶
func TunnelTarget(opts ...TunnelOption) func(msg proto.Message) error
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 UpdateResult ¶
func UpdateResult(opts ...GNMIOption) func(msg proto.Message) error
UpdateResult creates a GNMIOption that creates a gnmi.UpdateResult and adds it to a proto.Message of type gnmi.SetResponse.
func UpdatesOnly ¶
UpdatesOnly creates a GNMIOption that sets the UpdatesOnly field in a *gnmi.SubscribeRequest with RequestType Subscribe.
func UseAliases ¶
UseAliases creates a GNMIOption that sets the UsesAliases field in a *gnmi.SubscribeRequest with RequestType Subscribe.
func UseModel ¶
UseModel creates a GNMIOption that add a gnmi.DataModel to a gnmi.GetRequest or gnmi.SubscribeRequest based on the name, org and version strings provided.
Types ¶
type GNMIOption ¶
GNMIOption is a function that acts on the supplied proto.Message. The message is expected to be one of the protobuf defined gNMI messages exchanged by the RPCs or any of the nested messages.
type TargetOption ¶
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 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 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.
type TunnelOption ¶
TunnelOption is a function that acts on the supplied proto.Message. The message is expected to be one of the protobuf defined gRPC tunnel messages exchanged by the RPCs or any of the nested messages.