ncerr

package
v0.0.0-...-a72c053 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ncerr provides NETCONF error types and constructors.

Source: RFC6241 section 4.3, Appendix A

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	XMLName  xml.Name          `xml:"urn:ietf:params:xml:ns:netconf:base:1.0 rpc-error" json:"-"`
	Type     Type              `xml:"error-type" json:"error-type"`
	Tag      string            `xml:"error-tag" json:"error-tag"`
	Severity Severity          `xml:"error-severity" json:"error-severity"`
	AppTag   string            `xml:"error-app-tag,omitempty" json:"error-app-tag,omitempty"`
	Path     string            `xml:"error-path,omitempty" json:"error-path,omitempty"`
	Message  string            `xml:"error-message,omitempty" json:"error-message,omitempty"`
	Info     *rfc6241errorInfo `xml:"error-info,omitempty" json:"error-info,omitempty"`
}

Error represents a NETCONF error.

XMLName must be set prior to calls to xml.Marshal. For example, to frame the error as an <rpc-error>:

e := &Error{}
e.XMLName = xml.Name{Space: "urn:ietf:params:xml:ns:netconf:base:1.0", Local:"rpc-error"}
out, _ := xml.Marshal(e)

func AccessDenied

func AccessDenied(opts ...Option) *Error

func BadAttribute

func BadAttribute(attributeName, elementName string, opts ...Option) *Error

func BadElement

func BadElement(elementName string, opts ...Option) *Error

func DataExists

func DataExists(opts ...Option) *Error

func DataMissing

func DataMissing(opts ...Option) *Error

func InUse

func InUse(opts ...Option) *Error

func InvalidValue

func InvalidValue(opts ...Option) *Error

func LockDenied

func LockDenied(sessionID string, opts ...Option) *Error

func MalformedMessage

func MalformedMessage(opts ...Option) *Error

func MissingAttribute

func MissingAttribute(attributeName, elementName string, opts ...Option) *Error

func MissingElement

func MissingElement(elementName string, opts ...Option) *Error

func OperationFailed

func OperationFailed(opts ...Option) *Error

func OperationNotSupported

func OperationNotSupported(opts ...Option) *Error

func ResourceDenied

func ResourceDenied(opts ...Option) *Error

func RollbackFailed

func RollbackFailed(opts ...Option) *Error

func TooBig

func TooBig(opts ...Option) *Error

func UnknownAttribute

func UnknownAttribute(attributeName, elementName string, opts ...Option) *Error

func UnknownElement

func UnknownElement(elementName string, opts ...Option) *Error

func UnknownNamespace

func UnknownNamespace(elementName, namespace string, opts ...Option) *Error

func (Error) Error

func (e Error) Error() string

type Option

type Option func(*Error)

Option is an Error option function

func WithError

func WithError(err error) Option

func WithMessage

func WithMessage(msg string) Option

func WithMessageF

func WithMessageF(format string, args ...interface{}) Option

func WithType

func WithType(t Type) Option

type Severity

type Severity int

Severity represents the NETCONF error-severity enumerate

const (
	// SeverityError indicates "error" level
	SeverityError Severity = iota
	// SeverityWarning indicates "warning" level.
	// (Not used in errors defined in RFC6241 Appendix A)
	SeverityWarning
)

func (Severity) MarshalText

func (s Severity) MarshalText() ([]byte, error)

func (Severity) String

func (s Severity) String() string

func (*Severity) UnmarshalText

func (s *Severity) UnmarshalText(b []byte) error

type Type

type Type int

Type represents the NETCONF error-type enumerate

const (
	// TypeApplication is an application layer error
	TypeApplication Type = iota
	// TypeProtocol is a NETCONF protocol layer error
	TypeProtocol
	// TypeRPC is a NETCONF RPC layer error
	TypeRPC
	// TypeTransport is an error at the secure transport layer
	TypeTransport
)

func (Type) MarshalText

func (t Type) MarshalText() ([]byte, error)

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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