diff --git a/app-service-template/Attribution.txt b/app-service-template/Attribution.txt index 73cc848d4..61da417dd 100644 --- a/app-service-template/Attribution.txt +++ b/app-service-template/Attribution.txt @@ -184,4 +184,7 @@ stretchr/objx (MIT) https://github.com/stretchr/objx https://github.com/stretchr/objx/blob/master/LICENSE github.com/gorilla/websocket (BSD-2) https://github.com/gorilla/websocket -https://github.com/gorilla/websocket/blob/master/LICENSE \ No newline at end of file +https://github.com/gorilla/websocket/blob/master/LICENSE + +github.com/go-kit/log (MIT) https://github.com/go-kit/log +https://github.com/go-kit/log/blob/main/LICENSE diff --git a/app-service-template/go.mod b/app-service-template/go.mod index a12a8c3c3..2e6e9a600 100644 --- a/app-service-template/go.mod +++ b/app-service-template/go.mod @@ -6,7 +6,7 @@ go 1.17 require ( github.com/edgexfoundry/app-functions-sdk-go/v2 v2.1.0 - github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0 + github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9 github.com/google/uuid v1.3.0 github.com/stretchr/testify v1.7.0 ) @@ -25,11 +25,11 @@ require ( github.com/edgexfoundry/go-mod-secrets/v2 v2.1.0 // indirect github.com/fatih/color v1.9.0 // indirect github.com/fxamacker/cbor/v2 v2.4.0 // indirect - github.com/go-kit/kit v0.11.0 // indirect - github.com/go-logfmt/logfmt v0.5.0 // indirect + github.com/go-kit/log v0.2.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect - github.com/go-playground/validator/v10 v10.9.0 // indirect + github.com/go-playground/validator/v10 v10.10.0 // indirect github.com/go-redis/redis/v7 v7.3.0 // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect github.com/gorilla/mux v1.8.0 // indirect @@ -56,10 +56,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect + golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect + golang.org/x/text v0.3.7 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/app-service-template/go.sum b/app-service-template/go.sum index 97dd02e58..76c7846f2 100644 --- a/app-service-template/go.sum +++ b/app-service-template/go.sum @@ -56,8 +56,9 @@ github.com/edgexfoundry/go-mod-bootstrap/v2 v2.1.0 h1:SKhMq8BLUQExVZwZ7slTzxbTsa github.com/edgexfoundry/go-mod-bootstrap/v2 v2.1.0/go.mod h1:+ZXclfGAK0PAyJ4RygGB7R2R6IyoRN0qzsQpOsfClvA= github.com/edgexfoundry/go-mod-configuration/v2 v2.1.0 h1:wiLtHYo1QxImARJZt7TYj88cUhq1ANh8se4TBvFsYvw= github.com/edgexfoundry/go-mod-configuration/v2 v2.1.0/go.mod h1:MvHit0MxBXN4bC8LL0NZRsw72ByRE1XwtVLQP9C+2vg= -github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0 h1:uphot3ZKOH0/aoo/Y5gr2NCRgGzy9RksWsXKtJRVEuQ= github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0/go.mod h1:I6UhBPCREubcU0ouIGBdZlNG5Xx4NijUVN5rvEtD03k= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9 h1:EeXfSNWIHpG6sugmW7DjRcA/faeMS8QirRBU01B1smA= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9/go.mod h1:FYFqOHl4OxULCnWecVcBatvk9f/BnRPwivLmARi+YCM= github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0-dev.5 h1:P9eZmCWtnBqJ5brFtdlspY3p2wFBmzUjiRl+CGHbt9M= github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0-dev.5/go.mod h1:bLKWB9yeOHLZoQtHLZlGwz8MjsMJIvHDFce7CcUb4fE= github.com/edgexfoundry/go-mod-registry/v2 v2.1.0 h1:ks0ejtLLUYKuoKrUBbWxygCU7q2mBFJlHE/+dEzV2Gw= @@ -82,24 +83,26 @@ github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrt github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.11.0 h1:IGmIEl7aHTYh6E2HlT+ptILBotjo4xl8PMDl852etiI= github.com/go-kit/kit v0.11.0/go.mod h1:73/6Ixaufkvb5Osvkls8C79vuQ49Ba1rUEUYNSf+FUw= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-redis/redis/v7 v7.3.0 h1:3oHqd0W7f/VLKBxeYTEpqdMUsmMectngjM9OtoRoIgg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -350,8 +353,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 h1:3erb+vDS8lU1sxfDHF4/hhWyaXnhIaO+7RgL4fDZORA= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -424,15 +428,17 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 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.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/go.mod b/go.mod index 7b4a0e6a9..d668a7665 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/diegoholiveira/jsonlogic v1.0.1-0.20200220175622-ab7989be08b9 github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/edgexfoundry/go-mod-bootstrap/v2 v2.1.0 - github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0 + github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9 github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0-dev.5 github.com/edgexfoundry/go-mod-registry/v2 v2.1.0 github.com/fxamacker/cbor/v2 v2.4.0 @@ -25,11 +25,11 @@ require ( github.com/edgexfoundry/go-mod-configuration/v2 v2.1.0 // indirect github.com/edgexfoundry/go-mod-secrets/v2 v2.1.0 // indirect github.com/fatih/color v1.9.0 // indirect - github.com/go-kit/kit v0.11.0 // indirect - github.com/go-logfmt/logfmt v0.5.0 // indirect + github.com/go-kit/log v0.2.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect - github.com/go-playground/validator/v10 v10.9.0 // indirect + github.com/go-playground/validator/v10 v10.10.0 // indirect github.com/go-redis/redis/v7 v7.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/hashicorp/consul/api v1.9.1 // indirect @@ -53,9 +53,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect + golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect + golang.org/x/text v0.3.7 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index 97dd02e58..76c7846f2 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,9 @@ github.com/edgexfoundry/go-mod-bootstrap/v2 v2.1.0 h1:SKhMq8BLUQExVZwZ7slTzxbTsa github.com/edgexfoundry/go-mod-bootstrap/v2 v2.1.0/go.mod h1:+ZXclfGAK0PAyJ4RygGB7R2R6IyoRN0qzsQpOsfClvA= github.com/edgexfoundry/go-mod-configuration/v2 v2.1.0 h1:wiLtHYo1QxImARJZt7TYj88cUhq1ANh8se4TBvFsYvw= github.com/edgexfoundry/go-mod-configuration/v2 v2.1.0/go.mod h1:MvHit0MxBXN4bC8LL0NZRsw72ByRE1XwtVLQP9C+2vg= -github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0 h1:uphot3ZKOH0/aoo/Y5gr2NCRgGzy9RksWsXKtJRVEuQ= github.com/edgexfoundry/go-mod-core-contracts/v2 v2.1.0/go.mod h1:I6UhBPCREubcU0ouIGBdZlNG5Xx4NijUVN5rvEtD03k= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9 h1:EeXfSNWIHpG6sugmW7DjRcA/faeMS8QirRBU01B1smA= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0-dev.9/go.mod h1:FYFqOHl4OxULCnWecVcBatvk9f/BnRPwivLmARi+YCM= github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0-dev.5 h1:P9eZmCWtnBqJ5brFtdlspY3p2wFBmzUjiRl+CGHbt9M= github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0-dev.5/go.mod h1:bLKWB9yeOHLZoQtHLZlGwz8MjsMJIvHDFce7CcUb4fE= github.com/edgexfoundry/go-mod-registry/v2 v2.1.0 h1:ks0ejtLLUYKuoKrUBbWxygCU7q2mBFJlHE/+dEzV2Gw= @@ -82,24 +83,26 @@ github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrt github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.11.0 h1:IGmIEl7aHTYh6E2HlT+ptILBotjo4xl8PMDl852etiI= github.com/go-kit/kit v0.11.0/go.mod h1:73/6Ixaufkvb5Osvkls8C79vuQ49Ba1rUEUYNSf+FUw= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-redis/redis/v7 v7.3.0 h1:3oHqd0W7f/VLKBxeYTEpqdMUsmMectngjM9OtoRoIgg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -350,8 +353,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 h1:3erb+vDS8lU1sxfDHF4/hhWyaXnhIaO+7RgL4fDZORA= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -424,15 +428,17 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 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.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/app/service.go b/internal/app/service.go index 60328f7d2..5ad41cd4d 100644 --- a/internal/app/service.go +++ b/internal/app/service.go @@ -514,7 +514,7 @@ func (svc *Service) Initialize() error { // to wait to be signaled when the configuration has been updated and then process the changes NewConfigUpdateProcessor(svc).WaitForConfigUpdates(configUpdated) - svc.webserver = webserver.NewWebServer(svc.dic, mux.NewRouter()) + svc.webserver = webserver.NewWebServer(svc.dic, mux.NewRouter(), svc.serviceKey) svc.webserver.ConfigureStandardRoutes() svc.lc.Info("Service started in: " + startupTimer.SinceAsString()) diff --git a/internal/app/service_test.go b/internal/app/service_test.go index cba99d804..6b32cd0a2 100644 --- a/internal/app/service_test.go +++ b/internal/app/service_test.go @@ -77,7 +77,7 @@ func IsInstanceOf(objectPtr, typePtr interface{}) bool { func TestAddRoute(t *testing.T) { router := mux.NewRouter() - ws := webserver.NewWebServer(dic, router) + ws := webserver.NewWebServer(dic, router, uuid.NewString()) sdk := Service{ webserver: ws, diff --git a/internal/controller/rest/controller.go b/internal/controller/rest/controller.go index dee632880..4bc68dd6a 100644 --- a/internal/controller/rest/controller.go +++ b/internal/controller/rest/controller.go @@ -44,36 +44,38 @@ type Controller struct { secretProvider interfaces.SecretProvider lc logger.LoggingClient config *sdkCommon.ConfigurationStruct + serviceKey string } // NewController creates and initializes an Controller -func NewController(router *mux.Router, dic *di.Container) *Controller { +func NewController(router *mux.Router, dic *di.Container, serviceKey string) *Controller { return &Controller{ router: router, secretProvider: bootstrapContainer.SecretProviderFrom(dic.Get), lc: bootstrapContainer.LoggingClientFrom(dic.Get), config: container.ConfigurationFrom(dic.Get), + serviceKey: serviceKey, } } // Ping handles the request to /ping endpoint. Is used to test if the service is working // It returns a response as specified by the V2 API swagger in openapi/v2 func (c *Controller) Ping(writer http.ResponseWriter, request *http.Request) { - response := commonDtos.NewPingResponse() + response := commonDtos.NewPingResponse(c.serviceKey) c.sendResponse(writer, request, common.ApiPingRoute, response, http.StatusOK) } // Version handles the request to /version endpoint. Is used to request the service's versions // It returns a response as specified by the V2 API swagger in openapi/v2 func (c *Controller) Version(writer http.ResponseWriter, request *http.Request) { - response := commonDtos.NewVersionSdkResponse(internal.ApplicationVersion, internal.SDKVersion) + response := commonDtos.NewVersionSdkResponse(internal.ApplicationVersion, internal.SDKVersion, c.serviceKey) c.sendResponse(writer, request, common.ApiVersionRoute, response, http.StatusOK) } // Config handles the request to /config endpoint. Is used to request the service's configuration // It returns a response as specified by the V2 API swagger in openapi/v2 func (c *Controller) Config(writer http.ResponseWriter, request *http.Request) { - response := commonDtos.NewConfigResponse(*c.config) + response := commonDtos.NewConfigResponse(*c.config, c.serviceKey) c.sendResponse(writer, request, common.ApiVersionRoute, response, http.StatusOK) } @@ -91,7 +93,7 @@ func (c *Controller) Metrics(writer http.ResponseWriter, request *http.Request) CpuBusyAvg: uint8(t.CpuBusyAvg), } - response := commonDtos.NewMetricsResponse(metrics) + response := commonDtos.NewMetricsResponse(metrics, c.serviceKey) c.sendResponse(writer, request, common.ApiMetricsRoute, response, http.StatusOK) } diff --git a/internal/controller/rest/controller_test.go b/internal/controller/rest/controller_test.go index 2fd250ce6..6d4f18e68 100644 --- a/internal/controller/rest/controller_test.go +++ b/internal/controller/rest/controller_test.go @@ -57,7 +57,9 @@ func TestMain(m *testing.M) { } func TestPingRequest(t *testing.T) { - target := NewController(nil, dic) + serviceName := uuid.NewString() + + target := NewController(nil, dic, serviceName) recorder := doRequest(t, http.MethodGet, common.ApiPingRoute, target.Ping, nil) @@ -68,17 +70,20 @@ func TestPingRequest(t *testing.T) { _, err = time.Parse(time.UnixDate, actual.Timestamp) assert.NoError(t, err) - require.Equal(t, common.ApiVersion, actual.ApiVersion) + assert.Equal(t, common.ApiVersion, actual.ApiVersion) + assert.Equal(t, serviceName, actual.ServiceName) } func TestVersionRequest(t *testing.T) { + serviceName := uuid.NewString() + expectedAppVersion := "1.2.5" expectedSdkVersion := "1.3.1" internal.ApplicationVersion = expectedAppVersion internal.SDKVersion = expectedSdkVersion - target := NewController(nil, dic) + target := NewController(nil, dic, serviceName) recorder := doRequest(t, http.MethodGet, common.ApiVersion, target.Version, nil) @@ -89,10 +94,13 @@ func TestVersionRequest(t *testing.T) { assert.Equal(t, common.ApiVersion, actual.ApiVersion) assert.Equal(t, expectedAppVersion, actual.Version) assert.Equal(t, expectedSdkVersion, actual.SdkVersion) + assert.Equal(t, serviceName, actual.ServiceName) } func TestMetricsRequest(t *testing.T) { - target := NewController(nil, dic) + serviceName := uuid.NewString() + + target := NewController(nil, dic, serviceName) recorder := doRequest(t, http.MethodGet, common.ApiMetricsRoute, target.Metrics, nil) @@ -101,6 +109,8 @@ func TestMetricsRequest(t *testing.T) { require.NoError(t, err) assert.Equal(t, common.ApiVersion, actual.ApiVersion) + assert.Equal(t, serviceName, actual.ServiceName) + assert.NotZero(t, actual.Metrics.MemAlloc) assert.NotZero(t, actual.Metrics.MemFrees) assert.NotZero(t, actual.Metrics.MemLiveObjects) @@ -111,6 +121,8 @@ func TestMetricsRequest(t *testing.T) { } func TestConfigRequest(t *testing.T) { + serviceName := uuid.NewString() + expectedConfig := sdkCommon.ConfigurationStruct{ Writable: sdkCommon.WritableInfo{ LogLevel: "DEBUG", @@ -128,7 +140,7 @@ func TestConfigRequest(t *testing.T) { }, }) - target := NewController(nil, dic) + target := NewController(nil, dic, serviceName) recorder := doRequest(t, http.MethodGet, common.ApiConfigRoute, target.Config, nil) @@ -137,6 +149,7 @@ func TestConfigRequest(t *testing.T) { require.NoError(t, err) assert.Equal(t, common.ApiVersion, actualResponse.ApiVersion) + assert.Equal(t, serviceName, actualResponse.ServiceName) // actualResponse.Config is an interface{} so need to re-marshal/un-marshal into sdkCommon.ConfigurationStruct configJson, err := json.Marshal(actualResponse.Config) @@ -163,7 +176,7 @@ func TestAddSecretRequest(t *testing.T) { mockProvider.On("StoreSecrets", "/mqtt", map[string]string{"password": "password", "username": "username"}).Return(nil) mockProvider.On("StoreSecrets", "/no", map[string]string{"password": "password", "username": "username"}).Return(errors.New("Invalid w/o Vault")) - target := NewController(nil, dic) + target := NewController(nil, dic, uuid.NewString()) assert.NotNil(t, target) validRequest := commonDtos.SecretRequest{ diff --git a/internal/webserver/server.go b/internal/webserver/server.go index 6df815609..8990b26e9 100644 --- a/internal/webserver/server.go +++ b/internal/webserver/server.go @@ -52,12 +52,12 @@ type Version struct { } // NewWebServer returns a new instance of *WebServer -func NewWebServer(dic *di.Container, router *mux.Router) *WebServer { +func NewWebServer(dic *di.Container, router *mux.Router, serviceKey string) *WebServer { ws := &WebServer{ lc: bootstrapContainer.LoggingClientFrom(dic.Get), config: container.ConfigurationFrom(dic.Get), router: router, - controller: rest.NewController(router, dic), + controller: rest.NewController(router, dic, serviceKey), } return ws diff --git a/internal/webserver/server_test.go b/internal/webserver/server_test.go index 5a9e64d19..b2c2dcf4b 100644 --- a/internal/webserver/server_test.go +++ b/internal/webserver/server_test.go @@ -17,6 +17,7 @@ package webserver import ( + "github.com/google/uuid" "net/http" "net/http/httptest" "os" @@ -57,7 +58,7 @@ func TestAddRoute(t *testing.T) { routePath := "/testRoute" testHandler := func(_ http.ResponseWriter, _ *http.Request) {} - webserver := NewWebServer(dic, mux.NewRouter()) + webserver := NewWebServer(dic, mux.NewRouter(), uuid.NewString()) err := webserver.AddRoute(routePath, testHandler) assert.NoError(t, err, "Not expecting an error") @@ -68,7 +69,7 @@ func TestAddRoute(t *testing.T) { } func TestSetupTriggerRoute(t *testing.T) { - webserver := NewWebServer(dic, mux.NewRouter()) + webserver := NewWebServer(dic, mux.NewRouter(), uuid.NewString()) handlerFunctionNotCalled := true handler := func(w http.ResponseWriter, r *http.Request) {