absmach / magistrala

Industrial IoT Messaging and Device Management Platform
https://www.abstractmachines.fr/magistrala.html
Apache License 2.0
2.46k stars 671 forks source link

MG-2236 - Add Constraints Service Provider #2274

Closed WashingtonKK closed 1 month ago

WashingtonKK commented 3 months ago

What type of PR is this?

This is a feature because it adds a constraint provider to magistrala.

What does this do?

This introduces a constraint provider to magistrala that reads constraints from a toml file and uses this to limit the entities created.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes, I have included tests for my changes.

Did you document any new/modified feature?

Yes, I have updated the documentation for the new feature.

Notes

arvindh123 commented 3 months ago
|-- constraints
|   |-- config
|   |   |-- configprovider.go
|--constraints.go

@WashingtonKK What do you think about this folder structure, inside pkg dir But again it like similar to repo folder structure

arvindh123 commented 3 months ago
|-- constraints
|   |-- config
|   |   |-- configprovider.go
|--constraints.go

@WashingtonKK What do you think about this folder structure, inside pkg dir But again it like similar to repo folder structure

In future we can add other providers

like example

|-- constraints
|   |-- config
|   |   |-- configprovider.go
|   |-- strip
|   |   |-- stripprovider.go
|--constraints.go
WashingtonKK commented 3 months ago
|-- constraints
|   |-- config
|   |   |-- configprovider.go
|--constraints.go

@WashingtonKK What do you think about this folder structure, inside pkg dir But again it like similar to repo folder structure

In future we can add other providers

like example

|-- constraints
|   |-- config
|   |   |-- configprovider.go
|   |-- strip
|   |   |-- stripprovider.go
|--constraints.go

@arvindh123 I think this is a good idea, since it will make it easy for us to add more providers. I will update it to that

dborovcanin commented 1 month ago

We will be using middlewares for this, to keep Service relatively independent. Also, some constraints may refer to certain types of limits that fit better to API (filtering by API key, advanced rate-limiting...).