Documentation
¶
Index ¶
- Variables
- type AuthenticationError
- type CertificateError
- type ConnectionState
- type DebugLogger
- type EndpointError
- type OpcUAClient
- func (o *OpcUAClient) Connect(ctx context.Context) error
- func (o *OpcUAClient) Disconnect(ctx context.Context) error
- func (o *OpcUAClient) NamespaceArray() []string
- func (o *OpcUAClient) SetupOptions() error
- func (o *OpcUAClient) State() ConnectionState
- func (o *OpcUAClient) StatusCodeOK(code ua.StatusCode) bool
- func (o *OpcUAClient) UpdateNamespaceArray(ctx context.Context) error
- type OpcUAClientConfig
- type OpcUAWorkarounds
- type SecurityError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidEndpoint indicates an invalid or malformed endpoint URL ErrInvalidEndpoint = errors.New("invalid endpoint") // ErrInvalidSecurityPolicy indicates an unsupported security policy ErrInvalidSecurityPolicy = errors.New("invalid security policy") // ErrInvalidSecurityMode indicates an unsupported security mode ErrInvalidSecurityMode = errors.New("invalid security mode") // ErrInvalidAuthMethod indicates an unsupported authentication method ErrInvalidAuthMethod = errors.New("invalid authentication method") // ErrCertificateGeneration indicates a failure in certificate generation ErrCertificateGeneration = errors.New("certificate generation failed") // ErrConnectionFailed indicates a connection failure ErrConnectionFailed = errors.New("connection failed") // ErrEndpointNotFound indicates no suitable endpoint was found ErrEndpointNotFound = errors.New("no suitable endpoint found") // ErrInvalidConfiguration indicates invalid configuration parameters ErrInvalidConfiguration = errors.New("invalid configuration") // ErrStatusCodeParsing indicates failure to parse status codes ErrStatusCodeParsing = errors.New("status code parsing failed") )
Common OPC UA error types for better error handling and classification
Functions ¶
This section is empty.
Types ¶
type AuthenticationError ¶
AuthenticationError represents an error related to authentication
func (*AuthenticationError) Error ¶
func (e *AuthenticationError) Error() string
func (*AuthenticationError) Unwrap ¶
func (e *AuthenticationError) Unwrap() error
type CertificateError ¶
CertificateError represents an error related to certificate operations
func (*CertificateError) Error ¶
func (e *CertificateError) Error() string
func (*CertificateError) Unwrap ¶
func (e *CertificateError) Unwrap() error
type ConnectionState ¶
const ( Closed ConnectionState = ConnectionState(opcua.Closed) Connected ConnectionState = ConnectionState(opcua.Connected) Connecting ConnectionState = ConnectionState(opcua.Connecting) Disconnected ConnectionState = ConnectionState(opcua.Disconnected) Reconnecting ConnectionState = ConnectionState(opcua.Reconnecting) )
func (ConnectionState) String ¶
func (c ConnectionState) String() string
type DebugLogger ¶
DebugLogger logs messages from opcua at the debug level.
type EndpointError ¶
EndpointError represents an error related to endpoint configuration
func (*EndpointError) Error ¶
func (e *EndpointError) Error() string
func (*EndpointError) Unwrap ¶
func (e *EndpointError) Unwrap() error
type OpcUAClient ¶
type OpcUAClient struct {
Config *OpcUAClientConfig
Log telegraf.Logger
Client *opcua.Client
// contains filtered or unexported fields
}
func (*OpcUAClient) Connect ¶
func (o *OpcUAClient) Connect(ctx context.Context) error
Connect to an OPC UA device
func (*OpcUAClient) Disconnect ¶
func (o *OpcUAClient) Disconnect(ctx context.Context) error
func (*OpcUAClient) NamespaceArray ¶
func (o *OpcUAClient) NamespaceArray() []string
NamespaceArray returns the cached namespace array
func (*OpcUAClient) SetupOptions ¶
func (o *OpcUAClient) SetupOptions() error
SetupOptions reads the endpoints from the specified server and sets up all authentication
func (*OpcUAClient) State ¶
func (o *OpcUAClient) State() ConnectionState
func (*OpcUAClient) StatusCodeOK ¶
func (o *OpcUAClient) StatusCodeOK(code ua.StatusCode) bool
func (*OpcUAClient) UpdateNamespaceArray ¶
func (o *OpcUAClient) UpdateNamespaceArray(ctx context.Context) error
UpdateNamespaceArray fetches the namespace array from the OPC UA server The namespace array is stored at the well-known node ns=0;i=2255
type OpcUAClientConfig ¶
type OpcUAClientConfig struct {
Endpoint string `toml:"endpoint"`
SecurityPolicy string `toml:"security_policy"`
SecurityMode string `toml:"security_mode"`
Certificate string `toml:"certificate"`
PrivateKey string `toml:"private_key"`
RemoteCertificate string `toml:"remote_certificate"`
Username config.Secret `toml:"username"`
Password config.Secret `toml:"password"`
AuthMethod string `toml:"auth_method"`
ConnectTimeout config.Duration `toml:"connect_timeout"`
RequestTimeout config.Duration `toml:"request_timeout"`
ClientTrace bool `toml:"client_trace"`
OptionalFields []string `toml:"optional_fields"`
Workarounds OpcUAWorkarounds `toml:"workarounds"`
SessionTimeout config.Duration `toml:"session_timeout"`
}
func (*OpcUAClientConfig) CreateClient ¶
func (o *OpcUAClientConfig) CreateClient(telegrafLogger telegraf.Logger) (*OpcUAClient, error)
func (*OpcUAClientConfig) Validate ¶
func (o *OpcUAClientConfig) Validate() error
type OpcUAWorkarounds ¶
type OpcUAWorkarounds struct {
AdditionalValidStatusCodes []string `toml:"additional_valid_status_codes"`
}
type SecurityError ¶
SecurityError represents an error related to security configuration
func (*SecurityError) Error ¶
func (e *SecurityError) Error() string
func (*SecurityError) Unwrap ¶
func (e *SecurityError) Unwrap() error