Commit Graph

29 Commits

Author SHA1 Message Date
Aryan Godara 54c7518316
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed

Signed-off-by: aryan <aryangodara03@gmail.com>

* all services updated, auth jwt not working, ineffectual assignment issue

Signed-off-by: aryan <aryangodara03@gmail.com>

* handle error from grpc server in endpointtest

Signed-off-by: aryan <aryangodara03@gmail.com>

* temp commit, auth/jwt needs to be resolved

Signed-off-by: aryan <aryangodara03@gmail.com>

* revert back to jwt v4 temporarily

Signed-off-by: aryan <aryangodara03@gmail.com>

* updated jwt tokenizer

Signed-off-by: aryan <aryangodara03@gmail.com>

* resolve EOF error for httptest requests

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix auth jwt, update to registeredclaims

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix ineffective assignment, auth/api/grpc endpoint failing

Signed-off-by: aryan <aryangodara03@gmail.com>

* temp commit, remove later

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix grpc server setup

Signed-off-by: aryan <aryangodara03@gmail.com>

* resolve golangci tests, remove debug statements

Signed-off-by: aryan <aryangodara03@gmail.com>

* update golangci version and modify linters used

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix failing tests

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix grpc server for setup tests

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix logging and errors inlined

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix remarks, update grpc setup_test

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix setup_test

Signed-off-by: aryan <aryangodara03@gmail.com>

* update setup_test grpc

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix data race

Signed-off-by: aryan <aryangodara03@gmail.com>

* update setup_test grpc

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix grpc setup down to single simple function

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix linting issues

Signed-off-by: aryan <aryangodara03@gmail.com>

* resolve pr comments

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix tests, handle returned errors, go mod tidy vendor

Signed-off-by: aryan <aryangodara03@gmail.com>

* fix errors from new linters

Signed-off-by: aryan <aryangodara03@gmail.com>

---------

Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 17:14:35 +02:00
Sammy Kerata Oina 1a77d384bb
MF-786 - Tracing over NATS using opentracing standard (#1739)
* send and receive span context

Signed-off-by: SammyOina <sammyoina@gmail.com>

* initilize tracer in cmd

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add span context to mainflux message

Signed-off-by: SammyOina <sammyoina@gmail.com>

* propagate span context from adapters

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix failing build

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix failing build

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix linting error

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing middleware to coap service

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing middleware to http service

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing middleware to mqtt service

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing middleware to broker

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing middleware to ws service

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add tracing to services

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix naming convention of functions

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix failing build

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove tracer from mqtt svc

Signed-off-by: SammyOina <sammyoina@gmail.com>

* format code and removed unused code

Signed-off-by: SammyOina <sammyoina@gmail.com>

* rename tracing files

Signed-off-by: SammyOina <sammyoina@gmail.com>

* - rename nats tracer
- intialize tracing at the broker

Signed-off-by: SammyOina <sammyoina@gmail.com>

* check for nil spans

Signed-off-by: SammyOina <sammyoina@gmail.com>

* propagate spans to consumers writers

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove unused variable

Signed-off-by: SammyOina <sammyoina@gmail.com>

* propagate traces to notifiers

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove comments

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove span from message

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove span from message

Signed-off-by: SammyOina <sammyoina@gmail.com>

* trace over rabbitmq and mqtt

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix failing build

Signed-off-by: SammyOina <sammyoina@gmail.com>

* trace subscribe and unsuscribe ops

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add create span method

Signed-off-by: SammyOina <sammyoina@gmail.com>

* pass context from main

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add span tags

Signed-off-by: SammyOina <sammyoina@gmail.com>

* restore coap transport.go

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add context to ops

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add cancel to tracing

Signed-off-by: SammyOina <sammyoina@gmail.com>

* refactor handler

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add comments to exported functions
return interfaces

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove channel span tag

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add pub sub tracer

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add pub sub tracer

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove prefixes from operations

Signed-off-by: SammyOina <sammyoina@gmail.com>

* perpetuate context from root
remove protocol from span tag

Signed-off-by: SammyOina <sammyoina@gmail.com>

* reorder functions

Signed-off-by: SammyOina <sammyoina@gmail.com>

* create span function

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add suffixes
add pubsub tags

Signed-off-by: SammyOina <sammyoina@gmail.com>

* move from if to switch

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add jaeger url to docker compose

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove snake case variables
add comments to exported functions

Signed-off-by: SammyOina <sammyoina@gmail.com>

* check for empty sub topics

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove tracing on consumers

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove duplicate tracers

Signed-off-by: SammyOina <sammyoina@gmail.com>

* clean up unused variables

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove empty lines

Signed-off-by: SammyOina <sammyoina@gmail.com>

* write better comments

Signed-off-by: SammyOina <sammyoina@gmail.com>

* update readme jaeger url

Signed-off-by: SammyOina <sammyoina@gmail.com>

* initialize tracing midlleware on main
update readme jaeger urls

Signed-off-by: SammyOina <sammyoina@gmail.com>

* reorder arguments for tracing middleware

Signed-off-by: SammyOina <sammyoina@gmail.com>

* add context to subscribe

Signed-off-by: SammyOina <sammyoina@gmail.com>

---------

Signed-off-by: SammyOina <sammyoina@gmail.com>
2023-04-20 21:39:33 +02:00
b1ackd0t ada5813f47
MF-1455 - Update Versions of Protobuf (#1704)
* initial commit
* add protoc-gen-gofast
* update generated files
* fix linting
* fix consumers error on message conversion
* fix copying values on transformers
* initial commit
* initial commit
* add protoc-gen-gofast
* update generated files
* fix linting
* fix consumers error on message conversion
* fix copying values on transformers
* embedded for forward compatible.
* remove gogo
* embedded for forward compatible.
* update protoc compiler
* fix linting
* remove hex comment

Signed-off-by: rodneyosodo <socials@rodneyosodo.com>
2023-02-02 18:28:32 +01:00
b1ackd0t 5c495238a6
NOISSUE - RabbitMQ build and deployment (#1570)
* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Bump up tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add more tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add go routines

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Bump up tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add more tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add go routines

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix with wait groups

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* unsubscribe to stop delivering messages

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove exclusivity

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Implement cancel mechanisms

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove broker type

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Configure broker with makefile

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Check if we have changed MESSAGE_BROKER_FILE~

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Set nats automatically

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Catching null and invalid broker type

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove unused fmt

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Nats

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* unexport constants

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change routingkey

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove wait groups

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* protecting map

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add publisher to pubsub

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change proto library

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix typos

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Reduce pubsub tests based on implementation

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove channel cancel

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Export constant

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Embedding publisher into pubsub

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Naming publisher

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update rabbitmq subscriber interface

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* using publisher composition

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change contenttype

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* rename topic for publish and subscribe

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* export errors

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* queue per subscription

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* queue per subscription

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Merge branch 'master' into RabbitMQ-deployment

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* rename nats to broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change routing method

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Direct method with one exchange to many queues, one consumer per queue

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1263 - Move repeating errors to the separate package (#1540)

* MF-1263 - Mv duplicated errors to pkg/errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert test build flags

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix merge

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Fix auth members list response (#1555)

* NOISSUE - Fix auth members list response

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Move group type next to page details

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm membersRes

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz (#1538)

* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* ErrExternalKey typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename ErrUnauthorizedAcces -> ErrAuthentication

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix bootstrap error

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix status code in openapi

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add errors cases

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix status codes

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add gRPC stutus code

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix tests description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix openapi and encodeError

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix grpc message

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test descriptions

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert sdk error

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1059 - Add TLS support for email (#1560)

* Use gomail package for sending emails

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* remove print err

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* Add vendor

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* Rename email structure
remove logger

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* typo in var name

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* rename var

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* remove MF_EMAIL_SECRET

Signed-off-by: Ivan Milosevic <iva@blokovi.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Refactor MQTT subscriber (#1561)

* correct suscriber interface validator + refactore token error handling

Signed-off-by: tzzed <zerouali.t@gmail.com>

* apply review suggestion

Signed-off-by: tzzed <zerouali.t@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1257 - Access messages from readers endpoint with user access token (#1470)

* remove owner id

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add user auth for db reader

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* add user auth for db reader

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* enable mongodb reader for user token reading

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* use uuid check for auth switch between thing key and user tok

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* enable user token reading

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* revert to correct version

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix endpoint test, add additional tests

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove logs,dead code

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix logging messages

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove auth interface, add authorization header type

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* update api doc

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove unused package

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* some refactor of cases for authorization switch

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* correct description in openapi

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix endpoint test to match auth service change

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* some rename

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* initialize auth url

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* add env variables for auth service

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix spelling

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* Things prefix and no prefix for Thing authorization, Bearer for user

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* update readme file

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix default things grpc port

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* enable user reading for timescaledb

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove not used error

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* improve errors

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* refactor authorize

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* add chanID check

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* inline some error checking

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fixing errors

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fixing errors

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* improve test case description

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove test code

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* dont inline

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* refactor a bit encodeError

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove unused error

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* remove unused error

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* fix things auth grpc url

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

* rename variables for header prefix

Signed-off-by: mteodor <mirko.teodorovic@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Bump up tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add more tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add go routines

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Bump up tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add more tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add go routines

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix with wait groups

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* unsubscribe to stop delivering messages

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove exclusivity

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types (#1558)

* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use linux syntax for cmd usage description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix cmd.Use

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Separate Keto hosts for read and write (#1563)

* Separate keto hosts for read and write

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* update readme with new envars

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* rename read connection name

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update dependencies (#1564)

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1240 - Return to service transport layer only service errors (#1559)

* MF-1240 - Return to service transport layer only service errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Remove unecessary errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm duplicated errors and fix transport

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert http endpoint_test

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix conflict

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Implement cancel mechanisms

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1469 - Indicate proper authentication scheme in Authorization header (#1523)

* MF-1469 - Indicate proper authentication scheme in Authorization header

Signed-off-by: Stefan Kovacevic <jen2tri@gmail.com>

* Fixing the remarks on the last push

Signed-off-by: Stefan Kovacevic <jen2tri@gmail.com>

* Remove Bearer prefix in all services and fix tests

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix remarks

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Add nats wrapper for COAP (#1569)

* Add nats wrapper for COAP

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Pass pubsub as argument

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Defer close connection

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Defer close connection

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Rename endpoint to topic

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1348 - Add transport errors logging (#1544)

* MF-1348 - Add go-kit transport level logging

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix merge

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix remark

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix go test flags

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use httputil errors in things and http service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix SDK tests

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use httputil errors in certs and provision service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use httputil errors in consumers service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* General renaming and add ErrMissingToken

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename httputil -> apiutil and use errors in users servive

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use apiutil errors in auth, bootstrap, readers, things and twins

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Replace errors.Contain by comparison

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix remarks

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Simplify validateID

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Simplify validateID

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Simplify and rename ExtractAuthToken -> ExtractBearerToken

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix readers

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix auth key test and remarks

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Improve comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Simplify validateUUID check

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1567 - Use Bearer, Thing or Basic scheme in Authorization header (#1568)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1565 - Document Bearer, Thing and Basic Authorization header (#1566)

* MF-1565 - Document Bearer Authorization header

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix auth, bootstrap, http and readers openapi

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix openapi

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add enc key for bootstrap

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use global security

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix bearer formats

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Polish descriptions

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix boostrap and typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1575 Add 'Name' field to ListMembers response in things svc (#1576)

Signed-off-by: Ivan Balboteo <ivan@submer.com>

Co-authored-by: Ivan Balboteo <ivan@submer.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1580 - Influxdb Writer changes format of update-time to string (#1581)

* - MF-1580
- Modified consumers/writers/influxdb/fields.go
- influxdb-writer used to update data type of update-time to string
- Commented line 12 of consumers/writers/influxdb/fields.go to resolve
  uneccessary data type conversion issue

Signed-off-by: Hasan Tariq <hasantariqashraf@gmail.com>

* - MF-1580
- Removed strconv package from consumers/writers/influxdb/fields.go since it is no longer needed
- Removed line 12 from consumers/writers/influxdb/fields.go
- Replaced retrun value of updateTime with msg.UpdateTime (line 16 in
  fields.go)

Signed-off-by: Hasan Tariq <hasantariqashraf@gmail.com>

* Fix InflxuDB readers

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Co-authored-by: Hasan Tariq <hasant@plcgroup.com>
Co-authored-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Unify MF_INFLUX_READER_DB_HOST and MF_INFLUX_WRITER_DB_HOST envars (#1585)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Fix CoAP adapter (#1572)

* Revert "NOISSUE - Add nats wrapper for COAP (#1569)"

This reverts commit cc5d5195ab.

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix CoAP adapter

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update CoAP observation cancel

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix observe

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix GET handling

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Revert authorization

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Use constants instead of magic numbers

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Remove an empty line

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Extract special observe value to constant

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1582 - Fix lora-adapter MQTT client (#1583)

* MF-1582 - Fix lora-adapter MQTT clien

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add timeout config to the mqtt subscriber

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add sub timeout

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Update changelog and readme for release 0.13.0 (#1592)

* Update release example

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update changelog and examples for 0.13.0 release

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update VerneMQ release (#1593)

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Update changelog for release 0.13.0 (#1595)

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* unexport constants

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change routingkey

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove wait groups

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* protecting map

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add publisher to pubsub

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change proto library

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix typos

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Reduce pubsub tests based on implementation

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Remove channel cancel

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Export constant

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Move invariant statements out of loop for cassandra-writer (#1596)

Signed-off-by: fuzhy <fuzhy1997@outlook.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Embedding publisher into pubsub

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Naming publisher

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Fix Nginx entrypoint script (#1597)

* Fix Nginx entrypoint script

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update dependencies

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix NginX entrypoint

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Revert Makefile changes

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1525 - Add graceful stop for HTTP and GRPC servers (#1548)

* Add : errgroup to cmd/auth

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : Handle graceful stop for auth service
Remove : errgroups from auth service

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : Wait till server shutdown

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Change : instead of waitgroup changed to errgroups

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change : KillSignalHandler return type to error

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Empty Commit

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : Context to http server shutdown
Rename : varaible from proto to protocol

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change : to default log level

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : Sign-off

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add: graceful stop of http and grpc server

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Fix: typos and caps

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add: Signed-off

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Rename: Func KillSignalHandler to SignalHandler
Add: SIGABRT

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Fix: auth service

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add: timeout for grpc gracefulstop
Fix: typos

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add: .vscode folder to git ignore

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change: variable name to stopWaitTime

Signed-off-by: Arvindh <arvindh91@gmail.com>

* remove: .vscode folder

Signed-off-by: Arvindh <arvindh91@gmail.com>

* remove: .vscode from .gitignore

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : logger to handlers

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Add : New line at end of .gitignore file

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Fix : variable naming
Add : graceful stop for timescale

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Remove : unsued NATS library from import

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Move: "https" and "https" to moved to const var

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Move: "http" and "https" to moved to const var

Signed-off-by: Arvindh <arvindh91@gmail.com>

* update:  branch with master

Signed-off-by: Arvindh <arvindh91@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF-1588 - Update Subscriber interface (#1598)

* Initial commit

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update subscriber interface

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Add tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* check subscription map

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Check topic id after topic

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* reword description

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Setup empty queue

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change mqtt implementation

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Switch statements

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Simplify

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change mqtt subscriber

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Protect subscription map

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix subscription

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Set client id

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Format

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change delete method

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update rabbitmq subscriber interface

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* using publisher composition

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change contenttype

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* rename topic for publish and subscribe

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* export errors

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* MF - 1590 - Fix fetching list of users with a zero limit (#1594)

* Add max and min limit size

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Format

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Format

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* NOISSUE - Retrieve client key on cert issuing (#1607)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* fix bug (#1604)

Signed-off-by: zhangchuanfeng <654300242@qq.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* queue per subscription

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* queue per subscription

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change routing method

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Direct method with one exchange to many queues, one consumer per queue

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* ♻️ Not casting data

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* ✏️ Fix typo

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* ♻️ remove passed queue name

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* 🔥 removing echange kind

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Combine tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Refactor unsubscribe method

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix merge conflict

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

*  sub and unsub to dummy topic

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* generate client id from topic and ID

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Rename topicID to clientID

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* update tests

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* merge changes

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* ♻️ rename constant and variable declaration

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* rename to brokers

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* ♻️ Rename brokers

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change mqtt implementation

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Rename broker to brokers

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* include nats port

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* move to build tags

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* move to build tags

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* add nats build tag to test

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* \n at the end of file

Signed-off-by: GitHub <noreply@github.com>

* Add init function

Signed-off-by: GitHub <noreply@github.com>

* Add init function

Signed-off-by: GitHub <noreply@github.com>

* broker url automatically

Signed-off-by: GitHub <noreply@github.com>

* make nats as the default broker

Signed-off-by: GitHub <noreply@github.com>

* Updated publisher and subscriber interface

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Add error to close

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Change image version and let user define URI

Signed-off-by: GitHub <noreply@github.com>

* make broker url configurable

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* add compile check

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* rabbitmq check

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* default broker to nats

Signed-off-by: GitHub <noreply@github.com>

* change broker url in docker compose

Signed-off-by: GitHub <noreply@github.com>

* Fix ci

Signed-off-by: GitHub <noreply@github.com>

* fix makefile

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix env var and ci

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix ci

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Fix consts

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Manuel Imperiale <manuel.Imperiale@gmail.com>
Co-authored-by: Ivan Milošević <iva@blokovi.com>
Co-authored-by: __touk__ <zerouali.t@gmail.com>
Co-authored-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Co-authored-by: stefankovacevic123 <jen2tri@gmail.com>
Co-authored-by: ibalboteo <ivanbalboteo@gmail.com>
Co-authored-by: Ivan Balboteo <ivan@submer.com>
Co-authored-by: Hasan98-git <67228396+Hasan98-git@users.noreply.github.com>
Co-authored-by: Hasan Tariq <hasant@plcgroup.com>
Co-authored-by: fuzhy <fuzhy1997@outlook.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
Co-authored-by: 张传峰 <59160162+zhang-chuanfeng@users.noreply.github.com>
2022-06-21 17:40:20 +02:00
Manuel Imperiale 9e0947a355
MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz (#1538)
* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* ErrExternalKey typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename ErrUnauthorizedAcces -> ErrAuthentication

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix bootstrap error

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix status code in openapi

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add errors cases

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix status codes

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add gRPC stutus code

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix tests description

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix openapi and encodeError

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix grpc message

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix test descriptions

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert sdk error

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2022-02-01 17:33:23 +01:00
Manuel Imperiale 6ad654d7cb
MF-1263 - Move repeating errors to the separate package (#1540)
* MF-1263 - Mv duplicated errors to pkg/errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert test build flags

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix merge

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2022-01-27 17:03:57 +01:00
Manuel Imperiale 0f856f5667
NOISSUE - Rename package aliases uuidProvider into uuid (#1323)
* NOISSUE - Rename pkg aliases uuidProvider into uuid and fix authn typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add missing error checks

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use global uuidProvider

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use expTime globally

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix user uuid provider

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix review

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use idProvider name

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use idProvider instead of uuidProvider

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use idProvider instead of uuidProvider

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2021-01-17 23:12:45 +01:00
Mirko Teodorovic 47217cb5b9
NOISSUE - Merge authz and authn into new service auth (#1313)
* remove owner id

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* move authz into authn and merge into new service

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add groups

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add groups

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add groups endpoints

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add group type

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* adding mocks, some renaming, refactor

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update proto

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* adding mocks, some renaming, refactor

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix linter err,and comments

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* undo renaming, add interface for authn and authz

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam some variables

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renaming

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* remove extra slashes from comment

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* resolving small remarks

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
2020-12-29 23:02:35 +01:00
Mirko Teodorovic d2af0602a0
NOISSUE - Fix dates not being init properly on save, change path construction, replace UUID with ULID for group ID (#1300)
* fix path, group saving with parent

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* change path, enable name change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* revert changes for port

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* replace UUID with ULID

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add ulid

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix migrations

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* revert user groups

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add ulid provider

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* enable group name change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* use null string for parent id

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* remove migrations, disable group delete if group not empty

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* revert docker compose

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add ulid provider

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* remove dash character replacment

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add ulid lib

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* rename UUIDProvider

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* rename package alias

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* remove unused error

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
2020-12-17 17:08:28 +01:00
Dušan Borovčanin f6b1ae735c
MF-1244 - Return UserID alongside with user Email in Identify response (#1245)
* Add both an ID and an Email to API key requests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Use return UserIdentity response

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Replace GetValue with GetEmail

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Refactor Mainflux Key

Add `Subject` field and reorganize Key manipulation.
**Remove backward compatibility**

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix service test

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix DB tests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix API tests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix JWT tests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Uncomment and fix API tests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix SQL statements alignment

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix Issue method docs

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix Retrieve API and API docs

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update tests

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
2020-10-27 19:42:53 +01:00
Darko Draskovic 381ebb1e51
NOISSUE - Add subtopic wildcard for twin attribute's definition (#1214)
* Add wildcard to attribute subtopic

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add MF_TWINS_SUBTOPIC_WILDCARD env var

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove configurable wildcard env var and mqtt notif leftovers

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mongodb RetrieveByAttribute tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add redis wildcard subtopic IDs retrieval

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tests for wildcard state save

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-07-09 12:18:19 +02:00
Darko Draskovic 340e685d70
MF-1180 - Add redis based twins and states cache (#1184)
* Add twins redis cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add connectToRedis to twins main and twinCache to twins service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tracing to twins cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twins cache mock and test setup for redis cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add TestTwinSave to redis twins cache tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add remove twin redis cache test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add channels param to CreateDefinition helper method in mocks

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add IDs test to redis twins cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Simplify senml rec array and attribute creation funcs by removing unnecessary params

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Align cache remove twin method with service remove twin method

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add cache funcs to twins save, update and remove

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add def SaveIDs to redis cache and ref to service SaveStates

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add TwinSaveIDs tests for redis cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add cache related env vars desc to README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twinid bson key constant

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Update method to cache

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Integrate uuid unification related changes

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use named arguments in interface method declarations

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add env vars to docker-compose file

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Make parameter names in interface methods and implementations consistent

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Wrap vars and consts in var and const blocks

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-06-05 11:42:16 +02:00
Manuel Imperiale a7c3cfcf1c
MF-1154 - Move UUID provider to project root (#1172)
* MF-1154 - Move UUID provider to project root

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use naming uuidProvider/up instead of identityProvider/idp

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mutualize UUID mocks

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Move uuid into pkg directory

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-06-03 18:49:44 +02:00
Dušan Borovčanin ea3a891c91
MF-1190 - Add pkg for library packages (#1191)
* Move messaging to pkg

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Move errors to pkg

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Move Transformers to pkg

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Move SDK to pkg

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Remove Transformers from root

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix make proto

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Add copyrights header

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix CI

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Move Auth client to pkg

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix dependencies

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update dependencies and vendors

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix CI

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
2020-06-03 15:16:19 +02:00
Darko Draskovic b4c80132e6
MF-995 - Add Twins tests for endpoint list twins and list states (#1174)
* Add ListTwins test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove monotonic time from twins, definitions and attributes creation and update

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Separate twins and states endpoint tests in two files

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add state generation helper funcs to state endpoint tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add createStateResponse() to states test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add states test cases

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Simplify RetrieveAll twins and states methods

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add service.go to mocks

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename mocks.NewService to mocks.New

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add error checking to endpoint state tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix method comment

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add json response decode success check

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove created and updated fields from twin and state res

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove definition fields from twin req and res

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Create funcs to mocks package

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add service save state tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add service list states test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-05-18 18:46:50 +02:00
Darko Draskovic b13a3135dd
Remove thing related code from twins service (#1169)
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-05-07 17:26:34 +02:00
Manuel Imperiale 2b4cf8a990
NOISSUE - Fix default nats pubsub subject (#1153)
* NOISSUE - Fix default nats publisher subject

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use created timestamp inn transformer

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use created timestamp in transformer

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* rename topic -> subject for nats

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* revert

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* revert

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix subscriber topic

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix timestamp

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use int64 nanoseconds Created timestamp

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add comment to created protobuf field

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm gogo from scripts/ci.sh

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Return publisher in NewPublisher

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-05-04 13:14:06 +02:00
Dušan Borovčanin c3019fffb6
NOISSUE - Refactor messaging (#1141)
* Refactor messaging

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename SubscribeHandler to MessageHandler

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove `Auth` event logs

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update message pubsub APi

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix topics handling

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update CoAP adapter

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update Twins service

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update LoRa adapter

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update OPC UA adapter

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove broker package

Package `broker` is conceptually renamed to package `nats`.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update makefile

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add comment explanation

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix MQTT adapter

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix typo

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Move NATS pub/sub implementation to pubsub pkg

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove an empty line in main methods

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Move messaging-related code to messaging package

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix Twins mocks

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Change Occurred back to Created

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix tranformer test

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix message proto commands

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Replace string literal with constant

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove alias from main method

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Change messaging pubsub alias

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename occured to created

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Handle NATS connection in the NATS PubSub

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename n to pub/pubSub

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix typos

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2020-04-28 11:02:35 +02:00
Ivan Milošević eb9092494e
MF-1128 - Add golangci-linter to a CI script (#1131)
* Add golangci-linter to CI script

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* add no-config flag

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* disable staticcheck

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* disable all except errcheck

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* add more linters

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* add verbose flag for debug
decrease concurrency to 1

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* remove errcheck and verbose flag

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* enable just golint

Signed-off-by: Ivan Milošević <iva@blokovi.com>

* fix lint errors

Signed-off-by: Ivan Milošević <iva@blokovi.com>
2020-04-21 17:05:19 +02:00
Manuel Imperiale 1d78233fe6
MF-1090 - Use named Interfaces args (#1097)
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-04-05 13:15:47 +02:00
Manuel Imperiale fff492bd50
NOISSUE - Create broker package for NATS (#1080)
* NOISSUEE - Create broker package for NATS

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Create funcs to return NATS connection

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* mv os.exit to main

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix Reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix tests and typos

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix CI

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Unify Publisher and Subscriber interfaces

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename Nats interface

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mv message.pb.go, messsage.proto and topics.go to broker directory

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix go.mod

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use mainflux broker for writers and twins services

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix go.mod

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix twins tests

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix make proto

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix message.proto

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix golangcibot

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* regenerate message.pb.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix make proto

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add NATS errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-04-01 21:22:13 +02:00
Darko Draskovic 19503742a6
NOISSUE - Update state based on SenML time value (#1075)
* Update state based on SenML time value

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use Modf to parse SenML rec time

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Update to State in mocks

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Delta to Twin Definition and iota consts for state actions

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use action consts for switch statement

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-03-18 19:56:39 +01:00
Darko Draskovic 3e4a9eb16a
Save senml array msg to multiple states (#1073)
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-03-13 16:20:57 +01:00
Darko Draskovic 3b5d51276f
NOISSUE - Remove twins-service mqtt dependency and publish notifs to nats (#1042)
* Add Publish func to nats

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove mqtt client

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add nats publisher

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Separate nats publisher from subscriber

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Update tests creation methods

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add logger to NATS Publisher

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-02-20 00:10:10 +01:00
Darko Draskovic a30a3b9063
Add arbitrary SenML value type saving to twin state (#1039)
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-02-18 19:56:39 +01:00
Darko Draskovic f785116a6f
NOISSUE - Add aggregate attribute-based search for twin retrieval (#1027)
* Add attribute map for twin retrieval

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Restructure attributes from map[string] to []

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove RAM attribute map and use mongo aggregation

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Update tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove attribute map service property

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-02-04 23:25:51 +01:00
Darko Draskovic 575d1d6bbf NOISSUE Fix obsolete attribute persistance (#1018)
* Fix obsolete attribute update

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Inlined map key presence check

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-01-27 02:15:10 +01:00
Darko Draskovic 0d361f3df1 Fix twins update revision counter (#1011)
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-01-22 15:58:24 +01:00
Darko Draskovic b3991b8497 MF-730 - Add digital twin service for things (#855)
* Add starter kit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add http

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add cmd/main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove reference to things from README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add starter kit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add http

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add cmd/main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove reference to things from README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix env vars in README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix env vars in README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename kit to mfxkit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename kit to mfxkit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add docker compose related files

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add docker compose related files

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Dockerfile to mfxkit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Dockerfile to mfxkit

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twin service to docker-compose.yml

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twin service to docker-compose.yml

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mongo db connection

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mongo db connection

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add TwinRepository mockup

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix docker env vars

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix docker env vars

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twins repo mongodb routines

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twins repo mongodb routines

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mongo db docker test suite

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mongo db docker test suite

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add idp and toDBTwin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add idp and toDBTwin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add test cases to repo twin save test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add test cases to repo twin save test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add users grpc

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add users grpc

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add methods and tests for udpate and update key

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add methods and tests for udpate and update key

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add methods and tests for remove twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add methods and tests for remove twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add svc methods to loggin and metrics

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add svc methods to loggin and metrics

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add AddTwin endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add AddTwin endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add update endpoints

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add update endpoints

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add view and remove endpoints

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add view and remove endpoints

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twin repo mock

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add twin repo mock

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add owner arg to twins repo methods

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add owner arg to twins repo methods

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mock idp service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mock users service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tests for service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tests for service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt client to twins service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt client to twins service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add protocol to mqtt string var

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add protocol to mqtt string var

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add time and attributes related data to Twin struct

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add time and attributes related data to Twin struct

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt publish JSON serialized twin to service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt publish JSON serialized twin to service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for save and update twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for save and update twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for update key and view thing

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for update key and view thing

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix test error for view twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix test error for view twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for remove twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add endpoint tests for remove twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add NATS client

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add NATS client

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add normalizer to nats

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add normalizer to nats

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Refactor nats publish() and remove normalizer

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Refactor nats publish() and remove normalizer

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add ListThingsByChannel() and RetrieveByChannel()

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add ListThingsByChannel() and RetrieveByChannel()

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Twin struct directly in mongodb

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Twin struct directly in mongodb

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Change limit type to uint64

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Change limit type to uint64

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Compose nats subject from msg ch and subtopic

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Compose nats subject from msg ch and subtopic

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt notifs for thing creation and key update

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt notifs for thing creation and key update

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add RetrieveAll to twinRepository and ListTwins to service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add RetrieveAll to twinRepository and ListTwins to service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tests for RetrieveAll and ListTwins

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add tests for RetrieveAll and ListTwins

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix Service interface error

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove test Ping endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt topic to service config

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove UpdateKey request and add fields to Twin related requests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Attributes and State add and view

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add ListTwins endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix service and database tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add ListTwinsByThing endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove twin directory

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add States and Definitions to Twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add defer publish to AddTwin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add refactored and deferred mqtt client publish to Service methods

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add paho subservice

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add paho client to nats

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add mqtt publish and state update

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add Publish wrapper

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use paho Publish wrapper

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Save states in separate collection

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Replace []byte payload by []map[string]interface{}

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add offset to PageMetadata

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename TwinsPage to Page

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add StateRepository

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add StateRepository, mongodb StateRepository adapter and ListStates endpoint

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add RetrieveLast twin to states repository

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Parse def in nats to update state attrib

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add prepareState() helper

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Replace list things by id by view thing by id

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add state repo mock

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix service tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix mongo twins repo tests and remove owner from RetrieveByID params

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix mongo twins repo tests and remove owner from Remove params

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Replace ChannelID in Attribute by Channel

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix endpoint tests for add and update twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix endpoint tests for view and remove twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use new auth service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix mocks auth and mongodb tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix licensing info

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix 'for for'

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Replace short dec by var for default vals and add string map for mqtt op info

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Use Record from mainflux/senml and rename broker to nats in main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove Key from Twin

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove redundant id uniqueness check from mongodb

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add attrib name to attrib update info

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix typos and remove isZeroOfUnderlyingType() helper

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename paho to mqtt

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix env vars in main.go and README.md

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Move twins/api/twins to twins/api and rename twins- prefix to tw- in main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove flows for manual testing and revert to master docker-compose.yml

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove publish from nats and fix tests by updating package names

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename users.go to authn.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix crud op names

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Change id to twinID

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Inline if err != nil and change <prefix>ID to <prefix>_id

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix metadata db search test

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Rename mqtt and nats related files to publisher and subscriber respectively

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Move save state logic from nats to service

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Fix endpoint tests

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove close check from main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Complete deploy section

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add unit tests for states

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove debugging artefacts and unneeded comments to exported funcs

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add port num to defAuthnURL

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2020-01-10 17:25:36 +01:00