From 0ab6bb02e0acbcd68874464cae878a55a7ca7930 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Sun, 1 Oct 2023 15:49:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20update=20opcua=20subcommand=20he?= =?UTF-8?q?lp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- providers/opcua/config/config.go | 14 ++++++++++---- providers/opcua/main.go | 7 +++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/providers/opcua/config/config.go b/providers/opcua/config/config.go index 6b7206ee1d..f614d9360c 100644 --- a/providers/opcua/config/config.go +++ b/providers/opcua/config/config.go @@ -15,16 +15,22 @@ var Config = plugin.Provider{ ConnectionTypes: []string{provider.ConnectionType}, Connectors: []plugin.Connector{ { - Name: "opcua", - Use: "opcua", - Short: "OPC UA", + Name: "opcua", + Use: "opcua [--endpoint ]", + Short: "OPC UA", + Long: `The opcua sub-command is designed for interfacing with resources on an OPC UA (Open Platform +Communications Unified Architecture) server, a protocol facilitating machine-to-machine communications within +the realm of industrial automation. +`, + Discovery: []string{}, Flags: []plugin.Flag{ { Long: "endpoint", Type: plugin.FlagType_String, Default: "", - Desc: "OPC UA service endpoint", + Desc: "OPC UA endpoint URL of the OPC UA server in the format opc.tcp://:", + Option: plugin.FlagOption_Required, }, }, }, diff --git a/providers/opcua/main.go b/providers/opcua/main.go index b9a75a5831..7d4b4316f8 100644 --- a/providers/opcua/main.go +++ b/providers/opcua/main.go @@ -10,6 +10,13 @@ import ( "go.mondoo.com/cnquery/providers/opcua/provider" ) +// This is the entry point for the OPCUA provider. +// +// To test the provider, start the simulator: +// docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5 --ut --dca +// +// Once the simulator is running, you can query it: +// cnquery shell opcua --endpoint opc.tcp://localhost:50000 func main() { plugin.Start(os.Args, provider.Init()) }