build-trust / ockam

Orchestrate end-to-end encryption, cryptographic identities, mutual authentication, and authorization policies between distributed applications – at massive scale.
https://ockam.io
Apache License 2.0
4.46k stars 560 forks source link

Command - refactor to use typed interfaces to implement commands for `policies` #6705

Open nazmulidris opened 1 year ago

nazmulidris commented 1 year ago

Following the refactoring of RPC calls, we can now implement all commands using typed interfaces and implemented with a specific RPC client.

For example the Projects trait provides an access to projects, to create/list/delete them. That trait is implemented by the Controller client by making requests to the controller.

The use of the Projects interface can be seen in the following command to create projects.

Desired behavior

Provide similar interfaces for all other commands and remove all the "api helpers" from the ockam_command crate for the following:

All the interfaces and implementations must be part of the ockam_api crate so that the purpose of the ockam_command is only to:

[!NOTE] Related epic: https://github.com/build-trust/ockam/issues/6310


We love helping new contributors! ❤️ If you have questions or need help as you explore, please join us on Discord. If you're looking for other issues to contribute to, please checkout our good first issues.

rjtch commented 1 year ago

@nazmulidris can i take this?

nazmulidris commented 1 year ago

@rjtch That's awesome, this is all yours. Please let us know if you have any questions as you explore. You can also ask questions on the contributors discord https://discord.gg/RAbjRr3kds

rjtch commented 12 months ago

@nazmulidris should I use the Policy and PolicyList (ockam_api/node/models/policy) objects for the policy controller in the Ockham_api/cloud? I would maybe move it there because I don't want to re-implement the trait for the Output interface again. Or what do u suggest?

nazmulidris commented 12 months ago

@rjtch Let's wait for @etorreborre to weigh in here. He will be back next week, so we should get some response from him then.

rjtch commented 11 months ago

Hey @etorreborre could you give me your opinion about my last proposition

etorreborre commented 11 months ago

Hi @rjtch, sorry for the delay, I was sick yesterday (and still not great today...).

I'm not sure I understand your question. What do you want to move, from where to where exactly? One thing to consider, if that helps, is that you can always create a newtype wrapper around a given type if you need a specific Output instance. This is what we do here for example.

rjtch commented 11 months ago

Hi @rjtch, sorry for the delay, I was sick yesterday (and still not great today...).

I'm not sure I understand your question. What do you want to move, from where to where exactly? One thing to consider, if that helps, is that you can always create a newtype wrapper around a given type if you need a specific Output instance. This is what we do here for example.

Hi @etorreborre my question is the following: there is already a policy and a policyList struct located here Ockham_api/nodes/models/policy.rs and I wanted to know if it is a good idea to reuse it or to I should rather create a wrapper around it?

etorreborre commented 11 months ago

Yes the idea is to use those data structures directly