space-cloud icon indicating copy to clipboard operation
space-cloud copied to clipboard

[Feature] Add support for adding plugin details in client generator

Open YourTechBud opened this issue 2 years ago • 0 comments

The problem faced currently?

The worker sdk needs to manually provider the plugin details they wish to apply to their handlers. This leads to typos

How can we solve it?

  • spacectl client generate command will fetch the list of plugins from SC (Ref: #1689)
  • Each driver to implement a method named GeneratePlugins()
  • The output of GeneratePlugins() will be an exposed struct named Plugins with a member function for each plugin registered in SC.
    • The member function will be named as `<upperCamelCase(driver)><upperCamelCase(name)>
    • Example: if driver=opa; name=is-admin then name of function will be OpaIsAdmin()
    • Each function will return a struct named PluginDetails which implements a PluginImpl interface. This interface will have 3 methods:
      • Name() -> name of plugin
      • Driver() -> driver of plugin
      • Params() -> type any (will always be nil for now)
  • The output of this will be in a separate file named plugins.go
  • We want this support only for the golang and typescript drivers

If you want this feature to be implemented, give it a thumbs up reaction, so that we can determine which features are important to you. 👍

YourTechBud avatar Jun 17 '23 12:06 YourTechBud