first try
This commit is contained in:
parent
c74114fe66
commit
2936cca8ca
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func ReadConfig() (*viper.Viper, error) {
|
||||
defaults := map[string]any{
|
||||
"name": "COOPGO Agenda",
|
||||
"name": "COOPGO Diags",
|
||||
"dev_env": false,
|
||||
"storage": map[string]any{
|
||||
"type": "mongodb",
|
||||
|
|
58
go.mod
58
go.mod
|
@ -1,3 +1,59 @@
|
|||
module git.coopgo.io/coopgo-platform/diags
|
||||
|
||||
go 1.18
|
||||
go 1.22.8
|
||||
|
||||
require (
|
||||
git.coopgo.io/coopgo-platform/agenda v1.0.0
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/rs/zerolog v1.33.0
|
||||
github.com/spf13/viper v1.19.0
|
||||
go.mongodb.org/mongo-driver v1.17.1
|
||||
google.golang.org/grpc v1.68.0
|
||||
google.golang.org/protobuf v1.35.2
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.12.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.1 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
|
||||
github.com/klauspost/compress v1.17.2 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
github.com/zclconf/go-cty v1.8.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.9.0 // indirect
|
||||
golang.org/x/crypto v0.27.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/net v0.29.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.25.0 // indirect
|
||||
golang.org/x/text v0.18.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
ariga.io/atlas v0.12.0 h1:jDfjxT3ppKhzqLS26lZv9ni7p9TVNrhy7SQquaF7bPs=
|
||||
ariga.io/atlas v0.12.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk=
|
||||
git.coopgo.io/coopgo-platform/agenda v1.0.0 h1:rTHgva1JKKO0wAPlINegifMkHm+xOg3IWW4yQRy334w=
|
||||
git.coopgo.io/coopgo-platform/agenda v1.0.0/go.mod h1:/hToSla0p6SeWn1zo1MDrfxdmo7RBdZDkbLqCVituIM=
|
||||
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
|
||||
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/hcl/v2 v2.10.0 h1:1S1UnuhDGlv3gRFV4+0EdwB+znNP5HmcGbIqwnSCByg=
|
||||
github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
|
||||
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
|
||||
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
||||
github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA=
|
||||
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
||||
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
|
||||
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
|
||||
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
|
||||
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
|
||||
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
||||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
||||
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
|
||||
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
|
||||
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
|
||||
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
@ -0,0 +1,7 @@
|
|||
# COOPGO Diags gRPC API
|
||||
|
||||
Generate Go code from proto files :
|
||||
|
||||
```
|
||||
protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. ./*.proto
|
||||
```
|
|
@ -0,0 +1,73 @@
|
|||
package grpcapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/diags/storage"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
|
||||
func (e Diag) ToStorageType() storage.Diag {
|
||||
diag := storage.Diag{
|
||||
ID: e.Id,
|
||||
Name: e.Name,
|
||||
Namespace: e.Namespace,
|
||||
Json_schema: e.JsonSchema,
|
||||
Ui_schema: e.UiSchema,
|
||||
Data: map[string]any{},
|
||||
Deleted: e.Deleted,
|
||||
}
|
||||
|
||||
for k, d := range e.Data.GetFields() {
|
||||
jsondata, err := protojson.Marshal(d)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
break
|
||||
}
|
||||
var data any
|
||||
json.Unmarshal(jsondata, &data)
|
||||
diag.Data[k] = data
|
||||
}
|
||||
|
||||
return diag
|
||||
}
|
||||
|
||||
func DiagFromStorageType(diag *storage.Diag) (*Diag, error) {
|
||||
|
||||
d, err := sanitizeData(diag.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := structpb.NewStruct(d)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Diag{
|
||||
Id: diag.ID,
|
||||
Name: diag.Name,
|
||||
Namespace: diag.Namespace,
|
||||
JsonSchema: diag.Json_schema,
|
||||
UiSchema: diag.Ui_schema,
|
||||
Data: data,
|
||||
Deleted: diag.Deleted,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func sanitizeData(data map[string]any) (d map[string]any, err error) {
|
||||
j, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(j, &d); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return d, nil
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.2
|
||||
// protoc v3.21.12
|
||||
// source: diag.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
structpb "google.golang.org/protobuf/types/known/structpb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Diag struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
JsonSchema string `protobuf:"bytes,4,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"`
|
||||
UiSchema string `protobuf:"bytes,5,opt,name=ui_schema,json=uiSchema,proto3" json:"ui_schema,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Deleted bool `protobuf:"varint,7,opt,name=deleted,proto3" json:"deleted,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Diag) Reset() {
|
||||
*x = Diag{}
|
||||
mi := &file_diag_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Diag) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Diag) ProtoMessage() {}
|
||||
|
||||
func (x *Diag) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diag_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Diag.ProtoReflect.Descriptor instead.
|
||||
func (*Diag) Descriptor() ([]byte, []int) {
|
||||
return file_diag_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Diag) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Diag) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Diag) GetNamespace() string {
|
||||
if x != nil {
|
||||
return x.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Diag) GetJsonSchema() string {
|
||||
if x != nil {
|
||||
return x.JsonSchema
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Diag) GetUiSchema() string {
|
||||
if x != nil {
|
||||
return x.UiSchema
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Diag) GetData() *structpb.Struct {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Diag) GetDeleted() bool {
|
||||
if x != nil {
|
||||
return x.Deleted
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_diag_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_diag_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x64, 0x69, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74,
|
||||
0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x04, 0x44,
|
||||
0x69, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73,
|
||||
0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x63,
|
||||
0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6a, 0x73, 0x6f, 0x6e,
|
||||
0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x69, 0x5f, 0x73, 0x63, 0x68,
|
||||
0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x69, 0x53, 0x63, 0x68,
|
||||
0x65, 0x6d, 0x61, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69,
|
||||
0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70,
|
||||
0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x64, 0x69, 0x61, 0x67,
|
||||
0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_diag_proto_rawDescOnce sync.Once
|
||||
file_diag_proto_rawDescData = file_diag_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_diag_proto_rawDescGZIP() []byte {
|
||||
file_diag_proto_rawDescOnce.Do(func() {
|
||||
file_diag_proto_rawDescData = protoimpl.X.CompressGZIP(file_diag_proto_rawDescData)
|
||||
})
|
||||
return file_diag_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_diag_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_diag_proto_goTypes = []any{
|
||||
(*Diag)(nil), // 0: Diag
|
||||
(*structpb.Struct)(nil), // 1: google.protobuf.Struct
|
||||
}
|
||||
var file_diag_proto_depIdxs = []int32{
|
||||
1, // 0: Diag.data:type_name -> google.protobuf.Struct
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_diag_proto_init() }
|
||||
func file_diag_proto_init() {
|
||||
if File_diag_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_diag_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_diag_proto_goTypes,
|
||||
DependencyIndexes: file_diag_proto_depIdxs,
|
||||
MessageInfos: file_diag_proto_msgTypes,
|
||||
}.Build()
|
||||
File_diag_proto = out.File
|
||||
file_diag_proto_rawDesc = nil
|
||||
file_diag_proto_goTypes = nil
|
||||
file_diag_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.coopgo.io/coopgo-platform/diags/grpcapi";
|
||||
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
message Diag {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string namespace = 3;
|
||||
string json_schema = 4;
|
||||
string ui_schema = 5;
|
||||
google.protobuf.Struct data = 6;
|
||||
bool deleted = 7;
|
||||
}
|
|
@ -0,0 +1,637 @@
|
|||
//COOPGO Diags gRPC service definition
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.2
|
||||
// protoc v3.21.12
|
||||
// source: diags.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
_ "google.golang.org/protobuf/types/known/structpb"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CreateDiagRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diag *Diag `protobuf:"bytes,1,opt,name=diag,proto3" json:"diag,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateDiagRequest) Reset() {
|
||||
*x = CreateDiagRequest{}
|
||||
mi := &file_diags_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateDiagRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateDiagRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateDiagRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateDiagRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateDiagRequest) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CreateDiagRequest) GetDiag() *Diag {
|
||||
if x != nil {
|
||||
return x.Diag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateDiagResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diag *Diag `protobuf:"bytes,2,opt,name=diag,proto3" json:"diag,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateDiagResponse) Reset() {
|
||||
*x = CreateDiagResponse{}
|
||||
mi := &file_diags_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateDiagResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateDiagResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateDiagResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateDiagResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateDiagResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateDiagResponse) GetDiag() *Diag {
|
||||
if x != nil {
|
||||
return x.Diag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetDiagRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDiagRequest) Reset() {
|
||||
*x = GetDiagRequest{}
|
||||
mi := &file_diags_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetDiagRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDiagRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetDiagRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetDiagRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetDiagRequest) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetDiagRequest) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetDiagResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diag *Diag `protobuf:"bytes,4,opt,name=diag,proto3" json:"diag,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDiagResponse) Reset() {
|
||||
*x = GetDiagResponse{}
|
||||
mi := &file_diags_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetDiagResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDiagResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetDiagResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetDiagResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetDiagResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetDiagResponse) GetDiag() *Diag {
|
||||
if x != nil {
|
||||
return x.Diag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteDiagRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteDiagRequest) Reset() {
|
||||
*x = DeleteDiagRequest{}
|
||||
mi := &file_diags_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteDiagRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteDiagRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteDiagRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteDiagRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteDiagRequest) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *DeleteDiagRequest) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeleteDiagResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ok bool `protobuf:"varint,6,opt,name=ok,proto3" json:"ok,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteDiagResponse) Reset() {
|
||||
*x = DeleteDiagResponse{}
|
||||
mi := &file_diags_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteDiagResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteDiagResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteDiagResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteDiagResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteDiagResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *DeleteDiagResponse) GetOk() bool {
|
||||
if x != nil {
|
||||
return x.Ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type GetDiagsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Namespaces []string `protobuf:"bytes,7,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
|
||||
Mindate *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=mindate,proto3" json:"mindate,omitempty"`
|
||||
Maxdate *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=maxdate,proto3" json:"maxdate,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDiagsRequest) Reset() {
|
||||
*x = GetDiagsRequest{}
|
||||
mi := &file_diags_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetDiagsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDiagsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetDiagsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetDiagsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetDiagsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetDiagsRequest) GetNamespaces() []string {
|
||||
if x != nil {
|
||||
return x.Namespaces
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetDiagsRequest) GetMindate() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Mindate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetDiagsRequest) GetMaxdate() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Maxdate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetDiagsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diags []*Diag `protobuf:"bytes,10,rep,name=diags,proto3" json:"diags,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDiagsResponse) Reset() {
|
||||
*x = GetDiagsResponse{}
|
||||
mi := &file_diags_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetDiagsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDiagsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetDiagsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetDiagsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetDiagsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetDiagsResponse) GetDiags() []*Diag {
|
||||
if x != nil {
|
||||
return x.Diags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateDiagRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diag *Diag `protobuf:"bytes,11,opt,name=diag,proto3" json:"diag,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateDiagRequest) Reset() {
|
||||
*x = UpdateDiagRequest{}
|
||||
mi := &file_diags_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateDiagRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateDiagRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateDiagRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateDiagRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateDiagRequest) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UpdateDiagRequest) GetDiag() *Diag {
|
||||
if x != nil {
|
||||
return x.Diag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateDiagResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Diag *Diag `protobuf:"bytes,12,opt,name=diag,proto3" json:"diag,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateDiagResponse) Reset() {
|
||||
*x = UpdateDiagResponse{}
|
||||
mi := &file_diags_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateDiagResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateDiagResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateDiagResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diags_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateDiagResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateDiagResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diags_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *UpdateDiagResponse) GetDiag() *Diag {
|
||||
if x != nil {
|
||||
return x.Diag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_diags_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_diags_proto_rawDesc = []byte{
|
||||
0x0a, 0x0b, 0x64, 0x69, 0x61, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
|
||||
0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x64, 0x69,
|
||||
0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a,
|
||||
0x04, 0x64, 0x69, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44, 0x69,
|
||||
0x61, 0x67, 0x52, 0x04, 0x64, 0x69, 0x61, 0x67, 0x22, 0x2f, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19,
|
||||
0x0a, 0x04, 0x64, 0x69, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44,
|
||||
0x69, 0x61, 0x67, 0x52, 0x04, 0x64, 0x69, 0x61, 0x67, 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74,
|
||||
0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2c, 0x0a, 0x0f, 0x47,
|
||||
0x65, 0x74, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19,
|
||||
0x0a, 0x04, 0x64, 0x69, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44,
|
||||
0x69, 0x61, 0x67, 0x52, 0x04, 0x64, 0x69, 0x61, 0x67, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c,
|
||||
0x65, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x24,
|
||||
0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x02, 0x6f, 0x6b, 0x22, 0x9d, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x67,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x64,
|
||||
0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
|
||||
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x64, 0x61, 0x74, 0x65, 0x12, 0x34,
|
||||
0x0a, 0x07, 0x6d, 0x61, 0x78, 0x64, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x6d, 0x61, 0x78,
|
||||
0x64, 0x61, 0x74, 0x65, 0x22, 0x2f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x67, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x05, 0x64, 0x69, 0x61, 0x67,
|
||||
0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44, 0x69, 0x61, 0x67, 0x52, 0x05,
|
||||
0x64, 0x69, 0x61, 0x67, 0x73, 0x22, 0x2e, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44,
|
||||
0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x04, 0x64, 0x69,
|
||||
0x61, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44, 0x69, 0x61, 0x67, 0x52,
|
||||
0x04, 0x64, 0x69, 0x61, 0x67, 0x22, 0x2f, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44,
|
||||
0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x64,
|
||||
0x69, 0x61, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x44, 0x69, 0x61, 0x67,
|
||||
0x52, 0x04, 0x64, 0x69, 0x61, 0x67, 0x32, 0x95, 0x02, 0x0a, 0x05, 0x44, 0x69, 0x61, 0x67, 0x73,
|
||||
0x12, 0x37, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x12, 0x12,
|
||||
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x13, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x07, 0x47, 0x65, 0x74,
|
||||
0x44, 0x69, 0x61, 0x67, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x67, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74,
|
||||
0x44, 0x69, 0x61, 0x67, 0x73, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x67, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61,
|
||||
0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x12, 0x12, 0x2e, 0x44, 0x65, 0x6c,
|
||||
0x65, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13,
|
||||
0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44,
|
||||
0x69, 0x61, 0x67, 0x12, 0x12, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x67,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x44, 0x69, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2d,
|
||||
0x5a, 0x2b, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f,
|
||||
0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f,
|
||||
0x64, 0x69, 0x61, 0x67, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_diags_proto_rawDescOnce sync.Once
|
||||
file_diags_proto_rawDescData = file_diags_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_diags_proto_rawDescGZIP() []byte {
|
||||
file_diags_proto_rawDescOnce.Do(func() {
|
||||
file_diags_proto_rawDescData = protoimpl.X.CompressGZIP(file_diags_proto_rawDescData)
|
||||
})
|
||||
return file_diags_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_diags_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_diags_proto_goTypes = []any{
|
||||
(*CreateDiagRequest)(nil), // 0: CreateDiagRequest
|
||||
(*CreateDiagResponse)(nil), // 1: CreateDiagResponse
|
||||
(*GetDiagRequest)(nil), // 2: GetDiagRequest
|
||||
(*GetDiagResponse)(nil), // 3: GetDiagResponse
|
||||
(*DeleteDiagRequest)(nil), // 4: DeleteDiagRequest
|
||||
(*DeleteDiagResponse)(nil), // 5: DeleteDiagResponse
|
||||
(*GetDiagsRequest)(nil), // 6: GetDiagsRequest
|
||||
(*GetDiagsResponse)(nil), // 7: GetDiagsResponse
|
||||
(*UpdateDiagRequest)(nil), // 8: UpdateDiagRequest
|
||||
(*UpdateDiagResponse)(nil), // 9: UpdateDiagResponse
|
||||
(*Diag)(nil), // 10: Diag
|
||||
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
|
||||
}
|
||||
var file_diags_proto_depIdxs = []int32{
|
||||
10, // 0: CreateDiagRequest.diag:type_name -> Diag
|
||||
10, // 1: CreateDiagResponse.diag:type_name -> Diag
|
||||
10, // 2: GetDiagResponse.diag:type_name -> Diag
|
||||
11, // 3: GetDiagsRequest.mindate:type_name -> google.protobuf.Timestamp
|
||||
11, // 4: GetDiagsRequest.maxdate:type_name -> google.protobuf.Timestamp
|
||||
10, // 5: GetDiagsResponse.diags:type_name -> Diag
|
||||
10, // 6: UpdateDiagRequest.diag:type_name -> Diag
|
||||
10, // 7: UpdateDiagResponse.diag:type_name -> Diag
|
||||
0, // 8: Diags.CreateDiag:input_type -> CreateDiagRequest
|
||||
2, // 9: Diags.GetDiag:input_type -> GetDiagRequest
|
||||
6, // 10: Diags.GetDiags:input_type -> GetDiagsRequest
|
||||
4, // 11: Diags.DeleteDiag:input_type -> DeleteDiagRequest
|
||||
8, // 12: Diags.UpdateDiag:input_type -> UpdateDiagRequest
|
||||
1, // 13: Diags.CreateDiag:output_type -> CreateDiagResponse
|
||||
3, // 14: Diags.GetDiag:output_type -> GetDiagResponse
|
||||
7, // 15: Diags.GetDiags:output_type -> GetDiagsResponse
|
||||
5, // 16: Diags.DeleteDiag:output_type -> DeleteDiagResponse
|
||||
9, // 17: Diags.UpdateDiag:output_type -> UpdateDiagResponse
|
||||
13, // [13:18] is the sub-list for method output_type
|
||||
8, // [8:13] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_diags_proto_init() }
|
||||
func file_diags_proto_init() {
|
||||
if File_diags_proto != nil {
|
||||
return
|
||||
}
|
||||
file_diag_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_diags_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_diags_proto_goTypes,
|
||||
DependencyIndexes: file_diags_proto_depIdxs,
|
||||
MessageInfos: file_diags_proto_msgTypes,
|
||||
}.Build()
|
||||
File_diags_proto = out.File
|
||||
file_diags_proto_rawDesc = nil
|
||||
file_diags_proto_goTypes = nil
|
||||
file_diags_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
//COOPGO Diags gRPC service definition
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.coopgo.io/coopgo-platform/diags/grpcapi";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "diag.proto";
|
||||
|
||||
service Diags {
|
||||
rpc CreateDiag(CreateDiagRequest) returns (CreateDiagResponse) {}
|
||||
rpc GetDiag(GetDiagRequest) returns (GetDiagResponse) {}
|
||||
rpc GetDiags(GetDiagsRequest) returns (GetDiagsResponse) {}
|
||||
rpc DeleteDiag(DeleteDiagRequest) returns (DeleteDiagResponse) {}
|
||||
rpc UpdateDiag(UpdateDiagRequest) returns (UpdateDiagResponse) {}
|
||||
}
|
||||
|
||||
message CreateDiagRequest {
|
||||
Diag diag = 1;
|
||||
}
|
||||
|
||||
message CreateDiagResponse {
|
||||
Diag diag = 2;
|
||||
}
|
||||
|
||||
message GetDiagRequest {
|
||||
string id = 3;
|
||||
}
|
||||
|
||||
message GetDiagResponse {
|
||||
Diag diag = 4;
|
||||
}
|
||||
|
||||
message DeleteDiagRequest {
|
||||
string id = 5;
|
||||
}
|
||||
|
||||
message DeleteDiagResponse {
|
||||
bool ok = 6;
|
||||
}
|
||||
|
||||
message GetDiagsRequest {
|
||||
repeated string namespaces = 7;
|
||||
google.protobuf.Timestamp mindate = 8;
|
||||
google.protobuf.Timestamp maxdate = 9;
|
||||
|
||||
}
|
||||
|
||||
message GetDiagsResponse {
|
||||
repeated Diag diags = 10;
|
||||
}
|
||||
|
||||
|
||||
message UpdateDiagRequest {
|
||||
Diag diag = 11;
|
||||
}
|
||||
|
||||
message UpdateDiagResponse {
|
||||
Diag diag = 12;
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
//COOPGO Diags gRPC service definition
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v3.21.12
|
||||
// source: diags.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Diags_CreateDiag_FullMethodName = "/Diags/CreateDiag"
|
||||
Diags_GetDiag_FullMethodName = "/Diags/GetDiag"
|
||||
Diags_GetDiags_FullMethodName = "/Diags/GetDiags"
|
||||
Diags_DeleteDiag_FullMethodName = "/Diags/DeleteDiag"
|
||||
Diags_UpdateDiag_FullMethodName = "/Diags/UpdateDiag"
|
||||
)
|
||||
|
||||
// DiagsClient is the client API for Diags service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type DiagsClient interface {
|
||||
CreateDiag(ctx context.Context, in *CreateDiagRequest, opts ...grpc.CallOption) (*CreateDiagResponse, error)
|
||||
GetDiag(ctx context.Context, in *GetDiagRequest, opts ...grpc.CallOption) (*GetDiagResponse, error)
|
||||
GetDiags(ctx context.Context, in *GetDiagsRequest, opts ...grpc.CallOption) (*GetDiagsResponse, error)
|
||||
DeleteDiag(ctx context.Context, in *DeleteDiagRequest, opts ...grpc.CallOption) (*DeleteDiagResponse, error)
|
||||
UpdateDiag(ctx context.Context, in *UpdateDiagRequest, opts ...grpc.CallOption) (*UpdateDiagResponse, error)
|
||||
}
|
||||
|
||||
type diagsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDiagsClient(cc grpc.ClientConnInterface) DiagsClient {
|
||||
return &diagsClient{cc}
|
||||
}
|
||||
|
||||
func (c *diagsClient) CreateDiag(ctx context.Context, in *CreateDiagRequest, opts ...grpc.CallOption) (*CreateDiagResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CreateDiagResponse)
|
||||
err := c.cc.Invoke(ctx, Diags_CreateDiag_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *diagsClient) GetDiag(ctx context.Context, in *GetDiagRequest, opts ...grpc.CallOption) (*GetDiagResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetDiagResponse)
|
||||
err := c.cc.Invoke(ctx, Diags_GetDiag_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *diagsClient) GetDiags(ctx context.Context, in *GetDiagsRequest, opts ...grpc.CallOption) (*GetDiagsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetDiagsResponse)
|
||||
err := c.cc.Invoke(ctx, Diags_GetDiags_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *diagsClient) DeleteDiag(ctx context.Context, in *DeleteDiagRequest, opts ...grpc.CallOption) (*DeleteDiagResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DeleteDiagResponse)
|
||||
err := c.cc.Invoke(ctx, Diags_DeleteDiag_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *diagsClient) UpdateDiag(ctx context.Context, in *UpdateDiagRequest, opts ...grpc.CallOption) (*UpdateDiagResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(UpdateDiagResponse)
|
||||
err := c.cc.Invoke(ctx, Diags_UpdateDiag_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DiagsServer is the server API for Diags service.
|
||||
// All implementations must embed UnimplementedDiagsServer
|
||||
// for forward compatibility.
|
||||
type DiagsServer interface {
|
||||
CreateDiag(context.Context, *CreateDiagRequest) (*CreateDiagResponse, error)
|
||||
GetDiag(context.Context, *GetDiagRequest) (*GetDiagResponse, error)
|
||||
GetDiags(context.Context, *GetDiagsRequest) (*GetDiagsResponse, error)
|
||||
DeleteDiag(context.Context, *DeleteDiagRequest) (*DeleteDiagResponse, error)
|
||||
UpdateDiag(context.Context, *UpdateDiagRequest) (*UpdateDiagResponse, error)
|
||||
mustEmbedUnimplementedDiagsServer()
|
||||
}
|
||||
|
||||
// UnimplementedDiagsServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedDiagsServer struct{}
|
||||
|
||||
func (UnimplementedDiagsServer) CreateDiag(context.Context, *CreateDiagRequest) (*CreateDiagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateDiag not implemented")
|
||||
}
|
||||
func (UnimplementedDiagsServer) GetDiag(context.Context, *GetDiagRequest) (*GetDiagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDiag not implemented")
|
||||
}
|
||||
func (UnimplementedDiagsServer) GetDiags(context.Context, *GetDiagsRequest) (*GetDiagsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDiags not implemented")
|
||||
}
|
||||
func (UnimplementedDiagsServer) DeleteDiag(context.Context, *DeleteDiagRequest) (*DeleteDiagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteDiag not implemented")
|
||||
}
|
||||
func (UnimplementedDiagsServer) UpdateDiag(context.Context, *UpdateDiagRequest) (*UpdateDiagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateDiag not implemented")
|
||||
}
|
||||
func (UnimplementedDiagsServer) mustEmbedUnimplementedDiagsServer() {}
|
||||
func (UnimplementedDiagsServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeDiagsServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DiagsServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDiagsServer interface {
|
||||
mustEmbedUnimplementedDiagsServer()
|
||||
}
|
||||
|
||||
func RegisterDiagsServer(s grpc.ServiceRegistrar, srv DiagsServer) {
|
||||
// If the following call pancis, it indicates UnimplementedDiagsServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Diags_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Diags_CreateDiag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateDiagRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiagsServer).CreateDiag(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Diags_CreateDiag_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiagsServer).CreateDiag(ctx, req.(*CreateDiagRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Diags_GetDiag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetDiagRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiagsServer).GetDiag(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Diags_GetDiag_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiagsServer).GetDiag(ctx, req.(*GetDiagRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Diags_GetDiags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetDiagsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiagsServer).GetDiags(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Diags_GetDiags_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiagsServer).GetDiags(ctx, req.(*GetDiagsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Diags_DeleteDiag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteDiagRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiagsServer).DeleteDiag(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Diags_DeleteDiag_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiagsServer).DeleteDiag(ctx, req.(*DeleteDiagRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Diags_UpdateDiag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateDiagRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiagsServer).UpdateDiag(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Diags_UpdateDiag_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiagsServer).UpdateDiag(ctx, req.(*UpdateDiagRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Diags_ServiceDesc is the grpc.ServiceDesc for Diags service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Diags_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Diags",
|
||||
HandlerType: (*DiagsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateDiag",
|
||||
Handler: _Diags_CreateDiag_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDiag",
|
||||
Handler: _Diags_GetDiag_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDiags",
|
||||
Handler: _Diags_GetDiags_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteDiag",
|
||||
Handler: _Diags_DeleteDiag_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateDiag",
|
||||
Handler: _Diags_UpdateDiag_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "diags.proto",
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
package grpcapi
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/diags/handlers"
|
||||
// "git.coopgo.io/coopgo-platform/diags/storage"
|
||||
// timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/reflection"
|
||||
status "google.golang.org/grpc/status"
|
||||
// "google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
type DiagsServerImpl struct {
|
||||
handler handlers.DiagsHandler
|
||||
}
|
||||
|
||||
func NewDiagsServer(h handlers.DiagsHandler) *DiagsServerImpl {
|
||||
return &DiagsServerImpl{
|
||||
handler: h,
|
||||
}
|
||||
}
|
||||
|
||||
func (s DiagsServerImpl) CreateDiag(ctx context.Context, req *CreateDiagRequest) (*CreateDiagResponse, error) {
|
||||
e := req.Diag.ToStorageType()
|
||||
diag, err := s.handler.CreateDiag(e)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.AlreadyExists, "diag creation failed : %v", err)
|
||||
}
|
||||
response, err := DiagFromStorageType(diag)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.Internal, "issue while retrieving diag : %v", err)
|
||||
}
|
||||
return &CreateDiagResponse{Diag: response}, nil
|
||||
}
|
||||
func (s DiagsServerImpl) GetDiag(ctx context.Context, req *GetDiagRequest) (*GetDiagResponse, error) {
|
||||
diag, err := s.handler.GetDiag(req.Id)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.AlreadyExists, "issue while retrieving diag : %v", err)
|
||||
}
|
||||
response, err := DiagFromStorageType(diag)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.Internal, "issue while retrieving diag : %v", err)
|
||||
}
|
||||
return &GetDiagResponse{Diag: response}, nil
|
||||
}
|
||||
func (s DiagsServerImpl) GetDiags(ctx context.Context, req *GetDiagsRequest) (*GetDiagsResponse, error) {
|
||||
var mindate, maxdate *time.Time
|
||||
|
||||
if req.Mindate != nil {
|
||||
m := req.Mindate.AsTime()
|
||||
mindate = &m
|
||||
}
|
||||
|
||||
if req.Maxdate != nil {
|
||||
m := req.Maxdate.AsTime()
|
||||
mindate = &m
|
||||
}
|
||||
|
||||
responses, err := s.handler.GetDiags(req.Namespaces, mindate, maxdate)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.NotFound, "could not get diags : %v", err)
|
||||
}
|
||||
var diags []*Diag
|
||||
|
||||
for _, e := range responses {
|
||||
diag, err := DiagFromStorageType(&e)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.Internal, "could not get diags : %v", err)
|
||||
}
|
||||
diags = append(diags, diag)
|
||||
}
|
||||
return &GetDiagsResponse{Diags: diags}, nil
|
||||
}
|
||||
func (s DiagsServerImpl) DeleteDiag(context.Context, *DeleteDiagRequest) (*DeleteDiagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteDiag not implemented")
|
||||
}
|
||||
|
||||
|
||||
func (s DiagsServerImpl) UpdateDiag(ctx context.Context, req *UpdateDiagRequest) (*UpdateDiagResponse, error) {
|
||||
b := req.Diag.ToStorageType()
|
||||
diag, err := s.handler.UpdateDiag(b)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.AlreadyExists, "diag update failed : %v", err)
|
||||
}
|
||||
response, err := DiagFromStorageType(diag)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, status.Errorf(codes.Internal, "issue while retrieving diag : %v", err)
|
||||
}
|
||||
return &UpdateDiagResponse{Diag: response}, nil
|
||||
}
|
||||
|
||||
func (s DiagsServerImpl) mustEmbedUnimplementedDiagsServer() {}
|
||||
|
||||
func Run(done chan error, cfg *viper.Viper, handler handlers.DiagsHandler) {
|
||||
var (
|
||||
dev_env = cfg.GetBool("dev_env")
|
||||
address = ":" + cfg.GetString("services.grpc.port")
|
||||
)
|
||||
log.Info().Str("address", address).Msg("Running gRPC server")
|
||||
|
||||
server := grpc.NewServer()
|
||||
RegisterDiagsServer(server, NewDiagsServer(handler))
|
||||
l, err := net.Listen("tcp", address)
|
||||
if err != nil {
|
||||
log.Fatal().Str("address", address).Err(err).Msg("Cannot listen to address")
|
||||
}
|
||||
|
||||
if dev_env {
|
||||
reflection.Register(server)
|
||||
}
|
||||
|
||||
if err := server.Serve(l); err != nil {
|
||||
log.Error().Err(err).Msg("gRPC service ended")
|
||||
done <- err
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/diags/storage"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func (h DiagsHandler) CreateDiag(diag storage.Diag) (*storage.Diag, error) {
|
||||
if diag.ID == "" {
|
||||
diag.ID = uuid.NewString()
|
||||
}
|
||||
|
||||
if err := h.storage.CreateDiag(diag); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &diag, nil
|
||||
}
|
||||
|
||||
func (h DiagsHandler) GetDiag(id string) (diag *storage.Diag, err error) {
|
||||
diag, err = h.storage.GetDiag(id)
|
||||
return
|
||||
}
|
||||
|
||||
func (h DiagsHandler) GetDiags(namespaces []string, mindate *time.Time, maxdate *time.Time) (results []storage.Diag, err error) {
|
||||
results = []storage.Diag{}
|
||||
diags, err := h.storage.GetDiags(namespaces)
|
||||
if err == nil {
|
||||
for _, diag := range diags {
|
||||
results = append(results, diag)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (h DiagsHandler) UpdateDiag(diag storage.Diag) (*storage.Diag, error) {
|
||||
|
||||
// Store the account
|
||||
if err := h.storage.UpdateDiag(diag); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &diag, nil
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"git.coopgo.io/coopgo-platform/diags/storage"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type DiagsHandler struct {
|
||||
config *viper.Viper
|
||||
storage storage.Storage
|
||||
}
|
||||
|
||||
func NewHandler(cfg *viper.Viper, storage storage.Storage) DiagsHandler {
|
||||
return DiagsHandler{
|
||||
config: cfg,
|
||||
storage: storage,
|
||||
}
|
||||
}
|
42
main.go
42
main.go
|
@ -9,4 +9,44 @@ import (
|
|||
"git.coopgo.io/coopgo-platform/diags/grpcapi"
|
||||
"git.coopgo.io/coopgo-platform/diags/handlers"
|
||||
"git.coopgo.io/coopgo-platform/diags/storage"
|
||||
)
|
||||
)
|
||||
|
||||
func main() {
|
||||
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
|
||||
|
||||
cfg, err := ReadConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var (
|
||||
service_name = cfg.GetString("name")
|
||||
grpc_enable = cfg.GetBool("services.grpc.enable")
|
||||
dev_env = cfg.GetBool("dev_env")
|
||||
)
|
||||
|
||||
if dev_env {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||
}
|
||||
|
||||
storage, err := storage.NewStorage(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
handler := handlers.NewHandler(cfg, storage)
|
||||
|
||||
failed := make(chan error)
|
||||
|
||||
log.Info().Str("service_name", service_name).Msg("Running service")
|
||||
|
||||
if grpc_enable {
|
||||
go grpcapi.Run(failed, cfg, handler)
|
||||
}
|
||||
|
||||
// Terminate if one of the services fails
|
||||
|
||||
err = <-failed
|
||||
|
||||
log.Fatal().Err(err).Msg("Terminating server")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package storage
|
||||
|
||||
type Diag struct {
|
||||
ID string `json:"id" bson:"_id"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Json_schema string `json:"json_schema"`
|
||||
Ui_schema string `json:"ui_schema"`
|
||||
Data map[string]any `json:"data"`
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
|
||||
type MongoDBStorage struct {
|
||||
*mongo.Client
|
||||
DbName string
|
||||
Collections map[string]string
|
||||
}
|
||||
|
||||
func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) {
|
||||
var (
|
||||
mongodb_host = cfg.GetString("storage.db.mongodb.host")
|
||||
mongodb_port = cfg.GetString("storage.db.mongodb.port")
|
||||
mongodb_dbname = cfg.GetString("storage.db.mongodb.db_name")
|
||||
mongodb_diags = cfg.GetString("storage.db.mongodb.collections.diags")
|
||||
)
|
||||
|
||||
client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://" + mongodb_host + ":" + mongodb_port))
|
||||
if err != nil {
|
||||
return MongoDBStorage{}, err
|
||||
}
|
||||
|
||||
err = client.Connect(context.TODO())
|
||||
|
||||
if err != nil {
|
||||
return MongoDBStorage{}, err
|
||||
}
|
||||
|
||||
storage := MongoDBStorage{
|
||||
Client: client,
|
||||
DbName: mongodb_dbname,
|
||||
Collections: map[string]string{
|
||||
"diags": mongodb_diags,
|
||||
},
|
||||
}
|
||||
//TODO Indexes
|
||||
return storage, err
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) CreateDiag(diag Diag) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["diags"])
|
||||
if _, err := collection.InsertOne(context.TODO(), diag); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetDiag(id string) (*Diag, error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["diags"])
|
||||
|
||||
diag := &Diag{}
|
||||
if err := collection.FindOne(context.TODO(), bson.M{"_id": id}).Decode(diag); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return diag, nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetDiags(namespaces []string) (diags []Diag, err error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["diags"])
|
||||
|
||||
var cur *mongo.Cursor
|
||||
|
||||
findOptions := options.Find()
|
||||
//findOptions.SetSort(bson.D{{"startdate", 1}})
|
||||
|
||||
if len(namespaces) == 0 {
|
||||
cur, err = collection.Find(context.TODO(), bson.D{}, findOptions)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return diags, err
|
||||
}
|
||||
} else {
|
||||
cur, err = collection.Find(context.TODO(), bson.M{"namespace": bson.M{"$in": namespaces}}, findOptions)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return diags, err
|
||||
}
|
||||
}
|
||||
|
||||
for cur.Next(context.TODO()) {
|
||||
var diag Diag
|
||||
//var elem bson.M
|
||||
|
||||
if err := cur.Decode(&diag); err != nil {
|
||||
return diags, err
|
||||
}
|
||||
|
||||
diags = append(diags, diag)
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) UpdateDiag(diag Diag) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["diags"])
|
||||
if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": diag.ID}, diag); err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type Storage interface {
|
||||
CreateDiag(Diag) error
|
||||
GetDiag(string) (*Diag, error)
|
||||
GetDiags(namespaces []string) ([]Diag, error)
|
||||
UpdateDiag(Diag) error}
|
||||
type StorageImpl struct {
|
||||
}
|
||||
|
||||
func NewStorage(cfg *viper.Viper) (Storage, error) {
|
||||
var (
|
||||
storage_type = cfg.GetString("storage.db.type")
|
||||
)
|
||||
|
||||
switch storage_type {
|
||||
case "mongodb":
|
||||
s, err := NewMongoDBStorage(cfg)
|
||||
return s, err
|
||||
default:
|
||||
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue